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