tmf: Simple warning fixes in tmf.core and tests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / project / wizards / ImportTraceWizard.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2011, 2012 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.ui.project.wizards;
14
15 import java.util.List;
16
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
26 /**
27 * The import trace wizard implementation.
28 * <p>
29 * @version 1.0
30 * @author Francois Chouinard
31 */
32 public class ImportTraceWizard extends Wizard implements IImportWizard {
33
34 // ------------------------------------------------------------------------
35 // Constants
36 // ------------------------------------------------------------------------
37
38 static private final String PLUGIN_ID = Activator.PLUGIN_ID;
39 static private final String IMPORT_WIZARD = "ImportTraceWizard"; //$NON-NLS-1$
40 static private final String ICON_PATH = "icons/wizban/trace_import_wiz.png"; //$NON-NLS-1$
41
42 // ------------------------------------------------------------------------
43 // Attributes
44 // ------------------------------------------------------------------------
45
46 private IWorkbench fWorkbench;
47 private IStructuredSelection fSelection;
48 private ImportTraceWizardPage fTraceImportWizardPage;
49
50 // ------------------------------------------------------------------------
51 // Constructor
52 // ------------------------------------------------------------------------
53 /**
54 * Default constructor
55 */
56 public ImportTraceWizard() {
57 IDialogSettings workbenchSettings = Activator.getDefault().getDialogSettings();
58 IDialogSettings section = workbenchSettings.getSection(IMPORT_WIZARD);
59 if (section == null) {
60 section = workbenchSettings.addNewSection(IMPORT_WIZARD);
61 }
62 setDialogSettings(section);
63 }
64
65 // ------------------------------------------------------------------------
66 // Wizard
67 // ------------------------------------------------------------------------
68
69 /*
70 * (non-Javadoc)
71 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
72 */
73 @Override
74 public void init(IWorkbench workbench, IStructuredSelection selection) {
75 fWorkbench = workbench;
76 fSelection = selection;
77
78 List<?> selectedResources = IDE.computeSelectedResources(selection);
79 if (!selectedResources.isEmpty()) {
80 fSelection = new StructuredSelection(selectedResources);
81 }
82
83 setWindowTitle(Messages.ImportTraceWizard_DialogTitle);
84 setDefaultPageImageDescriptor(Activator.imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH));
85 setNeedsProgressMonitor(true);
86 }
87
88 /*
89 * (non-Javadoc)
90 * @see org.eclipse.jface.wizard.Wizard#addPages()
91 */
92 @Override
93 public void addPages() {
94 super.addPages();
95 fTraceImportWizardPage = new ImportTraceWizardPage(fWorkbench, fSelection);
96 addPage(fTraceImportWizardPage);
97 }
98
99 /*
100 * (non-Javadoc)
101 * @see org.eclipse.jface.wizard.Wizard#performFinish()
102 */
103 @Override
104 public boolean performFinish() {
105 return fTraceImportWizardPage.finish();
106 }
107
108 }
This page took 0.032351 seconds and 5 git commands to generate.