2010-07-12 Francois Chouinard <fchouinar@gmail.com> Contributions for Bug319429...
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / wizards / CustomXmlParserWizard.java
1 package org.eclipse.linuxtools.tmf.ui.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.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 /*
34 if (this.selection instanceof IStructuredSelection) {
35 Object selection = ((IStructuredSelection)this.selection).getFirstElement();
36 if (selection instanceof IFile) {
37 IFile file = (IFile)selection;
38 IEditorInput editorInput = new FileEditorInput(file);
39 IWorkbench wb = PlatformUI.getWorkbench();
40 IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();
41
42 IEditorPart editor = activePage.findEditor(editorInput);
43 if (editor != null && editor instanceof GenericTableEditor) {
44 activePage.reuseEditor((IReusableEditor)editor, editorInput);
45 activePage.activate(editor);
46 } else {
47 try {
48 editor = activePage.openEditor(editorInput, GenericTableEditor.ID);
49 } catch (PartInitException e) {
50 // TODO Auto-generated catch block
51 e.printStackTrace();
52 }
53 }
54 }
55 }
56 */
57 return true;
58 }
59
60 /**
61 * Adding the page to the wizard.
62 */
63
64 public void addPages() {
65 inputPage = new CustomXmlParserInputWizardPage(selection, definition);
66 addPage(inputPage);
67 outputPage = new CustomXmlParserOutputWizardPage(this);
68 addPage(outputPage);
69 }
70
71 public void init(IWorkbench workbench, IStructuredSelection selection) {
72 this.selection = selection;
73 }
74
75 }
This page took 0.031653 seconds and 5 git commands to generate.