tmf: bug 494698 Add per-event fields to custom parsers
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / internal / tmf / ui / parsers / wizards / CustomTxtParserOutputWizardPage.java
index abfb20f09e0c329b4f8a9af292655088836da5eb..5412d314e5faf206e7d0f20ab223fc35a75923a6 100644 (file)
@@ -17,6 +17,7 @@ import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -139,6 +140,21 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
             this.definition = wizard.inputPage.getDefinition();
             final List<Entry<Tag, String>> inputs = wizard.inputPage.getInputs();
 
+            // substitute extra field name/value with extra fields tag
+            Iterator<Entry<Tag, String>> iterator = inputs.iterator();
+            boolean addExtraFields = false;
+            while (iterator.hasNext()) {
+                Entry<Tag, String> entry = iterator.next();
+                if (entry.getKey().equals(Tag.EXTRA_FIELD_NAME) ||
+                        entry.getKey().equals(Tag.EXTRA_FIELD_VALUE)) {
+                    iterator.remove();
+                    addExtraFields = true;
+                }
+            }
+            if (addExtraFields) {
+                inputs.add(new SimpleEntry<>(Tag.EXTRA_FIELDS, Tag.EXTRA_FIELDS.toString()));
+            }
+
             // dispose outputs that have been removed in the input page
             final Iterator<Output> iter = outputs.iterator();
             while (iter.hasNext()) {
This page took 0.029228 seconds and 5 git commands to generate.