1 /*******************************************************************************
2 * Copyright (c) 2010, 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.tmf
.ui
.parsers
.wizards
;
15 import org
.eclipse
.jface
.viewers
.ISelection
;
16 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
17 import org
.eclipse
.jface
.wizard
.Wizard
;
18 import org
.eclipse
.tracecompass
.internal
.tmf
.ui
.parsers
.CustomParserUtils
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.parsers
.custom
.CustomXmlTrace
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.parsers
.custom
.CustomXmlTraceDefinition
;
21 import org
.eclipse
.ui
.INewWizard
;
22 import org
.eclipse
.ui
.IWorkbench
;
25 * Wizard for custom XML trace parsers.
27 * @author Patrick Tasse
29 public class CustomXmlParserWizard
extends Wizard
implements INewWizard
{
31 CustomXmlParserInputWizardPage inputPage
;
32 CustomXmlParserOutputWizardPage outputPage
;
33 private ISelection selection
;
34 CustomXmlTraceDefinition definition
;
35 String initialCategoryName
;
36 String initialDefinitionName
;
41 public CustomXmlParserWizard() {
49 * The trace definition
51 public CustomXmlParserWizard(CustomXmlTraceDefinition definition
) {
53 this.definition
= definition
;
54 if (definition
!= null) {
55 initialCategoryName
= definition
.categoryName
;
56 initialDefinitionName
= definition
.definitionName
;
61 public boolean performFinish() {
62 CustomXmlTraceDefinition def
= outputPage
.getDefinition();
63 if (definition
!= null) {
64 if (!initialCategoryName
.equals(def
.categoryName
) || !initialDefinitionName
.equals(def
.definitionName
)) {
65 CustomXmlTraceDefinition
.delete(initialCategoryName
, initialDefinitionName
);
67 CustomParserUtils
.cleanup(CustomXmlTrace
.buildTraceTypeId(initialCategoryName
, initialDefinitionName
));
74 * Adding the page to the wizard.
78 public void addPages() {
79 inputPage
= new CustomXmlParserInputWizardPage(selection
, definition
);
81 outputPage
= new CustomXmlParserOutputWizardPage(this);
86 public void init(IWorkbench workbench
, IStructuredSelection sel
) {