Commit | Line | Data |
---|---|---|
be222f56 PT |
1 | package org.eclipse.linuxtools.internal.tmf.ui.parsers.wizards; |
2 | ||
3 | import org.eclipse.jface.viewers.ISelection; | |
4 | import org.eclipse.jface.viewers.IStructuredSelection; | |
5 | import org.eclipse.jface.wizard.Wizard; | |
6 | import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomXmlTraceDefinition; | |
7 | import org.eclipse.ui.INewWizard; | |
8 | import org.eclipse.ui.IWorkbench; | |
9 | ||
10 | public class CustomXmlParserWizard extends Wizard implements INewWizard { | |
11 | ||
12 | CustomXmlParserInputWizardPage inputPage; | |
13 | CustomXmlParserOutputWizardPage outputPage; | |
14 | private ISelection selection; | |
15 | CustomXmlTraceDefinition definition; | |
16 | ||
17 | public CustomXmlParserWizard() { | |
18 | super(); | |
19 | } | |
20 | ||
21 | public CustomXmlParserWizard(CustomXmlTraceDefinition definition) { | |
22 | super(); | |
23 | this.definition = definition; | |
24 | } | |
25 | ||
26 | @Override | |
27 | public boolean performFinish() { | |
28 | CustomXmlTraceDefinition def = outputPage.getDefinition(); | |
29 | if (definition != null && !definition.definitionName.equals(def.definitionName)) { | |
30 | CustomXmlTraceDefinition.delete(definition.definitionName); | |
31 | } | |
32 | def.save(); | |
33 | return true; | |
34 | } | |
35 | ||
36 | /** | |
37 | * Adding the page to the wizard. | |
38 | */ | |
39 | ||
40 | @Override | |
41 | public void addPages() { | |
42 | inputPage = new CustomXmlParserInputWizardPage(selection, definition); | |
43 | addPage(inputPage); | |
44 | outputPage = new CustomXmlParserOutputWizardPage(this); | |
45 | addPage(outputPage); | |
46 | } | |
47 | ||
48 | @Override | |
49 | public void init(IWorkbench workbench, IStructuredSelection selection) { | |
50 | this.selection = selection; | |
51 | } | |
52 | ||
53 | } |