tmf: Update next input in custom parser wizard when removing input
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / internal / tmf / ui / parsers / wizards / CustomTxtParserInputWizardPage.java
index f541a85cd835909ba120fd2dbb3b34fdb1d5858e..8f5c98f133f215ef945053b456ca266bc6cdf7c2 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2014 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
@@ -19,12 +19,14 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.URL;
 import java.text.ParseException;
+import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Scanner;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -82,6 +84,7 @@ import org.eclipse.swt.widgets.Text;
 import org.eclipse.tracecompass.internal.tmf.ui.Activator;
 import org.eclipse.tracecompass.internal.tmf.ui.Messages;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition;
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.Tag;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition.Cardinality;
 import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTxtTraceDefinition.InputData;
@@ -102,7 +105,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     private static final String DEFAULT_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
     private static final String TIMESTAMP_FORMAT_BUNDLE = "org.eclipse.tracecompass.doc.user"; //$NON-NLS-1$
     private static final String TIMESTAMP_FORMAT_PATH = "reference/api/org/eclipse/tracecompass/tmf/core/timestamp/TmfTimestampFormat.html"; //$NON-NLS-1$
-    private static final String PATTERN_URL = "http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#sum"; //$NON-NLS-1$
+    private static final String PATTERN_URL = "http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum"; //$NON-NLS-1$
     private static final Image LINE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/line_icon.gif"); //$NON-NLS-1$
     private static final Image ADD_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/add_button.gif"); //$NON-NLS-1$
     private static final Image ADD_NEXT_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/addnext_button.gif"); //$NON-NLS-1$
@@ -121,6 +124,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     private static final Color COLOR_LIGHT_RED = new Color(Display.getDefault(), 255, 192, 192);
     private static final Color COLOR_TEXT_BACKGROUND = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
     private static final Color COLOR_WIDGET_BACKGROUND = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
+    private static final Color COLOR_GRAY = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
 
     private final ISelection selection;
     private CustomTxtTraceDefinition definition;
@@ -198,6 +202,13 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         timestampOutputFormatText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);
         timestampOutputFormatText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
         timestampOutputFormatText.setText(DEFAULT_TIMESTAMP_FORMAT);
+        timestampOutputFormatText.addPaintListener(e -> {
+            if (!timestampOutputFormatText.isFocusControl() && timestampOutputFormatText.getText().trim().isEmpty()) {
+                e.gc.setForeground(COLOR_GRAY);
+                int borderWidth = timestampOutputFormatText.getBorderWidth();
+                e.gc.drawText(Messages.CustomTxtParserInputWizardPage_default, borderWidth, borderWidth);
+            }
+        });
 
         Button timeStampFormatHelpButton = new Button(headerComposite, SWT.PUSH);
         timeStampFormatHelpButton.setImage(HELP_IMAGE);
@@ -250,6 +261,10 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 if (inputLine.parentInput == null) {
                     definition.inputs.remove(inputLine);
                 } else {
+                    int index = inputLine.parentInput.childrenInputs.indexOf(inputLine);
+                    if (index > 0) {
+                        inputLine.parentInput.childrenInputs.get(index - 1).nextInput = inputLine.nextInput;
+                    }
                     inputLine.parentInput.childrenInputs.remove(inputLine);
                 }
                 treeViewer.refresh();
@@ -356,7 +371,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
         SashForm vSash = new SashForm(container, SWT.VERTICAL);
         vSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-        vSash.setBackground(vSash.getDisplay().getSystemColor(SWT.COLOR_GRAY));
+        vSash.setBackground(COLOR_GRAY);
 
         SashForm hSash = new SashForm(vSash, SWT.HORIZONTAL);
         hSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@@ -394,7 +409,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         if (definition == null) {
             definition = new CustomTxtTraceDefinition();
             definition.inputs.add(new InputLine(Cardinality.ZERO_OR_MORE, DEFAULT_REGEX,
-                    Arrays.asList(new InputData(CustomTraceDefinition.TAG_MESSAGE, CustomTraceDefinition.ACTION_SET))));
+                    Arrays.asList(new InputData(Tag.MESSAGE, CustomTraceDefinition.ACTION_SET))));
         }
         loadDefinition(definition);
         treeViewer.expandAll();
