2010-10-26 Francois Chouinard <fchouinard@gmail.com> Contribution for Bug309042
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / wizards / CustomTxtParserWizard.java
CommitLineData
c3c5c786
FC
1package org.eclipse.linuxtools.tmf.ui.wizards;\r
2\r
3import org.eclipse.jface.viewers.ISelection;\r
4import org.eclipse.jface.viewers.IStructuredSelection;\r
5import org.eclipse.jface.wizard.Wizard;\r
6import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition;\r
7import org.eclipse.ui.INewWizard;\r
8import org.eclipse.ui.IWorkbench;\r
9\r
10public class CustomTxtParserWizard extends Wizard implements INewWizard {\r
11\r
12 CustomTxtParserInputWizardPage inputPage;\r
13 CustomTxtParserOutputWizardPage outputPage;\r
14 private ISelection selection;\r
15 CustomTxtTraceDefinition definition;\r
16\r
17 public CustomTxtParserWizard() {\r
18 super();\r
19 }\r
20\r
21 public CustomTxtParserWizard(CustomTxtTraceDefinition definition) {\r
22 super();\r
23 this.definition = definition;\r
24 }\r
25\r
26 @Override\r
27 public boolean performFinish() {\r
28 CustomTxtTraceDefinition def = outputPage.getDefinition();\r
29 if (definition != null && !definition.definitionName.equals(def.definitionName)) {\r
30 CustomTxtTraceDefinition.delete(definition.definitionName);\r
31 }\r
32 def.save();\r
33 /*\r
34 if (this.selection instanceof IStructuredSelection) {\r
35 Object selection = ((IStructuredSelection)this.selection).getFirstElement();\r
36 if (selection instanceof IFile) {\r
37 IFile file = (IFile)selection;\r
38 IEditorInput editorInput = new FileEditorInput(file);\r
39 IWorkbench wb = PlatformUI.getWorkbench();\r
40 IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();\r
41 \r
42 IEditorPart editor = activePage.findEditor(editorInput);\r
43 if (editor != null && editor instanceof GenericTableEditor) {\r
44 activePage.reuseEditor((IReusableEditor)editor, editorInput);\r
45 activePage.activate(editor);\r
46 } else {\r
47 try {\r
48 editor = activePage.openEditor(editorInput, GenericTableEditor.ID);\r
49 } catch (PartInitException e) {\r
50 // TODO Auto-generated catch block\r
51 e.printStackTrace();\r
52 }\r
53 }\r
54 }\r
55 }\r
56 */\r
57 return true;\r
58 }\r
59\r
60 /**\r
61 * Adding the page to the wizard.\r
62 */\r
63\r
9ccc6d01
FC
64 @Override\r
65 public void addPages() {\r
c3c5c786
FC
66 inputPage = new CustomTxtParserInputWizardPage(selection, definition);\r
67 addPage(inputPage);\r
68 outputPage = new CustomTxtParserOutputWizardPage(this);\r
69 addPage(outputPage);\r
70 }\r
71\r
d4011df2 72 @Override\r
c3c5c786
FC
73 public void init(IWorkbench workbench, IStructuredSelection selection) {\r
74 this.selection = selection;\r
75 }\r
76\r
77}\r
This page took 0.027293 seconds and 5 git commands to generate.