X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tmf%2Forg.eclipse.tracecompass.tmf.ui%2Fsrc%2Forg%2Feclipse%2Ftracecompass%2Finternal%2Ftmf%2Fui%2Fparsers%2Fwizards%2FCustomTxtParserOutputWizardPage.java;h=abfb20f09e0c329b4f8a9af292655088836da5eb;hb=f5cc6ed1674964d61cbbbec7a934e318d5cae45d;hp=2a637b95615e1e96f9e0855b250987e9c3d3c9f9;hpb=a1dadf6b189086b26fc12bfcc29b57a6117b3ac9;p=deliverable%2Ftracecompass.git diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomTxtParserOutputWizardPage.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomTxtParserOutputWizardPage.java index 2a637b9561..abfb20f09e 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomTxtParserOutputWizardPage.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomTxtParserOutputWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 Ericsson + * Copyright (c) 2010, 2016 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Map.Entry; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; @@ -38,6 +39,7 @@ import org.eclipse.tracecompass.internal.tmf.ui.Activator; import org.eclipse.tracecompass.internal.tmf.ui.Messages; import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException; import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn; +import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.Tag; import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTrace; import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition; import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange; @@ -126,7 +128,7 @@ public class CustomTxtParserOutputWizardPage extends WizardPage { private void loadDefinition(final CustomTxtTraceDefinition def) { for (final OutputColumn outputColumn : def.outputs) { - final Output output = new Output(outputsContainer, outputColumn.name); + final Output output = new Output(outputsContainer, outputColumn.tag, outputColumn.name); outputs.add(output); } } @@ -135,15 +137,16 @@ public class CustomTxtParserOutputWizardPage extends WizardPage { public void setVisible(final boolean visible) { if (visible) { this.definition = wizard.inputPage.getDefinition(); - final List outputNames = wizard.inputPage.getInputNames(); + final List> inputs = wizard.inputPage.getInputs(); // dispose outputs that have been removed in the input page final Iterator iter = outputs.iterator(); while (iter.hasNext()) { final Output output = iter.next(); boolean found = false; - for (final String name : outputNames) { - if (output.name.equals(name)) { + for (final Entry input : inputs) { + if (output.tag.equals(input.getKey()) && + output.name.equals(input.getValue())) { found = true; break; } @@ -155,16 +158,17 @@ public class CustomTxtParserOutputWizardPage extends WizardPage { } // create outputs that have been added in the input page - for (final String name : outputNames) { + for (final Entry input : inputs) { boolean found = false; for (final Output output : outputs) { - if (output.name.equals(name)) { + if (output.tag.equals(input.getKey()) && + output.name.equals(input.getValue())) { found = true; break; } } if (!found) { - outputs.add(new Output(outputsContainer, name)); + outputs.add(new Output(outputsContainer, input.getKey(), input.getValue())); } } @@ -252,19 +256,10 @@ public class CustomTxtParserOutputWizardPage extends WizardPage { * @return The output columns */ public List extractOutputs() { - int numColumns = 0; - for (int i = 0; i < outputs.size(); i++) { - if (outputs.get(i).enabledButton.getSelection()) { - numColumns++; - } - } - final List outputColumns = new ArrayList<>(numColumns); - numColumns = 0; - for (int i = 0; i < outputs.size(); i++) { - final Output output = outputs.get(i); + final List outputColumns = new ArrayList<>(); + for (Output output : outputs) { if (output.enabledButton.getSelection()) { - final OutputColumn column = new OutputColumn(); - column.name = checkNotNull(output.nameLabel.getText()); + final OutputColumn column = new OutputColumn(checkNotNull(output.tag), checkNotNull(output.name)); outputColumns.add(column); } } @@ -272,13 +267,15 @@ public class CustomTxtParserOutputWizardPage extends WizardPage { } private class Output { + Tag tag; String name; Button enabledButton; Text nameLabel; Button upButton; Button downButton; - public Output(final Composite parent, final String name) { + public Output(final Composite parent, final Tag tag, final String name) { + this.tag = tag; this.name = name; enabledButton = new Button(parent, SWT.CHECK);