ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / wizards / CustomTxtParserInputWizardPage.java
index 541746556b1431d99a071dfe8e848e4b7c0412d4..c34dc77f3c725b72224727281970671d9a3bd6cd 100644 (file)
@@ -1,13 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2014 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Patrick Tasse - Initial API and implementation
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.internal.tmf.ui.parsers.wizards;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.net.URL;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -19,6 +30,10 @@ import java.util.regex.PatternSyntaxException;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.viewers.ColumnLabelProvider;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -31,11 +46,15 @@ import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.linuxtools.internal.tmf.ui.Activator;
 import org.eclipse.linuxtools.internal.tmf.ui.Messages;
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTraceDefinition;
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition;
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.Cardinality;
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputData;
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;
+import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTraceDefinition;
+import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTraceDefinition;
+import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTraceDefinition.Cardinality;
+import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTraceDefinition.InputData;
+import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTraceDefinition.InputLine;
+import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType;
+import org.eclipse.linuxtools.tmf.core.project.model.TraceTypeHelper;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestampFormat;
+import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.browser.Browser;
 import org.eclipse.swt.browser.TitleEvent;
@@ -55,6 +74,8 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Font;
 import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -66,45 +87,52 @@ import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
+import org.osgi.framework.Bundle;
 
+/**
+ * Input wizard page for custom text parsers.
+ *
+ * @author Patrick Tasse
+ */
 public class CustomTxtParserInputWizardPage extends WizardPage {
 
     private static final String DEFAULT_REGEX = "\\s*(.*\\S)"; //$NON-NLS-1$
     private static final String DEFAULT_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
-    private static final String SIMPLE_DATE_FORMAT_URL = "http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#skip-navbar_top"; //$NON-NLS-1$
-    private static final String PATTERN_URL = "http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html#sum"; //$NON-NLS-1$
-    private static final Image lineImage = Activator.getDefault().getImageFromPath("/icons/elcl16/line_icon.gif"); //$NON-NLS-1$
-    private static final Image addImage = Activator.getDefault().getImageFromPath("/icons/elcl16/add_button.gif"); //$NON-NLS-1$
-    private static final Image addNextImage = Activator.getDefault().getImageFromPath("/icons/elcl16/addnext_button.gif"); //$NON-NLS-1$
-    private static final Image addChildImage = Activator.getDefault().getImageFromPath("/icons/elcl16/addchild_button.gif"); //$NON-NLS-1$
-    private static final Image deleteImage = Activator.getDefault().getImageFromPath("/icons/elcl16/delete_button.gif"); //$NON-NLS-1$
-    private static final Image moveUpImage = Activator.getDefault().getImageFromPath("/icons/elcl16/moveup_button.gif"); //$NON-NLS-1$
-    private static final Image moveDownImage = Activator.getDefault().getImageFromPath("/icons/elcl16/movedown_button.gif"); //$NON-NLS-1$
-    private static final Image helpImage = Activator.getDefault().getImageFromPath("/icons/elcl16/help_button.gif"); //$NON-NLS-1$
-    private static final Color COLOR_BLACK = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
+    private static final String TIMESTAMP_FORMAT_BUNDLE = "org.eclipse.linuxtools.lttng.help"; //$NON-NLS-1$
+    private static final String TIMESTAMP_FORMAT_PATH = "reference/api/org/eclipse/linuxtools/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 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$
+    private static final Image ADD_CHILD_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/addchild_button.gif"); //$NON-NLS-1$
+    private static final Image DELETE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/delete_button.gif"); //$NON-NLS-1$
+    private static final Image MOVE_UP_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/moveup_button.gif"); //$NON-NLS-1$
+    private static final Image MOVE_DOWN_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/movedown_button.gif"); //$NON-NLS-1$
+    private static final Image HELP_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/help_button.gif"); //$NON-NLS-1$
+    private static final Color COLOR_BLACK = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
     private static final Color COLOR_LIGHT_GREEN = new Color(Display.getDefault(), 192, 255, 192);
-    private static final Color COLOR_GREEN = Display.getCurrent().getSystemColor(SWT.COLOR_GREEN);
+    private static final Color COLOR_GREEN = Display.getDefault().getSystemColor(SWT.COLOR_GREEN);
     private static final Color COLOR_LIGHT_YELLOW = new Color(Display.getDefault(), 255, 255, 192);
-    private static final Color COLOR_YELLOW = Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW);
+    private static final Color COLOR_YELLOW = Display.getDefault().getSystemColor(SWT.COLOR_YELLOW);
     private static final Color COLOR_LIGHT_MAGENTA = new Color(Display.getDefault(), 255, 192, 255);
-    private static final Color COLOR_MAGENTA = Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA);
+    private static final Color COLOR_MAGENTA = Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA);
     private static final Color COLOR_LIGHT_RED = new Color(Display.getDefault(), 255, 192, 192);
-    private static final Color COLOR_TEXT_BACKGROUND = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
-    private static final Color COLOR_WIDGET_BACKGROUND = Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
+    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 final ISelection selection;
     private CustomTxtTraceDefinition definition;
+    private String editCategoryName;
     private String editDefinitionName;
     private String defaultDescription;
     private Line selectedLine;
     private Composite container;
+    private Text categoryText;
     private Text logtypeText;
     private Text timestampOutputFormatText;
     private Text timestampPreviewText;
-    private ScrolledComposite treeScrolledComposite;
     private ScrolledComposite lineScrolledComposite;
     private TreeViewer treeViewer;
-    private Composite treeContainer;
     private Composite lineContainer;
     private StyledText inputText;
     private Font fixedFont;
@@ -115,7 +143,16 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     private String timeStampFormat;
     private boolean timestampFound;
 
