Contribute CNF based TMF project handling
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / project / dialogs / ImportTraceWizard.java
CommitLineData
6e512b93
ASL
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
13package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
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;
21import org.eclipse.ui.IImportWizard;
22import org.eclipse.ui.IWorkbench;
23import org.eclipse.ui.ide.IDE;
24import org.eclipse.ui.internal.WorkbenchPlugin;
25import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
6e512b93
ASL
26
27/**
28 * <b><u>ImportTraceWizard</u></b>
29 * <p>
a2e53983 30 *
6e512b93
ASL
31 * TODO: Implement me. Please.
32 */
12c155f5 33@Deprecated
6e512b93
ASL
34@SuppressWarnings("restriction")
35public class ImportTraceWizard extends Wizard implements IImportWizard {
36
37 private IWorkbench fWorkbench;
38 private IStructuredSelection fSelection;
39 private ImportTraceWizardPage fMainPage;
40
a2e53983 41 /**
6e512b93
ASL
42 *
43 */
3b38ea61 44 private final String IMPORT_WIZARD = "LTTngTraceImportWizard"; //$NON-NLS-1$
a2e53983 45
6e512b93 46 public ImportTraceWizard() {
a2e53983
FC
47 IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
48 IDialogSettings section = workbenchSettings.getSection(IMPORT_WIZARD);
49 if (section == null) {
50 section = workbenchSettings.addNewSection(IMPORT_WIZARD);
51 }
52
53 setDialogSettings(section);
6e512b93
ASL
54 }
55
a2e53983
FC
56 /*
57 * (non-Javadoc)
58 *
6e512b93
ASL
59 * @see org.eclipse.jface.wizard.Wizard#addPages()
60 */
61 @Override
a2e53983
FC
62 public void addPages() {
63 super.addPages();
64 fMainPage = new ImportTraceWizardPage(fWorkbench, fSelection);
65 addPage(fMainPage);
6e512b93
ASL
66 }
67
a2e53983
FC
68 /*
69 * (non-Javadoc)
70 *
71 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
72 * org.eclipse.jface.viewers.IStructuredSelection)
6e512b93 73 */
a2e53983
FC
74 @Override
75 @SuppressWarnings("rawtypes")
76 public void init(IWorkbench workbench, IStructuredSelection selection) {
77 fWorkbench = workbench;
78 fSelection = selection;
79
80 List selectedResources = IDE.computeSelectedResources(selection);
81 if (!selectedResources.isEmpty()) {
82 fSelection = new StructuredSelection(selectedResources);
83 }
84
85 setWindowTitle(""); //$NON-NLS-1$
86 setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importdir_wiz.png")); //$NON-NLS-1$
87 setNeedsProgressMonitor(true);
6e512b93 88 }
a2e53983 89
8e30d685 90 public ImportTraceWizardPage getMainPage() {
a2e53983
FC
91 return fMainPage;
92 }
93
94 /**
95 * performFinish is called after the "finish" button is pressed in the
96 * import wizard If we return "false", the wizard will not close.
97 *
98 * We perform here version check on the imported LTTng trace
99 *
100 */
6e512b93 101 @Override
a2e53983
FC
102 public boolean performFinish() {
103 if (fMainPage.getDestination().equals(fMainPage.getInitialContainerString())) {
104 String errMessage[] = { org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationError };
105 errMessage = fMainPage.extendErrorMessage(errMessage, ""); //$NON-NLS-1$
106 errMessage = fMainPage.extendErrorMessage(errMessage, org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationErrorMsg1 + fMainPage.getInitialContainerString() + "\""); //$NON-NLS-1$
107 errMessage = fMainPage.extendErrorMessage(errMessage, org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationErrorMsg2 + fMainPage.getInitialContainerString() + "/MyTrace\""); //$NON-NLS-1$
108 errMessage = fMainPage.extendErrorMessage(errMessage, ""); //$NON-NLS-1$
109 errMessage = fMainPage.extendErrorMessage(errMessage, org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationErrorMsg3);
110 fMainPage.showVersionErrorPopup(errMessage);
111 return false;
112 }
113 return fMainPage.finish();
6e512b93 114 }
a2e53983 115
8e30d685 116 @Override
a2e53983
FC
117 public boolean canFinish() {
118 return fMainPage.isSelectedElementsValidLttngTraces();
8e30d685 119 }
6e512b93 120
8e30d685 121}
This page took 0.034742 seconds and 5 git commands to generate.