@@ -548,7 +563,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     private void loadDefinition(CustomTxtTraceDefinition def) {
         categoryText.setText(def.categoryName);
         logtypeText.setText(def.definitionName);
-        timestampOutputFormatText.setText(def.timeStampOutputFormat);
+        if (def.timeStampOutputFormat != null) {
+            timestampOutputFormatText.setText(def.timeStampOutputFormat);
+        } else {
+            timestampOutputFormatText.setText(""); //$NON-NLS-1$
+        }
         treeViewer.setInput(def.inputs);
         if (def.inputs.size() > 0) {
             InputLine inputLine = def.inputs.get(0);
@@ -564,16 +583,16 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     }
 
     /**
-     * Get the global list of input names.
+     * Get the global list of inputs.
      *
-     * @return The list of input names
+     * @return The list of inputs
      */
-    public List<String> getInputNames() {
-        List<String> inputs = new ArrayList<>();
+    public List<Entry<Tag, String>> getInputs() {
+        List<Entry<Tag, String>> inputs = new ArrayList<>();
         for (InputLine inputLine : definition.inputs) {
-            for (String inputName : getInputNames(inputLine)) {
-                if (!inputs.contains(inputName)) {
-                    inputs.add(inputName);
+            for (Entry<Tag, String> input : getInputs(inputLine)) {
+                if (!inputs.contains(input)) {
+                    inputs.add(input);
                 }
             }
         }
@@ -581,27 +600,27 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     }
 
     /**
-     * Get the list of input names for the given input line.
+     * Get the list of inputs for the given input line, recursively.
      *
      * @param inputLine
      *            The input line
-     * @return The list of input names
+     * @return The list of inputs
      */
-    public List<String> getInputNames(InputLine inputLine) {
-        List<String> inputs = new ArrayList<>();
+    private List<Entry<Tag, String>> getInputs(InputLine inputLine) {
+        List<Entry<Tag, String>> inputs = new ArrayList<>();
         if (inputLine.columns != null) {
             for (InputData inputData : inputLine.columns) {
-                String inputName = inputData.name;
-                if (!inputs.contains(inputName)) {
-                    inputs.add(inputName);
+                Entry<Tag, String> input = new SimpleEntry<>(inputData.tag, inputData.name);
+                if (!inputs.contains(input)) {
+                    inputs.add(input);
                 }
             }
         }
         if (inputLine.childrenInputs != null) {
             for (InputLine childInputLine : inputLine.childrenInputs) {
-                for (String inputName : getInputNames(childInputLine)) {
-                    if (!inputs.contains(inputName)) {
-                        inputs.add(inputName);
+                for (Entry<Tag, String> input : getInputs(childInputLine)) {
+                    if (!inputs.contains(input)) {
+                        inputs.add(input);
                     }
                 }
             }
@@ -628,7 +647,8 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     StringBuilder sb = new StringBuilder();
                     String line = null;
                     while ((line = reader.readLine()) != null) {
-                        sb.append(line + "\n"); //$NON-NLS-1$
+                        sb.append(line);
+                        sb.append('\n');
                     }
                     return sb.toString();
                 } catch (CoreException e) {
@@ -676,7 +696,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 }
             }
 
-            Map<String, String> data = new HashMap<>();
+            Map<Object, String> data = new HashMap<>();
             int rootLineMatches = 0;
             String firstEntryTimeStamp = null;
             String firstEntryTimeStampInputFormat = null;
@@ -708,7 +728,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                         timeStampFormat = null;
                         updatePreviewLine(rootInputLine, matcher, data, rawPos, rootLineMatches);
                         if (rootLineMatches == 1) {
-                            firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
+                            firstEntryTimeStamp = data.get(Tag.TIMESTAMP);
                             firstEntryTimeStampInputFormat = timeStampFormat;
                         }
                         HashMap<InputLine, Integer> countMap = new HashMap<>();
@@ -847,14 +867,14 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }
 
             if (rootLineMatches == 1) {
-                firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
+                firstEntryTimeStamp = data.get(Tag.TIMESTAMP);
                 firstEntryTimeStampInputFormat = timeStampFormat;
             }
             if (firstEntryTimeStamp == null) {
                 timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noTimestampGroup);
                 if (selectedLine != null) {
                     for (InputGroup group : selectedLine.inputs) {
-                        if (group.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+                        if (group.tagCombo.getText().equals(Tag.TIMESTAMP.toString())) {
                             timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingTimestamp);
                             break;
                         }
@@ -864,7 +884,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 try {
                     TmfTimestampFormat timestampFormat = new TmfTimestampFormat(firstEntryTimeStampInputFormat);
                     long timestamp = timestampFormat.parseValue(firstEntryTimeStamp);
-                    timestampFormat = new TmfTimestampFormat(timestampOutputFormatText.getText().trim());
+                    if (timestampOutputFormatText.getText().trim().isEmpty()) {
+                        timestampFormat = new TmfTimestampFormat();
+                    } else {
+                        timestampFormat = new TmfTimestampFormat(timestampOutputFormatText.getText().trim());
+                    }
                     timestampPreviewText.setText(timestampFormat.format(timestamp));
                 } catch (ParseException e) {
                     timestampPreviewText.setText("*parse exception* [" + firstEntryTimeStamp + "] <> [" + firstEntryTimeStampInputFormat + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -876,7 +900,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }
     }
 
-    private void updatePreviewLine(InputLine line, Matcher matcher, Map<String, String> data, int rawPos, int rootLineMatches) {
+    private void updatePreviewLine(InputLine line, Matcher matcher, Map<Object, String> data, int rawPos, int rootLineMatches) {
         for (int i = 0; i < line.columns.size(); i++) {
             InputData input = line.columns.get(i);
             if (i < matcher.groupCount() && matcher.group(i + 1) != null) {
@@ -895,19 +919,20 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 if (value.length() == 0) {
                     continue;
                 }
+                Object key = (input.tag.equals(Tag.OTHER) ? input.name : input.tag);
                 if (input.action == CustomTraceDefinition.ACTION_SET) {
-                    data.put(input.name, value);
-                    if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+                    data.put(key, value);
+                    if (input.tag.equals(Tag.TIMESTAMP)) {
                         timeStampFormat = input.format;
                     }
                 } else if (input.action == CustomTraceDefinition.ACTION_APPEND) {
-                    String s = data.get(input.name);
+                    String s = data.get(key);
                     if (s != null) {
-                        data.put(input.name, s + value);
+                        data.put(key, s + value);
                     } else {
-                        data.put(input.name, value);
+                        data.put(key, value);
                     }
-                    if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+                    if (input.tag.equals(Tag.TIMESTAMP)) {
                         if (timeStampFormat != null) {
                             timeStampFormat += input.format;
                         } else {
@@ -915,13 +940,13 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                         }
                     }
                 } else if (input.action == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
-                    String s = data.get(input.name);
+                    String s = data.get(key);
                     if (s != null) {
-                        data.put(input.name, s + " | " + value); //$NON-NLS-1$
+                        data.put(key, s + " | " + value); //$NON-NLS-1$
                     } else {
-                        data.put(input.name, value);
+                        data.put(key, value);
                     }
-                    if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+                    if (input.tag.equals(Tag.TIMESTAMP)) {
                         if (timeStampFormat != null) {
                             timeStampFormat += " | " + input.format; //$NON-NLS-1$
                         } else {
@@ -1050,6 +1075,8 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         private Label cardinalityMaxLabel;
         private Text cardinalityMaxText;
         private Button infiniteButton;
+        private Button eventTypeButton;
+        private Text eventTypeText;
         private List<InputGroup> inputs = new ArrayList<>();
         private Button addGroupButton;
         private Label addGroupLabel;
@@ -1223,20 +1250,51 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             cardinalityMinText.addVerifyListener(digitsListener);
             cardinalityMaxText.addVerifyListener(digitsListener);
 
+            eventTypeButton = new Button(group, SWT.CHECK);
+            eventTypeButton.setText(Messages.CustomTxtParserInputWizardPage_eventType);
+            eventTypeButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
+            eventTypeButton.addSelectionListener(new SelectionAdapter() {
+                @Override
+                public void widgetSelected(SelectionEvent e) {
+                    if (eventTypeButton.getSelection()) {
+                        eventTypeText.setEnabled(true);
+                    } else {
+                        eventTypeText.setEnabled(false);
+                    }
+                }
+            });
+            eventTypeButton.addSelectionListener(updateListener);
+
+            eventTypeText = new Text(group, SWT.BORDER | SWT.SINGLE);
+            gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+            gd.widthHint = 0;
+            eventTypeText.setLayoutData(gd);
+            if (inputLine.eventType != null) {
+                eventTypeText.setText(inputLine.eventType);
+                eventTypeButton.setSelection(true);
+            } else {
+                eventTypeText.setEnabled(false);
+                eventTypeButton.setSelection(false);
+            }
+            eventTypeText.addModifyListener(updateListener);
+
+
             if (inputLine.columns != null) {
                 for (InputData inputData : inputLine.columns) {
                     InputGroup inputGroup = new InputGroup(group, this, inputs.size() + 1);
-                    if (inputData.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+                    if (inputData.tag.equals(Tag.TIMESTAMP)) {
                         inputGroup.tagCombo.select(0);
                         inputGroup.tagText.setText(inputData.format);
                         inputGroup.tagLabel.setText(Messages.CustomTxtParserInputWizardPage_format);
                         inputGroup.tagLabel.setVisible(true);
                         inputGroup.tagText.setVisible(true);
                         inputGroup.tagText.addModifyListener(updateListener);
-                    } else if (inputData.name.equals(CustomTraceDefinition.TAG_MESSAGE)) {
+                    } else if (inputData.tag.equals(Tag.EVENT_TYPE)) {
                         inputGroup.tagCombo.select(1);
-                    } else {
+                    } else if (inputData.tag.equals(Tag.MESSAGE)) {
                         inputGroup.tagCombo.select(2);
+                    } else {
+                        inputGroup.tagCombo.select(3);
                         inputGroup.tagText.setText(inputData.name);
                         inputGroup.tagLabel.setText(Messages.CustomTxtParserInputWizardPage_name);
                         inputGroup.tagLabel.setVisible(true);
@@ -1298,6 +1356,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
         private void extractInputs() {
             inputLine.setRegex(selectedLine.regexText.getText());
+            inputLine.eventType = selectedLine.eventTypeButton.getSelection() ? selectedLine.eventTypeText.getText().trim() : null;
             switch (cardinalityCombo.getSelectionIndex()) {
             case 0:
                 inputLine.cardinality = Cardinality.ZERO_OR_MORE;
@@ -1338,11 +1397,12 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             for (int i = 0; i < inputs.size(); i++) {
                 InputGroup grp = inputs.get(i);
                 InputData inputData = new InputData();
-                if (grp.tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {
+                inputData.tag = Tag.fromLabel(grp.tagCombo.getText());
+                if (inputData.tag.equals(Tag.OTHER)) {
                     inputData.name = grp.tagText.getText().trim();
                 } else {
-                    inputData.name = grp.tagCombo.getText();
-                    if (grp.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+                    inputData.name = inputData.tag.toString();
+                    if (inputData.tag.equals(Tag.TIMESTAMP)) {
                         inputData.format = grp.tagText.getText().trim();
                     }
                 }
@@ -1407,10 +1467,12 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
 
             tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
-            tagCombo.setItems(new String[] { CustomTraceDefinition.TAG_TIMESTAMP,
-                    CustomTraceDefinition.TAG_MESSAGE,
-                    CustomTraceDefinition.TAG_OTHER });
-            tagCombo.select(1);
+            tagCombo.setItems(new String[] {
+                    Tag.TIMESTAMP.toString(),
+                    Tag.EVENT_TYPE.toString(),
+                    Tag.MESSAGE.toString(),
+                    Tag.OTHER.toString()});
+            tagCombo.select(2);
             tagCombo.addSelectionListener(new SelectionListener() {
                 @Override
                 public void widgetDefaultSelected(SelectionEvent e) {
@@ -1426,20 +1488,20 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                         tagText.setVisible(true);
                         tagText.addModifyListener(updateListener);
                         break;
-                    case 1: // Message
+                    case 1: // Event type
+                        tagLabel.setVisible(false);
+                        tagText.setVisible(false);
+                        break;
+                    case 2: // Message
                         tagLabel.setVisible(false);
                         tagText.setVisible(false);
                         break;
-                    case 2: // Other
+                    case 3: // Other
                         tagLabel.setText(Messages.CustomTxtParserInputWizardPage_name);
                         tagLabel.setVisible(true);
                         tagText.setVisible(true);
                         tagText.addModifyListener(updateListener);
                         break;
-                    case 3: // Continue
-                        tagLabel.setVisible(false);
-                        tagText.setVisible(false);
-                        break;
                     default:
                         break;
                     }
@@ -1539,20 +1601,14 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             String name = Integer.toString(i + 1);
             errors.append(validateLine(inputLine, name));
         }
-        if (timestampFound) {
-            if (definition.timeStampOutputFormat.length() == 0) {
-                errors.append("Enter the output format for the Time Stamp field. "); //$NON-NLS-1$
+        if (timestampFound && !definition.timeStampOutputFormat.isEmpty()) {
+            try {
+                new TmfTimestampFormat(definition.timeStampOutputFormat);
+                timestampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
+            } catch (IllegalArgumentException e) {
+                errors.append("Enter a valid output format for the Time Stamp field [" + e.getMessage() + "]."); //$NON-NLS-1$ //$NON-NLS-2$
                 timestampOutputFormatText.setBackground(COLOR_LIGHT_RED);
-            } else {
-                try {
-                    new TmfTimestampFormat(definition.timeStampOutputFormat);
-                    timestampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
-                } catch (IllegalArgumentException e) {
-                    errors.append("Enter a valid output format for the Time Stamp field [" + e.getMessage() + "]."); //$NON-NLS-1$ //$NON-NLS-2$
-                    timestampOutputFormatText.setBackground(COLOR_LIGHT_RED);
-                }
             }
-
         } else {
             timestampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
         }
@@ -1620,13 +1676,23 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 line.cardinalityMaxText.setBackground(COLOR_TEXT_BACKGROUND);
             }
         }
+        if (inputLine.eventType != null && inputLine.eventType.trim().isEmpty()) {
+            errors.append("Enter the event type (Line " + name + "). "); //$NON-NLS-1$ //$NON-NLS-2$
+            if (line != null) {
+                line.eventTypeText.setBackground(COLOR_LIGHT_RED);
+            }
+        } else {
+            if (line != null) {
+                line.eventTypeText.setBackground(COLOR_TEXT_BACKGROUND);
+            }
+        }
         for (int i = 0; inputLine.columns != null && i < inputLine.columns.size(); i++) {
             InputData inputData = inputLine.columns.get(i);
             InputGroup group = null;
             if (line != null) {
                 group = line.inputs.get(i);
             }
-            if (inputData.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+            if (inputData.tag.equals(Tag.TIMESTAMP)) {
                 timestampFound = true;
                 if (inputData.format.length() == 0) {
                     errors.append("Enter the input format for the Time Stamp (Line " + name + " Group " + (i + 1) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -1646,10 +1712,21 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                         }
                     }
                 }
-            } else if (inputData.name.length() == 0) {
-                errors.append("Enter a name for the data group (Line " + name + " Group " + (i + 1) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-                if (group != null) {
-                    group.tagText.setBackground(COLOR_LIGHT_RED);
+            } else if (inputData.tag.equals(Tag.OTHER)) {
+                if (inputData.name.isEmpty()) {
+                    errors.append("Enter a name for the data group (Line " + name + " Group " + (i + 1) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                    if (group != null) {
+                        group.tagText.setBackground(COLOR_LIGHT_RED);
+                    }
+                } else if (Tag.fromLabel(inputData.name) != null) {
+                    errors.append("Cannot use reserved name for the data group (Line " + name + " Group " + (i + 1) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                    if (group != null) {
+                        group.tagText.setBackground(COLOR_LIGHT_RED);
+                    }
+                } else {
+                    if (group != null) {
+                        group.tagText.setBackground(COLOR_TEXT_BACKGROUND);
+                    }
                 }
             } else {
                 if (group != null) {
This page took 0.031856 seconds and 5 git commands to generate.