-    protected CustomTxtParserInputWizardPage(ISelection selection, CustomTxtTraceDefinition definition) {
+    /**
+     * Constructor
+     *
+     * @param selection
+     *            The Selection object
+     * @param definition
+     *            The trace definition
+     */
+    protected CustomTxtParserInputWizardPage(ISelection selection,
+            CustomTxtTraceDefinition definition) {
         super("CustomParserWizardPage"); //$NON-NLS-1$
         if (definition == null) {
             setTitle(Messages.CustomTxtParserInputWizardPage_windowTitleNew);
@@ -128,11 +165,12 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         this.selection = selection;
         this.definition = definition;
         if (definition != null) {
+            this.editCategoryName = definition.categoryName;
             this.editDefinitionName = definition.definitionName;
         }
     }
 
-       @Override
+    @Override
     public void createControl(Composite parent) {
         container = new Composite(parent, SWT.NULL);
         container.setLayout(new GridLayout());
@@ -146,11 +184,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         headerComposite.setLayout(headerLayout);
         headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
 
-        Label logtypeLabel = new Label(headerComposite, SWT.NULL);
-        logtypeLabel.setText(Messages.CustomTxtParserInputWizardPage_logType);
+        Label categoryLabel = new Label(headerComposite, SWT.NULL);
+        categoryLabel.setText(Messages.CustomTxtParserInputWizardPage_category);
 
-        logtypeText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);
-        logtypeText.setLayoutData(new GridData(120, SWT.DEFAULT));
+        categoryText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);
+        categoryText.setLayoutData(new GridData(120, SWT.DEFAULT));
 
         Label timestampFormatLabel = new Label(headerComposite, SWT.NULL);
         timestampFormatLabel.setText(Messages.CustomTxtParserInputWizardPage_timestampFormat);
@@ -159,18 +197,31 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         timestampOutputFormatText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
         timestampOutputFormatText.setText(DEFAULT_TIMESTAMP_FORMAT);
 
-        Button dateFormatHelpButton = new Button(headerComposite, SWT.PUSH);
-        dateFormatHelpButton.setImage(helpImage);
-        dateFormatHelpButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_dateFormatHelp);
-        dateFormatHelpButton.addSelectionListener(new SelectionAdapter() {
+        Button timeStampFormatHelpButton = new Button(headerComposite, SWT.PUSH);
+        timeStampFormatHelpButton.setImage(HELP_IMAGE);
+        timeStampFormatHelpButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_timestampFormatHelp);
+        timeStampFormatHelpButton.addSelectionListener(new SelectionAdapter() {
             @Override
-                       public void widgetSelected(SelectionEvent e) {
-                openHelpShell(SIMPLE_DATE_FORMAT_URL);
+            public void widgetSelected(SelectionEvent e) {
+                Bundle plugin = Platform.getBundle(TIMESTAMP_FORMAT_BUNDLE);
+                IPath path = new Path(TIMESTAMP_FORMAT_PATH);
+                URL fileURL = FileLocator.find(plugin, path, null);
+                try {
+                    URL pageURL = FileLocator.toFileURL(fileURL);
+                    openHelpShell(pageURL.toString());
+                } catch (IOException e1) {
+                }
             }
         });
 
+        Label logtypeLabel = new Label(headerComposite, SWT.NULL);
+        logtypeLabel.setText(Messages.CustomTxtParserInputWizardPage_logType);
+
+        logtypeText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);
+        logtypeText.setLayoutData(new GridData(120, SWT.DEFAULT));
+        logtypeText.setFocus();
+
         Label timestampPreviewLabel = new Label(headerComposite, SWT.NULL);
-        timestampPreviewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 3, 1));
         timestampPreviewLabel.setText(Messages.CustomTxtParserInputWizardPage_preview);
 
         timestampPreviewText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
@@ -184,10 +235,10 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         buttonBar.setLayout(buttonBarLayout);
 
         Button removeButton = new Button(buttonBar, SWT.PUSH);
