1 package org
.eclipse
.linuxtools
.tmf
.ui
.wizards
;
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
;
10 public class CustomTxtParserWizard
extends Wizard
implements INewWizard
{
12 CustomTxtParserInputWizardPage inputPage
;
13 CustomTxtParserOutputWizardPage outputPage
;
14 private ISelection selection
;
15 CustomTxtTraceDefinition definition
;
17 public CustomTxtParserWizard() {
21 public CustomTxtParserWizard(CustomTxtTraceDefinition definition
) {
23 this.definition
= definition
;
27 public boolean performFinish() {
28 CustomTxtTraceDefinition def
= outputPage
.getDefinition();
29 if (definition
!= null && !definition
.definitionName
.equals(def
.definitionName
)) {
30 CustomTxtTraceDefinition
.delete(definition
.definitionName
);
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();
42 IEditorPart editor = activePage.findEditor(editorInput);
43 if (editor != null && editor instanceof GenericTableEditor) {
44 activePage.reuseEditor((IReusableEditor)editor, editorInput);
45 activePage.activate(editor);
48 editor = activePage.openEditor(editorInput, GenericTableEditor.ID);
49 } catch (PartInitException e) {
50 // TODO Auto-generated catch block
61 * Adding the page to the wizard.
65 public void addPages() {
66 inputPage
= new CustomTxtParserInputWizardPage(selection
, definition
);
68 outputPage
= new CustomTxtParserOutputWizardPage(this);
72 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
73 this.selection
= selection
;