2010-07-28 Francois Chouinard <fchouinard@gmail.com> Fix for Bug316349 + a bunch...
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / wizards / CustomTxtParserWizard.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.CustomTxtTraceDefinition;
7 import org.eclipse.ui.INewWizard;
8 import org.eclipse.ui.IWorkbench;
9
10 public class CustomTxtParserWizard extends Wizard implements INewWizard {
11
12 CustomTxtParserInputWizardPage inputPage;
13 CustomTxtParserOutputWizardPage outputPage;
14 private ISelection selection;
15 CustomTxtTraceDefinition definition;
16
17 public CustomTxtParserWizard() {
18 super();
19 }
20
21 public CustomTxtParserWizard(CustomTxtTraceDefinition definition) {
22 super();
23 this.definition = definition;
24 }
25
26 @Override
27 public boolean performFinish() {
28 CustomTxtTraceDefinition def = outputPage.getDefinition();
29 if (definition != null && !definition.definitionName.equals(def.definitionName)) {
30 CustomTxtTraceDefinition.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 @Override
65 public void addPages() {
66 inputPage = new CustomTxtParserInputWizardPage(selection, definition);
67 addPage(inputPage);
68 outputPage = new CustomTxtParserOutputWizardPage(this);
69 addPage(outputPage);
70 }
71
72 public void init(IWorkbench workbench, IStructuredSelection selection) {
73 this.selection = selection;
74 }
75
76 }
This page took 0.0314410000000001 seconds and 5 git commands to generate.