Commit | Line | Data |
---|---|---|
c3c5c786 FC |
1 | package org.eclipse.linuxtools.tmf.ui.wizards;\r |
2 | \r | |
3 | import org.eclipse.jface.viewers.ISelection;\r | |
4 | import org.eclipse.jface.viewers.IStructuredSelection;\r | |
5 | import org.eclipse.jface.wizard.Wizard;\r | |
6 | import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition;\r | |
7 | import org.eclipse.ui.INewWizard;\r | |
8 | import org.eclipse.ui.IWorkbench;\r | |
9 | \r | |
10 | public 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 | |
72 | public void init(IWorkbench workbench, IStructuredSelection selection) {\r | |
73 | this.selection = selection;\r | |
74 | }\r | |
75 | \r | |
76 | }\r |