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
.CustomXmlTraceDefinition
;
7 import org
.eclipse
.ui
.INewWizard
;
8 import org
.eclipse
.ui
.IWorkbench
;
10 public class CustomXmlParserWizard
extends Wizard
implements INewWizard
{
12 CustomXmlParserInputWizardPage inputPage
;
13 CustomXmlParserOutputWizardPage outputPage
;
14 private ISelection selection
;
15 CustomXmlTraceDefinition definition
;
17 public CustomXmlParserWizard() {
21 public CustomXmlParserWizard(CustomXmlTraceDefinition definition
) {
23 this.definition
= definition
;
27 public boolean performFinish() {
28 CustomXmlTraceDefinition def
= outputPage
.getDefinition();
29 if (definition
!= null && !definition
.definitionName
.equals(def
.definitionName
)) {
30 CustomXmlTraceDefinition
.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 CustomXmlParserInputWizardPage(selection
, definition
);
68 outputPage
= new CustomXmlParserOutputWizardPage(this);
72 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
73 this.selection
= selection
;