Internalize some classes and fix a pile of warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / project / wizards / ImportTraceWizard.java
CommitLineData
12c155f5
FC
1/*******************************************************************************
2 * Copyright (c) 2010, 2011 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
13package org.eclipse.linuxtools.tmf.ui.project.wizards;
14
15import java.util.List;
16
17import org.eclipse.jface.dialogs.IDialogSettings;
18import org.eclipse.jface.viewers.IStructuredSelection;
19import org.eclipse.jface.viewers.StructuredSelection;
20import org.eclipse.jface.wizard.Wizard;
8fd82db5 21import org.eclipse.linuxtools.internal.tmf.ui.Activator;
12c155f5
FC
22import org.eclipse.ui.IImportWizard;
23import org.eclipse.ui.IWorkbench;
24import org.eclipse.ui.ide.IDE;
25
26/**
27 * <b><u>ImportTraceWizard</u></b>
28 * <p>
29 */
30public class ImportTraceWizard extends Wizard implements IImportWizard {
31
32 // ------------------------------------------------------------------------
33 // Constants
34 // ------------------------------------------------------------------------
35
8fd82db5 36 static private final String PLUGIN_ID = Activator.PLUGIN_ID;
12c155f5
FC
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$
39
40 // ------------------------------------------------------------------------
41 // Attributes
42 // ------------------------------------------------------------------------
43
44 private IWorkbench fWorkbench;
45 private IStructuredSelection fSelection;
46 private ImportTraceWizardPage fTraceImportWizardPage;
47
48 // ------------------------------------------------------------------------
49 // Constructor
50 // ------------------------------------------------------------------------
51
52 public ImportTraceWizard() {
8fd82db5 53 IDialogSettings workbenchSettings = Activator.getDefault().getDialogSettings();
12c155f5
FC
54 IDialogSettings section = workbenchSettings.getSection(IMPORT_WIZARD);
55 if (section == null) {
56 section = workbenchSettings.addNewSection(IMPORT_WIZARD);
57 }
58 setDialogSettings(section);
59 }
60
61 // ------------------------------------------------------------------------
62 // Wizard
63 // ------------------------------------------------------------------------
64
65 @Override
66 public void init(IWorkbench workbench, IStructuredSelection selection) {
67 fWorkbench = workbench;
68 fSelection = selection;
69
70 List<?> selectedResources = IDE.computeSelectedResources(selection);
71 if (!selectedResources.isEmpty()) {
72 fSelection = new StructuredSelection(selectedResources);
73 }
74
75 setWindowTitle(Messages.ImportTraceWizard_DialogTitle);
8fd82db5 76 setDefaultPageImageDescriptor(Activator.imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH));
12c155f5
FC
77 setNeedsProgressMonitor(true);
78 }
79
80 @Override
81 public void addPages() {
82 super.addPages();
83 fTraceImportWizardPage = new ImportTraceWizardPage(fWorkbench, fSelection);
84 addPage(fTraceImportWizardPage);
85 }
86
87 @Override
88 public boolean performFinish() {
89 return fTraceImportWizardPage.finish();
90 }
91
92}
This page took 0.032954 seconds and 5 git commands to generate.