1 /*******************************************************************************
2 * Copyright (c) 2010, 2012 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.project
.wizards
;
15 import java
.util
.List
;
17 import org
.eclipse
.jface
.dialogs
.IDialogSettings
;
18 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
19 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
20 import org
.eclipse
.jface
.wizard
.Wizard
;
21 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Activator
;
22 import org
.eclipse
.ui
.IImportWizard
;
23 import org
.eclipse
.ui
.IWorkbench
;
24 import org
.eclipse
.ui
.ide
.IDE
;
25 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
28 * The import trace wizard implementation.
31 * @author Francois Chouinard
33 public class ImportTraceWizard
extends Wizard
implements IImportWizard
{
35 // ------------------------------------------------------------------------
37 // ------------------------------------------------------------------------
39 static private final String PLUGIN_ID
= Activator
.PLUGIN_ID
;
40 static private final String IMPORT_WIZARD
= "ImportTraceWizard"; //$NON-NLS-1$
41 static private final String ICON_PATH
= "icons/wizban/trace_import_wiz.png"; //$NON-NLS-1$
43 // ------------------------------------------------------------------------
45 // ------------------------------------------------------------------------
47 private IWorkbench fWorkbench
;
48 private IStructuredSelection fSelection
;
49 private ImportTraceWizardPage fTraceImportWizardPage
;
51 // ------------------------------------------------------------------------
53 // ------------------------------------------------------------------------
57 public ImportTraceWizard() {
58 IDialogSettings workbenchSettings
= Activator
.getDefault().getDialogSettings();
59 IDialogSettings section
= workbenchSettings
.getSection(IMPORT_WIZARD
);
60 if (section
== null) {
61 section
= workbenchSettings
.addNewSection(IMPORT_WIZARD
);
63 setDialogSettings(section
);
66 // ------------------------------------------------------------------------
68 // ------------------------------------------------------------------------
72 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
75 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
76 fWorkbench
= workbench
;
77 fSelection
= selection
;
79 List
<?
> selectedResources
= IDE
.computeSelectedResources(selection
);
80 if (!selectedResources
.isEmpty()) {
81 fSelection
= new StructuredSelection(selectedResources
);
84 setWindowTitle(Messages
.ImportTraceWizard_DialogTitle
);
85 setDefaultPageImageDescriptor(AbstractUIPlugin
.imageDescriptorFromPlugin(PLUGIN_ID
, ICON_PATH
));
86 setNeedsProgressMonitor(true);
91 * @see org.eclipse.jface.wizard.Wizard#addPages()
94 public void addPages() {
96 fTraceImportWizardPage
= new ImportTraceWizardPage(fWorkbench
, fSelection
);
97 addPage(fTraceImportWizardPage
);
102 * @see org.eclipse.jface.wizard.Wizard#performFinish()
105 public boolean performFinish() {
106 return fTraceImportWizardPage
.finish();