1 /*******************************************************************************
2 * Copyright (c) 2013 Ericsson
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
10 * Marc-Andre Laperle - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.tmf
.ui
.project
.wizards
.tracepkg
.importexport
;
15 import java
.util
.ArrayList
;
16 import java
.util
.List
;
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
;
27 * Wizard for exporting a trace package
29 * @author Marc-Andre Laperle
31 public class ExportTracePackageWizard
extends Wizard
implements IExportWizard
{
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
;
39 * Constructor for the export trace wizard
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
);
48 setDialogSettings(section
);
49 fSelectedTraces
= new ArrayList
<>();
53 * Constructor for the export trace wizard with known selected traces
55 * @param selectedTraces
58 public ExportTracePackageWizard(List
<TmfTraceElement
> selectedTraces
) {
60 fSelectedTraces
= selectedTraces
;
64 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
65 fSelection
= selection
;
67 setNeedsProgressMonitor(true);
71 public boolean performFinish() {
72 return fPage
.finish();
76 public void addPages() {
78 fPage
= new ExportTracePackageWizardPage(fSelection
, fSelectedTraces
);
79 if (fSelectedTraces
.isEmpty()) {
80 addPage(new ExportTracePackageSelectTraceWizardPage());