-        removeButton.setImage(deleteImage);
+        removeButton.setImage(DELETE_IMAGE);
         removeButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_removeLine);
         removeButton.addSelectionListener(new SelectionAdapter() {
-               @Override
+            @Override
             public void widgetSelected(SelectionEvent e) {
                 if (treeViewer.getSelection().isEmpty() || selectedLine == null) {
                     return;
@@ -205,10 +256,10 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }
         });
         Button addNextButton = new Button(buttonBar, SWT.PUSH);
-        addNextButton.setImage(addNextImage);
+        addNextButton.setImage(ADD_NEXT_IMAGE);
         addNextButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_addNextLine);
         addNextButton.addSelectionListener(new SelectionAdapter() {
-               @Override
+            @Override
             public void widgetSelected(SelectionEvent e) {
                 InputLine inputLine = new InputLine(Cardinality.ZERO_OR_MORE, "", null); //$NON-NLS-1$
                 if (((List<?>) treeViewer.getInput()).size() == 0) {
@@ -232,11 +283,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }
         });
         Button addChildButton = new Button(buttonBar, SWT.PUSH);
-        addChildButton.setImage(addChildImage);
+        addChildButton.setImage(ADD_CHILD_IMAGE);
         addChildButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_addChildLine);
         addChildButton.addSelectionListener(new SelectionAdapter() {
-               @Override
-               public void widgetSelected(SelectionEvent e) {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
                 InputLine inputLine = new InputLine(Cardinality.ZERO_OR_MORE, "", null); //$NON-NLS-1$
                 if (((List<?>) treeViewer.getInput()).size() == 0) {
                     definition.inputs.add(inputLine);
@@ -251,10 +302,10 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }
         });
         Button moveUpButton = new Button(buttonBar, SWT.PUSH);
-        moveUpButton.setImage(moveUpImage);
+        moveUpButton.setImage(MOVE_UP_IMAGE);
         moveUpButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_moveUp);
         moveUpButton.addSelectionListener(new SelectionAdapter() {
-               @Override
+            @Override
             public void widgetSelected(SelectionEvent e) {
                 if (treeViewer.getSelection().isEmpty()) {
                     return;
@@ -263,7 +314,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 if (inputLine.parentInput == null) {
                     for (int i = 1; i < definition.inputs.size(); i++) {
                         if (definition.inputs.get(i).equals(inputLine)) {
-                            definition.inputs.add(i - 1 , definition.inputs.remove(i));
+                            definition.inputs.add(i - 1, definition.inputs.remove(i));
                             break;
                         }
                     }
@@ -276,10 +327,10 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }
         });
         Button moveDownButton = new Button(buttonBar, SWT.PUSH);
-        moveDownButton.setImage(moveDownImage);
+        moveDownButton.setImage(MOVE_DOWN_IMAGE);
         moveDownButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_moveDown);
         moveDownButton.addSelectionListener(new SelectionAdapter() {
-               @Override
+            @Override
             public void widgetSelected(SelectionEvent e) {
                 if (treeViewer.getSelection().isEmpty()) {
                     return;
@@ -288,7 +339,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 if (inputLine.parentInput == null) {
                     for (int i = 0; i < definition.inputs.size() - 1; i++) {
                         if (definition.inputs.get(i).equals(inputLine)) {
-                            definition.inputs.add(i + 1 , definition.inputs.remove(i));
+                            definition.inputs.add(i + 1, definition.inputs.remove(i));
                             break;
                         }
                     }
@@ -308,12 +359,12 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         SashForm hSash = new SashForm(vSash, SWT.HORIZONTAL);
         hSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
 
-        treeScrolledComposite = new ScrolledComposite(hSash, SWT.V_SCROLL | SWT.H_SCROLL);
+        ScrolledComposite treeScrolledComposite = new ScrolledComposite(hSash, SWT.V_SCROLL | SWT.H_SCROLL);
         GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
         gd.heightHint = 200;
         gd.widthHint = 200;
         treeScrolledComposite.setLayoutData(gd);
-        treeContainer = new Composite(treeScrolledComposite, SWT.NONE);
+        Composite treeContainer = new Composite(treeScrolledComposite, SWT.NONE);
         treeContainer.setLayout(new FillLayout());
         treeScrolledComposite.setContent(treeContainer);
         treeScrolledComposite.setExpandHorizontal(true);
@@ -347,12 +398,13 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         treeViewer.expandAll();
         lineContainer.layout();
 
+        categoryText.addModifyListener(updateListener);
         logtypeText.addModifyListener(updateListener);
         timestampOutputFormatText.addModifyListener(updateListener);
 
-        lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
+        lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
 
-        hSash.setWeights(new int[] {1, 2});
+        hSash.setWeights(new int[] { 1, 2 });
 
         Composite sashBottom = new Composite(vSash, SWT.NONE);
         GridLayout sashBottomLayout = new GridLayout(3, false);
@@ -368,18 +420,18 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         highlightAllButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
         highlightAllButton.setText(Messages.CustomTxtParserInputWizardPage_highlightAll);
         highlightAllButton.addSelectionListener(new SelectionAdapter() {
-               @Override
+            @Override
             public void widgetSelected(SelectionEvent e) {
                 updatePreviews(true);
             }
         });
 
         Button legendButton = new Button(sashBottom, SWT.PUSH);
-        legendButton.setImage(helpImage);
+        legendButton.setImage(HELP_IMAGE);
         legendButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_previewLegend);
         legendButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
         legendButton.addSelectionListener(new SelectionAdapter() {
-               @Override
+            @Override
             public void widgetSelected(SelectionEvent e) {
                 openLegend();
             }
@@ -401,7 +453,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         inputText.setText(getSelectionText());
         inputText.addModifyListener(updateListener);
 
-        vSash.setWeights(new int[] {hSash.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, sashBottom.computeSize(SWT.DEFAULT, SWT.DEFAULT).y});
+        vSash.setWeights(new int[] { hSash.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, sashBottom.computeSize(SWT.DEFAULT, SWT.DEFAULT).y });
 
         setControl(container);
 
@@ -411,12 +463,12 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
     private static class InputLineTreeNodeContentProvider implements ITreeContentProvider {
 
-       @Override
+        @Override
         public Object[] getElements(Object inputElement) {
             return ((List<?>) inputElement).toArray();
         }
 
-       @Override
+        @Override
         public Object[] getChildren(Object parentElement) {
             InputLine inputLine = (InputLine) parentElement;
             if (inputLine.childrenInputs == null) {
@@ -425,21 +477,21 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             return inputLine.childrenInputs.toArray();
         }
 
-       @Override
+        @Override
         public boolean hasChildren(Object element) {
             InputLine inputLine = (InputLine) element;
             return (inputLine.childrenInputs != null && inputLine.childrenInputs.size() > 0);
         }
 
-       @Override
+        @Override
         public void dispose() {
         }
 
-       @Override
+        @Override
         public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
         }
 
-       @Override
+        @Override
         public Object getParent(Object element) {
             InputLine inputLine = (InputLine) element;
             return inputLine.parentInput;
@@ -450,7 +502,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
         @Override
         public Image getImage(Object element) {
-            return lineImage;
+            return LINE_IMAGE;
         }
 
         @Override
@@ -464,17 +516,17 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     }
 
     private class InputLineTreeSelectionChangedListener implements ISelectionChangedListener {
-       @Override
+        @Override
         public void selectionChanged(SelectionChangedEvent event) {
             if (selectedLine != null) {
                 selectedLine.dispose();
             }
             if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {
-                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
-                InputLine inputLine = (InputLine) selection.getFirstElement();
+                IStructuredSelection sel = (IStructuredSelection) event.getSelection();
+                InputLine inputLine = (InputLine) sel.getFirstElement();
                 selectedLine = new Line(lineContainer, getName(inputLine), inputLine);
                 lineContainer.layout();
-                lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
+                lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
                 container.layout();
                 validate();
                 updatePreviews();
@@ -482,9 +534,6 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.DialogPage#dispose()
-     */
     @Override
     public void dispose() {
         if (fixedFont != null) {
@@ -495,6 +544,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
     }
 
     private void loadDefinition(CustomTxtTraceDefinition def) {
+        categoryText.setText(def.categoryName);
         logtypeText.setText(def.definitionName);
         timestampOutputFormatText.setText(def.timeStampOutputFormat);
         treeViewer.setInput(def.inputs);
@@ -506,13 +556,18 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
     private String getName(InputLine inputLine) {
         if (inputLine.parentInput == null) {
-            return Integer.toString(definition.inputs.indexOf(inputLine)+1);
+            return Integer.toString(definition.inputs.indexOf(inputLine) + 1);
         }
-        return getName(inputLine.parentInput) + "." + Integer.toString(inputLine.parentInput.childrenInputs.indexOf(inputLine)+1); //$NON-NLS-1$
+        return getName(inputLine.parentInput) + "." + Integer.toString(inputLine.parentInput.childrenInputs.indexOf(inputLine) + 1); //$NON-NLS-1$
     }
 
+    /**
+     * Get the global list of input names.
+     *
+     * @return The list of input names
+     */
     public List<String> getInputNames() {
-        List<String> inputs = new ArrayList<String>();
+        List<String> inputs = new ArrayList<>();
         for (InputLine inputLine : definition.inputs) {
             for (String inputName : getInputNames(inputLine)) {
                 if (!inputs.contains(inputName)) {
@@ -523,8 +578,15 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         return inputs;
     }
 
+    /**
+     * Get the list of input names for the given input line.
+     *
+     * @param inputLine
+     *            The input line
+     * @return The list of input names
+     */
     public List<String> getInputNames(InputLine inputLine) {
-        List<String> inputs = new ArrayList<String>();
+        List<String> inputs = new ArrayList<>();
         if (inputLine.columns != null) {
             for (InputData inputData : inputLine.columns) {
                 String inputName = inputData.name;
@@ -549,15 +611,15 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         selectedLine.dispose();
         selectedLine = null;
         lineContainer.layout();
-        lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
+        lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
         container.layout();
     }
 
     private String getSelectionText() {
         if (this.selection instanceof IStructuredSelection) {
-            Object selection = ((IStructuredSelection)this.selection).getFirstElement();
-            if (selection instanceof IFile) {
-                IFile file = (IFile)selection;
+            Object sel = ((IStructuredSelection) this.selection).getFirstElement();
+            if (sel instanceof IFile) {
+                IFile file = (IFile) sel;
                 BufferedReader reader = null;
                 try {
                     reader = new BufferedReader(new InputStreamReader(file.getContents()));
@@ -595,102 +657,157 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }
         inputText.setStyleRanges(new StyleRange[] {});
 
-        Scanner scanner = new Scanner(inputText.getText());
-        scanner.useDelimiter("\n"); //$NON-NLS-1$
-        int rawPos = 0;
-        String skip; // skip starting delimiters
-        if ((skip = scanner.findWithinHorizon("\\A\n+", 0)) != null) { //$NON-NLS-1$
-            rawPos += skip.length();
-        }
+        try (Scanner scanner = new Scanner(inputText.getText());) {
+            scanner.useDelimiter("\n"); //$NON-NLS-1$
 
-        timeStampFormat = null;
-        if (selectedLine != null) {
-            for (InputGroup input : selectedLine.inputs) {
-                input.previewText.setText(Messages.CustomTxtParserInputWizardPage_noMathcingLine);
+            int rawPos = 0;
+            // skip starting delimiters
+            String skip = scanner.findWithinHorizon("\\A\n+", 0); //$NON-NLS-1$
+            if (skip != null) {
+                rawPos += skip.length();
             }
-        }
 
-        Map<String, String> data = new HashMap<String, String>();
-        int rootLineMatches = 0;
-        String firstEntryTimeStamp = null;
-        String firstEntryTimeStampInputFormat = null;
-        String log = null;
-    event:
-        while (scanner.hasNext()) {
-            if (rootLineMatches > 0 && !updateAll) {
-                break;
-            }
-            if (log == null) {
-                log = scanner.next();
+            timeStampFormat = null;
+            if (selectedLine != null) {
+                for (InputGroup input : selectedLine.inputs) {
+                    input.previewText.setText(Messages.CustomTxtParserInputWizardPage_noMathcingLine);
+                }
             }
-            int length = log.length();
-            for (InputLine rootInputLine : definition.inputs) {
-                Pattern pattern;
-                try {
-                    pattern = rootInputLine.getPattern();
-                } catch (PatternSyntaxException e) {
-                    continue;
+
+            Map<String, String> data = new HashMap<>();
+            int rootLineMatches = 0;
+            String firstEntryTimeStamp = null;
+            String firstEntryTimeStampInputFormat = null;
+            String line = null;
+            boolean lineIsNull = true; // needed because of JDT bug with continue at label
+            event: while (scanner.hasNext() || !lineIsNull) {
+                if (rootLineMatches > 0 && !updateAll) {
+                    break;
                 }
-                Matcher matcher = pattern.matcher(log);
-                if (matcher.find()) {
-                    rootLineMatches++;
-                    inputText.setStyleRange(new StyleRange(rawPos, length,
-                            COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
-                    data = new HashMap<String, String>();
-                    timeStampFormat = null;
-                    updatePreviewLine(rootInputLine, matcher, data, rawPos, rootLineMatches);
-                    if (rootLineMatches == 1) {
-                        firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
-                        firstEntryTimeStampInputFormat = timeStampFormat;
-                    }
-                    HashMap<InputLine, Integer> countMap = new HashMap<InputLine, Integer>();
-                    InputLine currentInput = null;
-                    if (rootInputLine.childrenInputs != null && rootInputLine.childrenInputs.size() > 0) {
-                        currentInput = rootInputLine.childrenInputs.get(0);
-                        countMap.put(currentInput, 0);
+                if (line == null) {
+                    line = scanner.next();
+                    lineIsNull = false;
+                }
+                int length = line.length();
+                String log = line.replaceAll("\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
+                for (InputLine rootInputLine : definition.inputs) {
+                    Pattern pattern;
+                    try {
+                        pattern = rootInputLine.getPattern();
+                    } catch (PatternSyntaxException e) {
+                        continue;
                     }
-                    rawPos += length + 1; // +1 for \n
-                    while (scanner.hasNext()) {
-                        log = scanner.next();
-                        length = log.length();
-                        boolean processed = false;
-                        if (currentInput == null) {
-                            for (InputLine input : definition.inputs) {
-                                matcher = input.getPattern().matcher(log);
-                                if (matcher.find()) {
-                                    continue event;
-                                }
-                            }
-                        } else {
-                            if (countMap.get(currentInput) >= currentInput.getMinCount()) {
-                                List<InputLine> nextInputs = currentInput.getNextInputs(countMap);
-                                if (nextInputs.size() == 0 || nextInputs.get(nextInputs.size() - 1).getMinCount() == 0) {
-                                    for (InputLine input : definition.inputs) {
+                    Matcher matcher = pattern.matcher(log);
+                    if (matcher.matches()) {
+                        rootLineMatches++;
+                        inputText.setStyleRange(new StyleRange(rawPos, length,
+                                COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
+                        data = new HashMap<>();
+                        timeStampFormat = null;
+                        updatePreviewLine(rootInputLine, matcher, data, rawPos, rootLineMatches);
+                        if (rootLineMatches == 1) {
+                            firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
+                            firstEntryTimeStampInputFormat = timeStampFormat;
+                        }
+                        HashMap<InputLine, Integer> countMap = new HashMap<>();
+                        InputLine currentInput = null;
+                        if (rootInputLine.childrenInputs != null && rootInputLine.childrenInputs.size() > 0) {
+                            currentInput = rootInputLine.childrenInputs.get(0);
+                            countMap.put(currentInput, 0);
+                        }
+                        rawPos += length + 1; // +1 for \n
+                        while (scanner.hasNext()) {
+                            line = scanner.next();
+                            length = line.length();
+                            log = line.replaceAll("\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
+                            boolean processed = false;
+                            if (currentInput == null) {
+                                for (InputLine input : definition.inputs) {
+                                    try {
                                         matcher = input.getPattern().matcher(log);
-                                        if (matcher.find()) {
-                                            continue event;
+                                    } catch (PatternSyntaxException e) {
+                                        continue;
+                                    }
+                                    if (matcher.matches()) {
+                                        continue event;
+                                    }
+                                }
+                            } else {
+                                if (countMap.get(currentInput) >= currentInput.getMinCount()) {
+                                    List<InputLine> nextInputs = currentInput.getNextInputs(countMap);
+                                    if (nextInputs.size() == 0 || nextInputs.get(nextInputs.size() - 1).getMinCount() == 0) {
+                                        for (InputLine input : definition.inputs) {
+                                            try {
+                                                matcher = input.getPattern().matcher(log);
+                                            } catch (PatternSyntaxException e) {
+                                                continue;
+                                            }
+                                            if (matcher.matches()) {
+                                                continue event;
+                                            }
+                                        }
+                                    }
+                                    for (InputLine input : nextInputs) {
+                                        try {
+                                            matcher = input.getPattern().matcher(log);
+                                        } catch (PatternSyntaxException e) {
+                                            continue;
+                                        }
+                                        if (matcher.matches()) {
+                                            inputText.setStyleRange(new StyleRange(rawPos, length,
+                                                    COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
+                                            currentInput = input;
+                                            updatePreviewLine(currentInput, matcher, data, rawPos, rootLineMatches);
+                                            if (countMap.get(currentInput) == null) {
+                                                countMap.put(currentInput, 1);
+                                            } else {
+                                                countMap.put(currentInput, countMap.get(currentInput) + 1);
+                                            }
+                                            Iterator<InputLine> iter = countMap.keySet().iterator();
+                                            while (iter.hasNext()) {
+                                                InputLine inputLine = iter.next();
+                                                if (inputLine.level > currentInput.level) {
+                                                    iter.remove();
+                                                }
+                                            }
+                                            if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {
+                                                currentInput = currentInput.childrenInputs.get(0);
+                                                countMap.put(currentInput, 0);
+                                            } else {
+                                                if (countMap.get(currentInput) >= currentInput.getMaxCount()) {
+                                                    if (currentInput.getNextInputs(countMap).size() > 0) {
+                                                        currentInput = currentInput.getNextInputs(countMap).get(0);
+                                                        if (countMap.get(currentInput) == null) {
+                                                            countMap.put(currentInput, 0);
+                                                        }
+                                                        iter = countMap.keySet().iterator();
+                                                        while (iter.hasNext()) {
+                                                            InputLine inputLine = iter.next();
+                                                            if (inputLine.level > currentInput.level) {
+                                                                iter.remove();
+                                                            }
+                                                        }
+                                                    } else {
+                                                        currentInput = null;
+                                                    }
+                                                }
+                                            }
+                                            processed = true;
+                                            break;
                                         }
                                     }
                                 }
-                                for (InputLine input : nextInputs) {
-                                    matcher = input.getPattern().matcher(log);
-                                    if (matcher.find()) {
+                                if (!processed && currentInput != null) {
+                                    matcher = null;
+                                    try {
+                                        matcher = currentInput.getPattern().matcher(log);
+                                    } catch (PatternSyntaxException e) {
+                                    }
+                                    if (matcher != null && matcher.matches()) {
                                         inputText.setStyleRange(new StyleRange(rawPos, length,
                                                 COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
-                                        currentInput = input;
                                         updatePreviewLine(currentInput, matcher, data, rawPos, rootLineMatches);
-                                        if (countMap.get(currentInput) == null) {
-                                            countMap.put(currentInput, 1);
-                                        } else {
-                                            countMap.put(currentInput, countMap.get(currentInput) + 1);
-                                        }
-                                        Iterator<InputLine> iter = countMap.keySet().iterator();
-                                        while (iter.hasNext()) {
-                                            InputLine inputLine = iter.next();
-                                            if (inputLine.level > currentInput.level) {
-                                                iter.remove();
-                                            }
-                                        }
+                                        countMap.put(currentInput, countMap.get(currentInput) + 1);
                                         if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {
                                             currentInput = currentInput.childrenInputs.get(0);
                                             countMap.put(currentInput, 0);
@@ -701,7 +818,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                                                     if (countMap.get(currentInput) == null) {
                                                         countMap.put(currentInput, 0);
                                                     }
-                                                    iter = countMap.keySet().iterator();
+                                                    Iterator<InputLine> iter = countMap.keySet().iterator();
                                                     while (iter.hasNext()) {
                                                         InputLine inputLine = iter.next();
                                                         if (inputLine.level > currentInput.level) {
@@ -713,98 +830,65 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                                                 }
                                             }
                                         }
-                                        processed = true;
-                                        break;
-                                    }
-                                }
-                            }
-                            if (! processed) {
-                                matcher = currentInput.getPattern().matcher(log);
-                                if (matcher.find()) {
-                                    inputText.setStyleRange(new StyleRange(rawPos, length,
-                                            COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
-                                    updatePreviewLine(currentInput, matcher, data, rawPos, rootLineMatches);
-                                    countMap.put(currentInput, countMap.get(currentInput) + 1);
-                                    if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {
-                                        currentInput = currentInput.childrenInputs.get(0);
-                                        countMap.put(currentInput, 0);
-                                    } else {
-                                        if (countMap.get(currentInput) >= currentInput.getMaxCount()) {
-                                            if (currentInput.getNextInputs(countMap).size() > 0) {
-                                                currentInput = currentInput.getNextInputs(countMap).get(0);
-                                                if (countMap.get(currentInput) == null) {
-                                                    countMap.put(currentInput, 0);
-                                                }
-                                                Iterator<InputLine> iter = countMap.keySet().iterator();
-                                                while (iter.hasNext()) {
-                                                    InputLine inputLine = iter.next();
-                                                    if (inputLine.level > currentInput.level) {
-                                                        iter.remove();
-                                                    }
-                                                }
-                                            } else {
-                                                currentInput = null;
-                                            }
-                                        }
                                     }
                                 }
                             }
+                            rawPos += length + 1; // +1 for \n
                         }
-                        rawPos += length + 1; // +1 for \n
-                    }
 
-                    break;
-                }
-            }
-            rawPos += length + 1; // +1 for \n
-            log = null;
-        }
-        scanner.close();
-        if (rootLineMatches == 1) {
-            firstEntryTimeStamp = data.get(CustomTraceDefinition.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)) {
-                        timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingTimestamp);
                         break;
                     }
                 }
+                rawPos += length + 1; // +1 for \n
+                line = null;
+                lineIsNull = true;
             }
-        } else {
-            try {
-                SimpleDateFormat dateFormat = new SimpleDateFormat(firstEntryTimeStampInputFormat);
-                Date date = dateFormat.parse(firstEntryTimeStamp);
-                dateFormat = new SimpleDateFormat(timestampOutputFormatText.getText().trim());
-                timestampPreviewText.setText(dateFormat.format(date));
-            } catch (ParseException e) {
-                timestampPreviewText.setText("*parse exception* [" + firstEntryTimeStamp + "] <> [" + firstEntryTimeStampInputFormat + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-            } catch (IllegalArgumentException e) {
-                timestampPreviewText.setText("*parse exception* [Illegal Argument]"); //$NON-NLS-1$
+
+            if (rootLineMatches == 1) {
+                firstEntryTimeStamp = data.get(CustomTraceDefinition.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)) {
+                            timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingTimestamp);
+                            break;
+                        }
+                    }
+                }
+            } else {
+                try {
+                    TmfTimestampFormat timestampFormat = new TmfTimestampFormat(firstEntryTimeStampInputFormat);
+                    long timestamp = timestampFormat.parseValue(firstEntryTimeStamp);
+                    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$
+                } catch (IllegalArgumentException e) {
+                    timestampPreviewText.setText("*parse exception* [Illegal Argument: " + e.getMessage() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
+                }
 
+            }
         }
     }
 
     private void updatePreviewLine(InputLine line, Matcher matcher, Map<String, 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) {
+            if (i < matcher.groupCount() && matcher.group(i + 1) != null) {
                 if (line.parentInput == null) {
-                    inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
+                    inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i + 1), matcher.end(i + 1) - matcher.start(i + 1),
                             COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
                 } else {
-                    inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
+                    inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i + 1), matcher.end(i + 1) - matcher.start(i + 1),
                             COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
                 }
-                String value = matcher.group(i+1).trim();
-                if (selectedLine != null && selectedLine.inputLine.equals(line) && rootLineMatches == 1) {
-                    if (selectedLine.inputs.get(i).previewText.getText().equals(Messages.CustomTxtParserInputWizardPage_noMatchingLine)) {
-                        selectedLine.inputs.get(i).previewText.setText(value);
-                    }
+                String value = matcher.group(i + 1).trim();
+                if (selectedLine != null && selectedLine.inputLine.equals(line) && rootLineMatches == 1 &&
+                        selectedLine.inputs.get(i).previewText.getText().equals(Messages.CustomTxtParserInputWizardPage_noMatchingLine)) {
+                    selectedLine.inputs.get(i).previewText.setText(value);
                 }
                 if (value.length() == 0) {
                     continue;
@@ -853,12 +937,12 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }
         // highlight the matching groups that have no corresponponding input
         for (int i = line.columns.size(); i < matcher.groupCount(); i++) {
-            if (matcher.group(i+1) != null) {
+            if (matcher.group(i + 1) != null) {
                 if (line.parentInput == null) {
-                    inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
+                    inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i + 1), matcher.end(i + 1) - matcher.start(i + 1),
                             COLOR_BLACK, COLOR_MAGENTA));
                 } else {
-                    inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
+                    inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i + 1), matcher.end(i + 1) - matcher.start(i + 1),
                             COLOR_BLACK, COLOR_LIGHT_MAGENTA));
                 }
             }
@@ -877,33 +961,35 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         helpShell.setLayout(new FillLayout());
         helpBrowser = new Browser(helpShell, SWT.NONE);
         helpBrowser.addTitleListener(new TitleListener() {
-               @Override
-           public void changed(TitleEvent event) {
-               helpShell.setText(event.title);
-           }
+            @Override
+            public void changed(TitleEvent event) {
+                helpShell.setText(event.title);
+            }
         });
-        helpBrowser.setBounds(0,0,600,400);
-        helpShell.pack();
+        Rectangle r = container.getBounds();
+        Point p = container.toDisplay(r.x, r.y);
+        Rectangle trim = helpShell.computeTrim(p.x + (r.width - 750) / 2, p.y + (r.height - 400) / 2, 750, 400);
+        helpShell.setBounds(trim);
         helpShell.open();
         helpBrowser.setUrl(url);
     }
 
     private void openLegend() {
-        final String CG = Messages.CustomTxtParserInputWizardPage_capturedGroup;
-        final String UCG = Messages.CustomTxtParserInputWizardPage_unidentifiedCaptureGroup;
-        final String UT = Messages.CustomTxtParserInputWizardPage_uncapturedText;
+        final String cg = Messages.CustomTxtParserInputWizardPage_capturedGroup;
+        final String ucg = Messages.CustomTxtParserInputWizardPage_unidentifiedCaptureGroup;
+        final String ut = Messages.CustomTxtParserInputWizardPage_uncapturedText;
         int line1start = 0;
         String line1 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine;
         int line2start = line1start + line1.length();
-        String line2 = Messages.CustomTxtParserInputWizardPage_matchingLineRoot + CG + " " + UCG + " " + UT + " \n";  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        String line2 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + ' ' + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
         int line3start = line2start + line2.length();
-        String line3 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + CG + " " + UCG + " " + UT + " \n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        String line3 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + ' '  + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
         int line4start = line3start + line3.length();
-        String line4 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + CG + " " + UCG + " " + UT + " \n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        String line4 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + ' ' + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
         int line5start = line4start + line4.length();
         String line5 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine;
         int line6start = line5start + line5.length();
-        String line6 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + CG + " " + UCG + " " + UT + " \n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        String line6 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
 
         final Shell legendShell = new Shell(getShell(), SWT.DIALOG_TRIM);
         legendShell.setLayout(new FillLayout());
@@ -914,14 +1000,14 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         legendText.setStyleRange(new StyleRange(line3start, line3.length(), COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
         legendText.setStyleRange(new StyleRange(line4start, line4.length(), COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
         legendText.setStyleRange(new StyleRange(line6start, line6.length(), COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
-        legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(CG), CG.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
-        legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(UCG), UCG.length(), COLOR_BLACK, COLOR_MAGENTA));
-        legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(CG), CG.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
-        legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(UCG), UCG.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
-        legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(CG), CG.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
-        legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(UCG), UCG.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
-        legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(CG), CG.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
-        legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(UCG), UCG.length(), COLOR_BLACK, COLOR_MAGENTA));
+        legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
+        legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_MAGENTA));
+        legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
+        legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
+        legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
+        legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
+        legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
+        legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_MAGENTA));
         legendShell.setText(Messages.CustomTxtParserInputWizardPage_previewLegend);
         legendShell.pack();
         legendShell.open();
@@ -929,19 +1015,19 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
     private class UpdateListener implements ModifyListener, SelectionListener {
 
-       @Override
+        @Override
         public void modifyText(ModifyEvent e) {
             validate();
             updatePreviews();
         }
 
-       @Override
+        @Override
         public void widgetDefaultSelected(SelectionEvent e) {
             validate();
             updatePreviews();
         }
 
-       @Override
+        @Override
         public void widgetSelected(SelectionEvent e) {
             validate();
             updatePreviews();
@@ -951,20 +1037,20 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
     private class Line {
         private static final String INFINITY_STRING = "\u221E"; //$NON-NLS-1$
-        InputLine inputLine;
-        Group group;
-        Composite labelComposite;
-        Text regexText;
-        Composite cardinalityContainer;
-        Combo cardinalityCombo;
-        Label cardinalityMinLabel;
-        Text cardinalityMinText;
-        Label cardinalityMaxLabel;
-        Text cardinalityMaxText;
-        Button infiniteButton;
-        List<InputGroup> inputs = new ArrayList<InputGroup>();
-        Button addGroupButton;
-        Label addGroupLabel;
+        private InputLine inputLine;
+        private Group group;
+        private Composite labelComposite;
+        private Text regexText;
+        private Composite cardinalityContainer;
+        private Combo cardinalityCombo;
+        private Label cardinalityMinLabel;
+        private Text cardinalityMinText;
+        private Label cardinalityMaxLabel;
+        private Text cardinalityMaxText;
+        private Button infiniteButton;
+        private List<InputGroup> inputs = new ArrayList<>();
+        private Button addGroupButton;
+        private Label addGroupLabel;
 
         public Line(Composite parent, String name, InputLine inputLine) {
             this.inputLine = inputLine;
@@ -999,11 +1085,11 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             regexText.addModifyListener(updateListener);
 
             Button regexHelpButton = new Button(regexContainer, SWT.PUSH);
-            regexHelpButton.setImage(helpImage);
+            regexHelpButton.setImage(HELP_IMAGE);
             regexHelpButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_regularExpressionHelp);
             regexHelpButton.addSelectionListener(new SelectionAdapter() {
-               @Override
-               public void widgetSelected(SelectionEvent e) {
+                @Override
+                public void widgetSelected(SelectionEvent e) {
                     openHelpShell(PATTERN_URL);
                 }
             });
@@ -1024,15 +1110,16 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     Cardinality.ZERO_OR_MORE.toString(),
                     Cardinality.ONE_OR_MORE.toString(),
                     Cardinality.ZERO_OR_ONE.toString(),
-                    Cardinality.ONE.toString(),
-                    "(?,?)"}); //$NON-NLS-1$
-            cardinalityCombo.addSelectionListener(new SelectionListener(){
-               @Override
-                public void widgetDefaultSelected(SelectionEvent e) {}
-               @Override
+                    Cardinality.ONE.toString(), "(?,?)" }); //$NON-NLS-1$
+            cardinalityCombo.addSelectionListener(new SelectionListener() {
+                @Override
+                public void widgetDefaultSelected(SelectionEvent e) {
+                }
+
+                @Override
                 public void widgetSelected(SelectionEvent e) {
                     switch (cardinalityCombo.getSelectionIndex()) {
-                    case 4: //(?,?)
+                    case 4: // (?,?)
                         cardinalityMinLabel.setVisible(true);
                         cardinalityMinText.setVisible(true);
                         cardinalityMaxLabel.setVisible(true);
@@ -1050,7 +1137,8 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     cardinalityContainer.layout();
                     validate();
                     updatePreviews();
-                }});
+                }
+            });
 
             cardinalityMinLabel = new Label(cardinalityContainer, SWT.NONE);
             cardinalityMinLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
@@ -1077,11 +1165,12 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             infiniteButton = new Button(cardinalityContainer, SWT.PUSH);
             infiniteButton.setText(INFINITY_STRING);
             infiniteButton.setVisible(false);
-            infiniteButton.addSelectionListener(new SelectionAdapter(){
+            infiniteButton.addSelectionListener(new SelectionAdapter() {
                 @Override
                 public void widgetSelected(SelectionEvent e) {
                     cardinalityMaxText.setText(INFINITY_STRING);
-                }});
+                }
+            });
 
             if (inputLine.cardinality.equals(Cardinality.ZERO_OR_MORE)) {
                 cardinalityCombo.select(0);
@@ -1109,7 +1198,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }
 
             VerifyListener digitsListener = new VerifyListener() {
-               @Override
+                @Override
                 public void verifyText(VerifyEvent e) {
                     if (e.text.equals(INFINITY_STRING)) {
                         e.doit = e.widget == cardinalityMaxText && e.start == 0 && e.end == ((Text) e.widget).getText().length();
@@ -1124,7 +1213,8 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                             }
                         }
                     }
-                }};
+                }
+            };
 
             cardinalityMinText.addModifyListener(updateListener);
             cardinalityMaxText.addModifyListener(updateListener);
@@ -1133,7 +1223,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
             if (inputLine.columns != null) {
                 for (InputData inputData : inputLine.columns) {
-                    InputGroup inputGroup = new InputGroup(group, this, inputs.size()+1);
+                    InputGroup inputGroup = new InputGroup(group, this, inputs.size() + 1);
                     if (inputData.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
                         inputGroup.tagCombo.select(0);
                         inputGroup.tagText.setText(inputData.format);
@@ -1162,16 +1252,16 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         private void createAddGroupButton() {
             addGroupButton = new Button(group, SWT.PUSH);
             addGroupButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
-            addGroupButton.setImage(addImage);
+            addGroupButton.setImage(ADD_IMAGE);
             addGroupButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_addGroup);
             addGroupButton.addSelectionListener(new SelectionAdapter() {
-               @Override
+                @Override
                 public void widgetSelected(SelectionEvent e) {
                     removeAddGroupButton();
-                    inputs.add(new InputGroup(group, Line.this, inputs.size()+1));
+                    inputs.add(new InputGroup(group, Line.this, inputs.size() + 1));
                     createAddGroupButton();
                     lineContainer.layout();
-                    lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
+                    lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
                     group.getParent().layout();
                     validate();
                     updatePreviews();
@@ -1188,22 +1278,18 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }
 
         private void removeInput(int inputNumber) {
-            if (--inputNumber < inputs.size()) {
-                inputs.remove(inputNumber).dispose();
-                for (int i = inputNumber; i < inputs.size(); i++) {
-                    inputs.get(i).setInputNumber(i+1);
+            int nb = inputNumber;
+            if (--nb < inputs.size()) {
+                inputs.remove(nb).dispose();
+                for (int i = nb; i < inputs.size(); i++) {
+                    inputs.get(i).setInputNumber(i + 1);
                 }
                 lineContainer.layout();
-                lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
+                lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
                 group.getParent().layout();
             }
         }
 
-//        private void setName(String name) {
-//            this.name = name;
-//            group.setText("Line " + name);
-//        }
-
         private void dispose() {
             group.dispose();
         }
@@ -1223,8 +1309,9 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             case 3:
                 inputLine.cardinality = Cardinality.ONE;
                 break;
-            case 4: //(?,?)
-                int min, max;
+            case 4: // (?,?)
+                int min,
+                max;
                 try {
                     min = Integer.parseInt(cardinalityMinText.getText());
                 } catch (NumberFormatException e) {
@@ -1245,42 +1332,42 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 inputLine.cardinality = Cardinality.ZERO_OR_MORE;
                 break;
             }
-            inputLine.columns = new ArrayList<InputData>(inputs.size());
+            inputLine.columns = new ArrayList<>(inputs.size());
             for (int i = 0; i < inputs.size(); i++) {
-                InputGroup group = inputs.get(i);
+                InputGroup grp = inputs.get(i);
                 InputData inputData = new InputData();
-                if (group.tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {
-                    inputData.name = group.tagText.getText().trim();
+                if (grp.tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {
+                    inputData.name = grp.tagText.getText().trim();
                 } else {
-                    inputData.name = group.tagCombo.getText();
-                    if (group.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
-                        inputData.format = group.tagText.getText().trim();
+                    inputData.name = grp.tagCombo.getText();
+                    if (grp.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
+                        inputData.format = grp.tagText.getText().trim();
                     }
                 }
-                inputData.action = group.actionCombo.getSelectionIndex();
+                inputData.action = grp.actionCombo.getSelectionIndex();
                 inputLine.columns.add(inputData);
             }
         }
     }
 
     private class InputGroup {
-        Line line;
-        int inputNumber;
+        private Line line;
+        private int inputNumber;
 
         // children of parent (must be disposed)
-        Composite labelComposite;
-        Composite tagComposite;
-        Label previewLabel;
-        Text previewText;
+        private Composite labelComposite;
+        private Composite tagComposite;
+        private Label previewLabel;
+        private Text previewText;
 
         // children of labelComposite
-        Label inputLabel;
+        private Label inputLabel;
 
         // children of tagComposite
-        Combo tagCombo;
-        Label tagLabel;
-        Text tagText;
-        Combo actionCombo;
+        private Combo tagCombo;
+        private Label tagLabel;
+        private Text tagText;
+        private Combo actionCombo;
 
         public InputGroup(Composite parent, Line line, int inputNumber) {
             this.line = line;
@@ -1295,10 +1382,10 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
             Button deleteButton = new Button(labelComposite, SWT.PUSH);
             deleteButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
-            deleteButton.setImage(deleteImage);
+            deleteButton.setImage(DELETE_IMAGE);
             deleteButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_removeGroup);
             deleteButton.addSelectionListener(new SelectionAdapter() {
-               @Override
+                @Override
                 public void widgetSelected(SelectionEvent e) {
                     InputGroup.this.line.removeInput(InputGroup.this.inputNumber);
                     validate();
@@ -1308,7 +1395,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
             inputLabel = new Label(labelComposite, SWT.NULL);
             inputLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
-            inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$
+            inputLabel.setText(NLS.bind(Messages.CustomTxtParserInputWizardPage_group, inputNumber));
 
             tagComposite = new Composite(parent, SWT.FILL);
             GridLayout tagLayout = new GridLayout(4, false);
@@ -1318,34 +1405,36 @@ 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.setItems(new String[] { CustomTraceDefinition.TAG_TIMESTAMP,
+                    CustomTraceDefinition.TAG_MESSAGE,
+                    CustomTraceDefinition.TAG_OTHER });
             tagCombo.select(1);
-            tagCombo.addSelectionListener(new SelectionListener(){
-               @Override
-                public void widgetDefaultSelected(SelectionEvent e) {}
-               @Override
+            tagCombo.addSelectionListener(new SelectionListener() {
+                @Override
+                public void widgetDefaultSelected(SelectionEvent e) {
+                }
+
+                @Override
                 public void widgetSelected(SelectionEvent e) {
                     tagText.removeModifyListener(updateListener);
                     switch (tagCombo.getSelectionIndex()) {
-                    case 0: //Time Stamp
+                    case 0: // Time Stamp
                         tagLabel.setText(Messages.CustomTxtParserInputWizardPage_format);
                         tagLabel.setVisible(true);
                         tagText.setVisible(true);
                         tagText.addModifyListener(updateListener);
                         break;
-                    case 1: //Message
+                    case 1: // Message
                         tagLabel.setVisible(false);
                         tagText.setVisible(false);
                         break;
-                    case 2: //Other
+                    case 2: // Other
                         tagLabel.setText(Messages.CustomTxtParserInputWizardPage_name);
                         tagLabel.setVisible(true);
                         tagText.setVisible(true);
                         tagText.addModifyListener(updateListener);
                         break;
-                    case 3: //Continue
+                    case 3: // Continue
                         tagLabel.setVisible(false);
                         tagText.setVisible(false);
                         break;
@@ -1355,7 +1444,8 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                     tagComposite.layout();
                     validate();
                     updatePreviews();
-                }});
+                }
+            });
 
             tagLabel = new Label(tagComposite, SWT.NULL);
             tagLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
@@ -1368,7 +1458,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             tagText.setVisible(false);
 
             actionCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
-            actionCombo.setItems(new String[] {Messages.CustomTxtParserInputWizardPage_set, Messages.CustomTxtParserInputWizardPage_append, Messages.CustomTxtParserInputWizardPage_appendWith});
+            actionCombo.setItems(new String[] { Messages.CustomTxtParserInputWizardPage_set, Messages.CustomTxtParserInputWizardPage_append, Messages.CustomTxtParserInputWizardPage_appendWith });
             actionCombo.select(0);
             actionCombo.addSelectionListener(updateListener);
 
@@ -1393,13 +1483,14 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
         private void setInputNumber(int inputNumber) {
             this.inputNumber = inputNumber;
-            inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$
+            inputLabel.setText(NLS.bind(Messages.CustomTxtParserInputWizardPage_group, inputNumber));
             labelComposite.layout();
         }
     }
 
     private void validate() {
 
+        definition.categoryName = categoryText.getText().trim();
         definition.definitionName = logtypeText.getText().trim();
         definition.timeStampOutputFormat = timestampOutputFormatText.getText().trim();
 
@@ -1410,18 +1501,31 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
 
         StringBuffer errors = new StringBuffer();
 
-        if (definition.definitionName.length() == 0) {
-            errors.append("Enter a name for the new log type. "); //$NON-NLS-1$
+        if (definition.categoryName.length() == 0) {
+            errors.append("Enter a category for the new trace type. "); //$NON-NLS-1$
+            categoryText.setBackground(COLOR_LIGHT_RED);
+        } else if (definition.definitionName.length() == 0) {
+            errors.append("Enter a name for the new trace type. "); //$NON-NLS-1$
             logtypeText.setBackground(COLOR_LIGHT_RED);
         } else {
+            categoryText.setBackground(COLOR_TEXT_BACKGROUND);
             logtypeText.setBackground(COLOR_TEXT_BACKGROUND);
-            for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
-                if (definition.definitionName.equals(def.definitionName)) {
-                    if (editDefinitionName == null || ! editDefinitionName.equals(definition.definitionName)) {
-                        errors.append("The log type name already exists. "); //$NON-NLS-1$
-                        logtypeText.setBackground(COLOR_LIGHT_RED);
-                        break;
-                    }
+            if (definition.categoryName.indexOf(':') != -1) {
+                errors.append("Invalid character ':' in category. "); //$NON-NLS-1$
+                categoryText.setBackground(COLOR_LIGHT_RED);
+            }
+            if (definition.definitionName.indexOf(':') != -1) {
+                errors.append("Invalid character ':' in trace type. "); //$NON-NLS-1$
+                logtypeText.setBackground(COLOR_LIGHT_RED);
+            }
+            for (TraceTypeHelper helper : TmfTraceType.getTraceTypeHelpers()) {
+                if (definition.categoryName.equals(helper.getCategoryName()) &&
+                        definition.definitionName.equals(helper.getName()) &&
+                        (editDefinitionName == null || !editDefinitionName.equals(definition.definitionName)) &&
+                        (editCategoryName == null || !editCategoryName.equals(definition.categoryName))) {
+                    errors.append("The trace type name already exists. "); //$NON-NLS-1$
+                    logtypeText.setBackground(COLOR_LIGHT_RED);
+                    break;
                 }
             }
         }
@@ -1430,7 +1534,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         for (int i = 0; i < definition.inputs.size(); i++) {
 
             InputLine inputLine = definition.inputs.get(i);
-            String name = Integer.toString(i+1);
+            String name = Integer.toString(i + 1);
             errors.append(validateLine(inputLine, name));
         }
         if (timestampFound) {
@@ -1439,20 +1543,16 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 timestampOutputFormatText.setBackground(COLOR_LIGHT_RED);
             } else {
                 try {
-                    new SimpleDateFormat(definition.timeStampOutputFormat);
+                    new TmfTimestampFormat(definition.timeStampOutputFormat);
                     timestampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
                 } catch (IllegalArgumentException e) {
-                    errors.append("Enter a valid output format for the Time Stamp field. "); //$NON-NLS-1$
+                    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);
-//            timestampPreviewText.setBackground(COLOR_WIDGET_BACKGROUND);
-//            errors.append("Identify a Time Stamp group (Line "+name+"). ");
-//            timestampPreviewText.setText("*no timestamp group*");
-//            timestampPreviewText.setBackground(COLOR_LIGHT_RED);
         }
 
         if (errors.length() == 0) {
@@ -1464,6 +1564,15 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }
     }
 
+    /**
+     * Validate an input line.
+     *
+     * @param inputLine
+     *            The line to clean up
+     * @param name
+     *            The name of the line
+     * @return The cleaned up line
+     */
     public StringBuffer validateLine(InputLine inputLine, String name) {
         StringBuffer errors = new StringBuffer();
         Line line = null;
@@ -1476,13 +1585,13 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
                 line.regexText.setBackground(COLOR_TEXT_BACKGROUND);
             }
         } catch (PatternSyntaxException e) {
-            errors.append("Enter a valid regular expression (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
+            errors.append("Enter a valid regular expression (Line " + name + "). "); //$NON-NLS-1$ //$NON-NLS-2$
             if (line != null) {
                 line.regexText.setBackground(COLOR_LIGHT_RED);
             }
         }
         if (inputLine.getMinCount() == -1) {
-            errors.append("Enter a minimum value for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
+            errors.append("Enter a minimum value for cardinality (Line " + name + "). "); //$NON-NLS-1$ //$NON-NLS-2$
             if (line != null) {
                 line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);
             }
@@ -1492,12 +1601,12 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }
         }
         if (inputLine.getMaxCount() == -1) {
-            errors.append("Enter a maximum value for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
+            errors.append("Enter a maximum value for cardinality (Line " + name + "). "); //$NON-NLS-1$ //$NON-NLS-2$
             if (line != null) {
                 line.cardinalityMaxText.setBackground(COLOR_LIGHT_RED);
             }
         } else if (inputLine.getMinCount() > inputLine.getMaxCount()) {
-            errors.append("Enter correct (min <= max) values for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
+            errors.append("Enter correct (min <= max) values for cardinality (Line " + name + "). "); //$NON-NLS-1$ //$NON-NLS-2$
             if (line != null) {
                 line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);
             }
@@ -1518,25 +1627,25 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             if (inputData.name.equals(CustomTraceDefinition.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$
+                    errors.append("Enter the input format for the Time Stamp (Line " + name + " Group " + (i + 1) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                     if (group != null) {
                         group.tagText.setBackground(COLOR_LIGHT_RED);
                     }
                 } else {
                     try {
-                        new SimpleDateFormat(inputData.format);
+                        new TmfTimestampFormat(inputData.format);
                         if (group != null) {
                             group.tagText.setBackground(COLOR_TEXT_BACKGROUND);
                         }
                     } catch (IllegalArgumentException e) {
-                        errors.append("Enter a valid input format for the Time Stamp (Line "+name+" Group "+(i+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+                        errors.append("Enter a valid input format for the Time Stamp (Line " + name + " Group " + (i + 1) + ") [" + e.getMessage() + "]. "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
                         if (group != null) {
                             group.tagText.setBackground(COLOR_LIGHT_RED);
                         }
                     }
                 }
             } 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$
+                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);
                 }
@@ -1547,15 +1656,25 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
             }
         }
         for (int i = 0; inputLine.childrenInputs != null && i < inputLine.childrenInputs.size(); i++) {
-            errors.append(validateLine(inputLine.childrenInputs.get(i), name+"."+(i+1))); //$NON-NLS-1$
+            errors.append(validateLine(inputLine.childrenInputs.get(i), name + "." + (i + 1))); //$NON-NLS-1$
         }
         return errors;
     }
 
+    /**
+     * Get the trace definition.
+     *
+     * @return The trace definition
+     */
     public CustomTxtTraceDefinition getDefinition() {
         return definition;
     }
 
+    /**
+     * Get the raw text of the input.
+     *
+     * @return The raw input text
+     */
     public char[] getInputText() {
         return inputText.getText().toCharArray();
     }
This page took 0.049108 seconds and 5 git commands to generate.