2010-07-12 Francois Chouinard <fchouinar@gmail.com> Contribution for Bug319428...
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / project / dialogs / ImportTraceWizard.java
1 /*******************************************************************************
2 * Copyright (c) 2009 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.views.project.dialogs;
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.ui.IImportWizard;
22 import org.eclipse.ui.IWorkbench;
23 import org.eclipse.ui.ide.IDE;
24 import org.eclipse.ui.internal.WorkbenchPlugin;
25 import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
26 import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages;
27
28 /**
29 * <b><u>ImportTraceWizard</u></b>
30 * <p>
31 *
32 * TODO: Implement me. Please.
33 */
34 @SuppressWarnings("restriction")
35 public class ImportTraceWizard extends Wizard implements IImportWizard {
36
37 private IWorkbench fWorkbench;
38 private IStructuredSelection fSelection;
39 private ImportTraceWizardPage fMainPage;
40
41 /**
42 *
43 */
44 public ImportTraceWizard() {
45 IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
46 IDialogSettings section = workbenchSettings.getSection("TmfTraceImportWizard");
47 if (section == null) {
48 section = workbenchSettings.addNewSection("TmfTraceImportWizard");
49 }
50 setDialogSettings(section);
51 }
52
53 /* (non-Javadoc)
54 * @see org.eclipse.jface.wizard.Wizard#addPages()
55 */
56 @Override
57 public void addPages() {
58 super.addPages();
59 fMainPage = new ImportTraceWizardPage(fWorkbench, fSelection);
60 addPage(fMainPage);
61 }
62
63 /* (non-Javadoc)
64 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
65 */
66 @SuppressWarnings("rawtypes")
67 public void init(IWorkbench workbench, IStructuredSelection selection) {
68 fWorkbench = workbench;
69 fSelection = selection;
70
71 List selectedResources = IDE.computeSelectedResources(selection);
72 if (!selectedResources.isEmpty()) {
73 fSelection = new StructuredSelection(selectedResources);
74 }
75
76 setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
77 setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importdir_wiz.png"));
78 setNeedsProgressMonitor(true);
79 }
80
81 /* (non-Javadoc)
82 * @see org.eclipse.jface.wizard.Wizard#performFinish()
83 */
84 @Override
85 public boolean performFinish() {
86 return fMainPage.finish();
87 }
88
89 }
This page took 0.034097 seconds and 5 git commands to generate.