1 /*******************************************************************************
2 * Copyright (c) 2010, 2011 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
;
27 * <b><u>ImportTraceWizard</u></b>
30 public class ImportTraceWizard
extends Wizard
implements IImportWizard
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 static private final String PLUGIN_ID
= Activator
.PLUGIN_ID
;
37 static private final String IMPORT_WIZARD
= "ImportTraceWizard"; //$NON-NLS-1$
38 static private final String ICON_PATH
= "icons/wizban/trace_import_wiz.png"; //$NON-NLS-1$
40 // ------------------------------------------------------------------------
42 // ------------------------------------------------------------------------
44 private IWorkbench fWorkbench
;
45 private IStructuredSelection fSelection
;
46 private ImportTraceWizardPage fTraceImportWizardPage
;
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
52 public ImportTraceWizard() {
53 IDialogSettings workbenchSettings
= Activator
.getDefault().getDialogSettings();
54 IDialogSettings section
= workbenchSettings
.getSection(IMPORT_WIZARD
);
55 if (section
== null) {
56 section
= workbenchSettings
.addNewSection(IMPORT_WIZARD
);
58 setDialogSettings(section
);
61 // ------------------------------------------------------------------------
63 // ------------------------------------------------------------------------
66 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
67 fWorkbench
= workbench
;
68 fSelection
= selection
;
70 List
<?
> selectedResources
= IDE
.computeSelectedResources(selection
);
71 if (!selectedResources
.isEmpty()) {
72 fSelection
= new StructuredSelection(selectedResources
);
75 setWindowTitle(Messages
.ImportTraceWizard_DialogTitle
);
76 setDefaultPageImageDescriptor(Activator
.imageDescriptorFromPlugin(PLUGIN_ID
, ICON_PATH
));
77 setNeedsProgressMonitor(true);
81 public void addPages() {
83 fTraceImportWizardPage
= new ImportTraceWizardPage(fWorkbench
, fSelection
);
84 addPage(fTraceImportWizardPage
);
88 public boolean performFinish() {
89 return fTraceImportWizardPage
.finish();