tmf: Switch tmf.ui to Java 7 + fix warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / project / wizards / tracepkg / importexport / ExportTracePackageWizard.java
1 /*******************************************************************************
2 * Copyright (c) 2013 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 * Marc-Andre Laperle - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.tmf.ui.project.wizards.tracepkg.importexport;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import org.eclipse.jface.dialogs.IDialogSettings;
19 import org.eclipse.jface.viewers.IStructuredSelection;
20 import org.eclipse.jface.wizard.Wizard;
21 import org.eclipse.linuxtools.internal.tmf.ui.Activator;
22 import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
23 import org.eclipse.ui.IExportWizard;
24 import org.eclipse.ui.IWorkbench;
25
26 /**
27 * Wizard for exporting a trace package
28 *
29 * @author Marc-Andre Laperle
30 */
31 public class ExportTracePackageWizard extends Wizard implements IExportWizard {
32
33 private static final String STORE_EXPORT_TRACE_WIZARD = "ExportTraceWizard"; //$NON-NLS-1$
34 private IStructuredSelection fSelection;
35 private List<TmfTraceElement> fSelectedTraces;
36 private ExportTracePackageWizardPage fPage;
37
38 /**
39 * Constructor for the export trace wizard
40 */
41 public ExportTracePackageWizard() {
42 IDialogSettings workbenchSettings = Activator.getDefault().getDialogSettings();
43 IDialogSettings section = workbenchSettings
44 .getSection(STORE_EXPORT_TRACE_WIZARD);
45 if (section == null) {
46 section = workbenchSettings.addNewSection(STORE_EXPORT_TRACE_WIZARD);
47 }
48 setDialogSettings(section);
49 fSelectedTraces = new ArrayList<>();
50 }
51
52 /**
53 * Constructor for the export trace wizard with known selected traces
54 *
55 * @param selectedTraces
56 * the selected traces
57 */
58 public ExportTracePackageWizard(List<TmfTraceElement> selectedTraces) {
59 this();
60 fSelectedTraces = selectedTraces;
61 }
62
63 @Override
64 public void init(IWorkbench workbench, IStructuredSelection selection) {
65 fSelection = selection;
66
67 setNeedsProgressMonitor(true);
68 }
69
70 @Override
71 public boolean performFinish() {
72 return fPage.finish();
73 }
74
75 @Override
76 public void addPages() {
77 super.addPages();
78 fPage = new ExportTracePackageWizardPage(fSelection, fSelectedTraces);
79 if (fSelectedTraces.isEmpty()) {
80 addPage(new ExportTracePackageSelectTraceWizardPage());
81 }
82 addPage(fPage);
83 }
84 }
This page took 0.035078 seconds and 6 git commands to generate.