1 /*******************************************************************************
2 * Copyright (c) 2010, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.wizards
;
15 import java
.io
.BufferedReader
;
16 import java
.io
.IOException
;
17 import java
.io
.InputStreamReader
;
19 import java
.text
.ParseException
;
20 import java
.util
.ArrayList
;
21 import java
.util
.Arrays
;
22 import java
.util
.HashMap
;
23 import java
.util
.Iterator
;
24 import java
.util
.List
;
26 import java
.util
.Scanner
;
27 import java
.util
.regex
.Matcher
;
28 import java
.util
.regex
.Pattern
;
29 import java
.util
.regex
.PatternSyntaxException
;
31 import org
.eclipse
.core
.resources
.IFile
;
32 import org
.eclipse
.core
.runtime
.CoreException
;
33 import org
.eclipse
.core
.runtime
.FileLocator
;
34 import org
.eclipse
.core
.runtime
.IPath
;
35 import org
.eclipse
.core
.runtime
.Path
;
36 import org
.eclipse
.core
.runtime
.Platform
;
37 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
38 import org
.eclipse
.jface
.viewers
.ISelection
;
39 import org
.eclipse
.jface
.viewers
.ISelectionChangedListener
;
40 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
41 import org
.eclipse
.jface
.viewers
.ITreeContentProvider
;
42 import org
.eclipse
.jface
.viewers
.SelectionChangedEvent
;
43 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
44 import org
.eclipse
.jface
.viewers
.TreeViewer
;
45 import org
.eclipse
.jface
.viewers
.Viewer
;
46 import org
.eclipse
.jface
.wizard
.WizardPage
;
47 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Activator
;
48 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Messages
;
49 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomTraceDefinition
;
50 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomTxtTraceDefinition
;
51 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomTxtTraceDefinition
.Cardinality
;
52 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomTxtTraceDefinition
.InputData
;
53 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomTxtTraceDefinition
.InputLine
;
54 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.TmfTimestampFormat
;
55 import org
.eclipse
.swt
.SWT
;
56 import org
.eclipse
.swt
.browser
.Browser
;
57 import org
.eclipse
.swt
.browser
.TitleEvent
;
58 import org
.eclipse
.swt
.browser
.TitleListener
;
59 import org
.eclipse
.swt
.custom
.SashForm
;
60 import org
.eclipse
.swt
.custom
.ScrolledComposite
;
61 import org
.eclipse
.swt
.custom
.StyleRange
;
62 import org
.eclipse
.swt
.custom
.StyledText
;
63 import org
.eclipse
.swt
.events
.ModifyEvent
;
64 import org
.eclipse
.swt
.events
.ModifyListener
;
65 import org
.eclipse
.swt
.events
.SelectionAdapter
;
66 import org
.eclipse
.swt
.events
.SelectionEvent
;
67 import org
.eclipse
.swt
.events
.SelectionListener
;
68 import org
.eclipse
.swt
.events
.VerifyEvent
;
69 import org
.eclipse
.swt
.events
.VerifyListener
;
70 import org
.eclipse
.swt
.graphics
.Color
;
71 import org
.eclipse
.swt
.graphics
.Font
;
72 import org
.eclipse
.swt
.graphics
.FontData
;
73 import org
.eclipse
.swt
.graphics
.Image
;
74 import org
.eclipse
.swt
.graphics
.Point
;
75 import org
.eclipse
.swt
.graphics
.Rectangle
;
76 import org
.eclipse
.swt
.layout
.FillLayout
;
77 import org
.eclipse
.swt
.layout
.GridData
;
78 import org
.eclipse
.swt
.layout
.GridLayout
;
79 import org
.eclipse
.swt
.widgets
.Button
;
80 import org
.eclipse
.swt
.widgets
.Combo
;
81 import org
.eclipse
.swt
.widgets
.Composite
;
82 import org
.eclipse
.swt
.widgets
.Display
;
83 import org
.eclipse
.swt
.widgets
.Group
;
84 import org
.eclipse
.swt
.widgets
.Label
;
85 import org
.eclipse
.swt
.widgets
.Shell
;
86 import org
.eclipse
.swt
.widgets
.Text
;
87 import org
.osgi
.framework
.Bundle
;
90 * Input wizard page for custom text parsers.
92 * @author Patrick Tasse
94 public class CustomTxtParserInputWizardPage
extends WizardPage
{
96 private static final String DEFAULT_REGEX
= "\\s*(.*\\S)"; //$NON-NLS-1$
97 private static final String DEFAULT_TIMESTAMP_FORMAT
= "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
98 private static final String TIMESTAMP_FORMAT_BUNDLE
= "org.eclipse.linuxtools.lttng.help"; //$NON-NLS-1$
99 private static final String TIMESTAMP_FORMAT_PATH
= "reference/api/org/eclipse/linuxtools/tmf/core/timestamp/TmfTimestampFormat.html"; //$NON-NLS-1$
100 private static final String PATTERN_URL
= "http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#sum"; //$NON-NLS-1$
101 private static final Image LINE_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/line_icon.gif"); //$NON-NLS-1$
102 private static final Image ADD_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/add_button.gif"); //$NON-NLS-1$
103 private static final Image ADD_NEXT_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/addnext_button.gif"); //$NON-NLS-1$
104 private static final Image ADD_CHILD_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/addchild_button.gif"); //$NON-NLS-1$
105 private static final Image DELETE_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/delete_button.gif"); //$NON-NLS-1$
106 private static final Image MOVE_UP_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/moveup_button.gif"); //$NON-NLS-1$
107 private static final Image MOVE_DOWN_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/movedown_button.gif"); //$NON-NLS-1$
108 private static final Image HELP_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/help_button.gif"); //$NON-NLS-1$
109 private static final Color COLOR_BLACK
= Display
.getDefault().getSystemColor(SWT
.COLOR_BLACK
);
110 private static final Color COLOR_LIGHT_GREEN
= new Color(Display
.getDefault(), 192, 255, 192);
111 private static final Color COLOR_GREEN
= Display
.getDefault().getSystemColor(SWT
.COLOR_GREEN
);
112 private static final Color COLOR_LIGHT_YELLOW
= new Color(Display
.getDefault(), 255, 255, 192);
113 private static final Color COLOR_YELLOW
= Display
.getDefault().getSystemColor(SWT
.COLOR_YELLOW
);
114 private static final Color COLOR_LIGHT_MAGENTA
= new Color(Display
.getDefault(), 255, 192, 255);
115 private static final Color COLOR_MAGENTA
= Display
.getDefault().getSystemColor(SWT
.COLOR_MAGENTA
);
116 private static final Color COLOR_LIGHT_RED
= new Color(Display
.getDefault(), 255, 192, 192);
117 private static final Color COLOR_TEXT_BACKGROUND
= Display
.getDefault().getSystemColor(SWT
.COLOR_WHITE
);
118 private static final Color COLOR_WIDGET_BACKGROUND
= Display
.getDefault().getSystemColor(SWT
.COLOR_WIDGET_BACKGROUND
);
120 private final ISelection selection
;
121 private CustomTxtTraceDefinition definition
;
122 private String editDefinitionName
;
123 private String defaultDescription
;
124 private Line selectedLine
;
125 private Composite container
;
126 private Text logtypeText
;
127 private Text timestampOutputFormatText
;
128 private Text timestampPreviewText
;
129 private ScrolledComposite lineScrolledComposite
;
130 private TreeViewer treeViewer
;
131 private Composite lineContainer
;
132 private StyledText inputText
;
133 private Font fixedFont
;
134 private UpdateListener updateListener
;
135 private Browser helpBrowser
;
137 // variables used recursively through line traversal
138 private String timeStampFormat
;
139 private boolean timestampFound
;
145 * The Selection object
147 * The trace definition
149 protected CustomTxtParserInputWizardPage(ISelection selection
,
150 CustomTxtTraceDefinition definition
) {
151 super("CustomParserWizardPage"); //$NON-NLS-1$
152 if (definition
== null) {
153 setTitle(Messages
.CustomTxtParserInputWizardPage_windowTitleNew
);
154 defaultDescription
= Messages
.CustomTxtParserInputWizardPage_descriptionNew
;
156 setTitle(Messages
.CustomTxtParserInputWizardPage_windowTitleEdit
);
157 defaultDescription
= Messages
.CustomTxtParserInputWizardPage_desccriptionEdit
;
159 setDescription(defaultDescription
);
160 this.selection
= selection
;
161 this.definition
= definition
;
162 if (definition
!= null) {
163 this.editDefinitionName
= definition
.definitionName
;
168 public void createControl(Composite parent
) {
169 container
= new Composite(parent
, SWT
.NULL
);
170 container
.setLayout(new GridLayout());
172 updateListener
= new UpdateListener();
174 Composite headerComposite
= new Composite(container
, SWT
.FILL
);
175 GridLayout headerLayout
= new GridLayout(5, false);
176 headerLayout
.marginHeight
= 0;
177 headerLayout
.marginWidth
= 0;
178 headerComposite
.setLayout(headerLayout
);
179 headerComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
181 Label logtypeLabel
= new Label(headerComposite
, SWT
.NULL
);
182 logtypeLabel
.setText(Messages
.CustomTxtParserInputWizardPage_logType
);
184 logtypeText
= new Text(headerComposite
, SWT
.BORDER
| SWT
.SINGLE
);
185 logtypeText
.setLayoutData(new GridData(120, SWT
.DEFAULT
));
187 Label timestampFormatLabel
= new Label(headerComposite
, SWT
.NULL
);
188 timestampFormatLabel
.setText(Messages
.CustomTxtParserInputWizardPage_timestampFormat
);
190 timestampOutputFormatText
= new Text(headerComposite
, SWT
.BORDER
| SWT
.SINGLE
);
191 timestampOutputFormatText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
192 timestampOutputFormatText
.setText(DEFAULT_TIMESTAMP_FORMAT
);
194 Button timeStampFormatHelpButton
= new Button(headerComposite
, SWT
.PUSH
);
195 timeStampFormatHelpButton
.setImage(HELP_IMAGE
);
196 timeStampFormatHelpButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_timestampFormatHelp
);
197 timeStampFormatHelpButton
.addSelectionListener(new SelectionAdapter() {
199 public void widgetSelected(SelectionEvent e
) {
200 Bundle plugin
= Platform
.getBundle(TIMESTAMP_FORMAT_BUNDLE
);
201 IPath path
= new Path(TIMESTAMP_FORMAT_PATH
);
202 URL fileURL
= FileLocator
.find(plugin
, path
, null);
204 URL pageURL
= FileLocator
.toFileURL(fileURL
);
205 openHelpShell(pageURL
.toString());
206 } catch (IOException e1
) {
211 Label timestampPreviewLabel
= new Label(headerComposite
, SWT
.NULL
);
212 timestampPreviewLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 3, 1));
213 timestampPreviewLabel
.setText(Messages
.CustomTxtParserInputWizardPage_preview
);
215 timestampPreviewText
= new Text(headerComposite
, SWT
.BORDER
| SWT
.SINGLE
| SWT
.READ_ONLY
);
216 timestampPreviewText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 2, 1));
217 timestampPreviewText
.setText(Messages
.CustomTxtParserInputWizardPage_noMatchingTimestamp
);
219 Composite buttonBar
= new Composite(container
, SWT
.NONE
);
220 GridLayout buttonBarLayout
= new GridLayout(5, false);
221 buttonBarLayout
.marginHeight
= 0;
222 buttonBarLayout
.marginWidth
= 0;
223 buttonBar
.setLayout(buttonBarLayout
);
225 Button removeButton
= new Button(buttonBar
, SWT
.PUSH
);
226 removeButton
.setImage(DELETE_IMAGE
);
227 removeButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_removeLine
);
228 removeButton
.addSelectionListener(new SelectionAdapter() {
230 public void widgetSelected(SelectionEvent e
) {
231 if (treeViewer
.getSelection().isEmpty() || selectedLine
== null) {
235 InputLine inputLine
= (InputLine
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
236 if (inputLine
.parentInput
== null) {
237 definition
.inputs
.remove(inputLine
);
239 inputLine
.parentInput
.childrenInputs
.remove(inputLine
);
241 treeViewer
.refresh();
246 Button addNextButton
= new Button(buttonBar
, SWT
.PUSH
);
247 addNextButton
.setImage(ADD_NEXT_IMAGE
);
248 addNextButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_addNextLine
);
249 addNextButton
.addSelectionListener(new SelectionAdapter() {
251 public void widgetSelected(SelectionEvent e
) {
252 InputLine inputLine
= new InputLine(Cardinality
.ZERO_OR_MORE
, "", null); //$NON-NLS-1$
253 if (((List
<?
>) treeViewer
.getInput()).size() == 0) {
254 definition
.inputs
.add(inputLine
);
255 } else if (treeViewer
.getSelection().isEmpty()) {
258 InputLine previousInputLine
= (InputLine
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
259 if (previousInputLine
.parentInput
== null) {
260 for (int i
= 0; i
< definition
.inputs
.size(); i
++) {
261 if (definition
.inputs
.get(i
).equals(previousInputLine
)) {
262 definition
.inputs
.add(i
+ 1, inputLine
);
266 previousInputLine
.addNext(inputLine
);
269 treeViewer
.refresh();
270 treeViewer
.setSelection(new StructuredSelection(inputLine
), true);
273 Button addChildButton
= new Button(buttonBar
, SWT
.PUSH
);
274 addChildButton
.setImage(ADD_CHILD_IMAGE
);
275 addChildButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_addChildLine
);
276 addChildButton
.addSelectionListener(new SelectionAdapter() {
278 public void widgetSelected(SelectionEvent e
) {
279 InputLine inputLine
= new InputLine(Cardinality
.ZERO_OR_MORE
, "", null); //$NON-NLS-1$
280 if (((List
<?
>) treeViewer
.getInput()).size() == 0) {
281 definition
.inputs
.add(inputLine
);
282 } else if (treeViewer
.getSelection().isEmpty()) {
285 InputLine parentInputLine
= (InputLine
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
286 parentInputLine
.addChild(inputLine
);
288 treeViewer
.refresh();
289 treeViewer
.setSelection(new StructuredSelection(inputLine
), true);
292 Button moveUpButton
= new Button(buttonBar
, SWT
.PUSH
);
293 moveUpButton
.setImage(MOVE_UP_IMAGE
);
294 moveUpButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_moveUp
);
295 moveUpButton
.addSelectionListener(new SelectionAdapter() {
297 public void widgetSelected(SelectionEvent e
) {
298 if (treeViewer
.getSelection().isEmpty()) {
301 InputLine inputLine
= (InputLine
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
302 if (inputLine
.parentInput
== null) {
303 for (int i
= 1; i
< definition
.inputs
.size(); i
++) {
304 if (definition
.inputs
.get(i
).equals(inputLine
)) {
305 definition
.inputs
.add(i
- 1 , definition
.inputs
.remove(i
));
312 treeViewer
.refresh();
317 Button moveDownButton
= new Button(buttonBar
, SWT
.PUSH
);
318 moveDownButton
.setImage(MOVE_DOWN_IMAGE
);
319 moveDownButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_moveDown
);
320 moveDownButton
.addSelectionListener(new SelectionAdapter() {
322 public void widgetSelected(SelectionEvent e
) {
323 if (treeViewer
.getSelection().isEmpty()) {
326 InputLine inputLine
= (InputLine
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
327 if (inputLine
.parentInput
== null) {
328 for (int i
= 0; i
< definition
.inputs
.size() - 1; i
++) {
329 if (definition
.inputs
.get(i
).equals(inputLine
)) {
330 definition
.inputs
.add(i
+ 1 , definition
.inputs
.remove(i
));
335 inputLine
.moveDown();
337 treeViewer
.refresh();
343 SashForm vSash
= new SashForm(container
, SWT
.VERTICAL
);
344 vSash
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
345 vSash
.setBackground(vSash
.getDisplay().getSystemColor(SWT
.COLOR_GRAY
));
347 SashForm hSash
= new SashForm(vSash
, SWT
.HORIZONTAL
);
348 hSash
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
350 ScrolledComposite treeScrolledComposite
= new ScrolledComposite(hSash
, SWT
.V_SCROLL
| SWT
.H_SCROLL
);
351 GridData gd
= new GridData(SWT
.FILL
, SWT
.FILL
, true, true);
354 treeScrolledComposite
.setLayoutData(gd
);
355 Composite treeContainer
= new Composite(treeScrolledComposite
, SWT
.NONE
);
356 treeContainer
.setLayout(new FillLayout());
357 treeScrolledComposite
.setContent(treeContainer
);
358 treeScrolledComposite
.setExpandHorizontal(true);
359 treeScrolledComposite
.setExpandVertical(true);
361 treeViewer
= new TreeViewer(treeContainer
, SWT
.SINGLE
| SWT
.BORDER
);
362 treeViewer
.setContentProvider(new InputLineTreeNodeContentProvider());
363 treeViewer
.setLabelProvider(new InputLineTreeLabelProvider());
364 treeViewer
.addSelectionChangedListener(new InputLineTreeSelectionChangedListener());
365 treeContainer
.layout();
367 treeScrolledComposite
.setMinSize(treeContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
, treeContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
);
369 lineScrolledComposite
= new ScrolledComposite(hSash
, SWT
.V_SCROLL
);
370 lineScrolledComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
371 lineContainer
= new Composite(lineScrolledComposite
, SWT
.NONE
);
372 GridLayout linesLayout
= new GridLayout();
373 linesLayout
.marginHeight
= 1;
374 linesLayout
.marginWidth
= 0;
375 lineContainer
.setLayout(linesLayout
);
376 lineScrolledComposite
.setContent(lineContainer
);
377 lineScrolledComposite
.setExpandHorizontal(true);
378 lineScrolledComposite
.setExpandVertical(true);
380 if (definition
== null) {
381 definition
= new CustomTxtTraceDefinition();
382 definition
.inputs
.add(new InputLine(Cardinality
.ZERO_OR_MORE
, DEFAULT_REGEX
,
383 Arrays
.asList(new InputData(CustomTraceDefinition
.TAG_MESSAGE
, CustomTraceDefinition
.ACTION_SET
))));
385 loadDefinition(definition
);
386 treeViewer
.expandAll();
387 lineContainer
.layout();
389 logtypeText
.addModifyListener(updateListener
);
390 timestampOutputFormatText
.addModifyListener(updateListener
);
392 lineScrolledComposite
.setMinSize(lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
, lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
-1);
394 hSash
.setWeights(new int[] {1, 2});
396 Composite sashBottom
= new Composite(vSash
, SWT
.NONE
);
397 GridLayout sashBottomLayout
= new GridLayout(3, false);
398 sashBottomLayout
.marginHeight
= 0;
399 sashBottomLayout
.marginWidth
= 0;
400 sashBottom
.setLayout(sashBottomLayout
);
402 Label previewLabel
= new Label(sashBottom
, SWT
.NULL
);
403 previewLabel
.setText(Messages
.CustomTxtParserInputWizardPage_previewInput
);
404 previewLabel
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
406 Button highlightAllButton
= new Button(sashBottom
, SWT
.PUSH
);
407 highlightAllButton
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
408 highlightAllButton
.setText(Messages
.CustomTxtParserInputWizardPage_highlightAll
);
409 highlightAllButton
.addSelectionListener(new SelectionAdapter() {
411 public void widgetSelected(SelectionEvent e
) {
412 updatePreviews(true);
416 Button legendButton
= new Button(sashBottom
, SWT
.PUSH
);
417 legendButton
.setImage(HELP_IMAGE
);
418 legendButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_previewLegend
);
419 legendButton
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
420 legendButton
.addSelectionListener(new SelectionAdapter() {
422 public void widgetSelected(SelectionEvent e
) {
427 inputText
= new StyledText(sashBottom
, SWT
.MULTI
| SWT
.V_SCROLL
| SWT
.H_SCROLL
);
428 if (fixedFont
== null) {
429 if (System
.getProperty("os.name").contains("Windows")) { //$NON-NLS-1$ //$NON-NLS-2$
430 fixedFont
= new Font(Display
.getCurrent(), new FontData("Courier New", 10, SWT
.NORMAL
)); //$NON-NLS-1$
432 fixedFont
= new Font(Display
.getCurrent(), new FontData("Monospace", 10, SWT
.NORMAL
)); //$NON-NLS-1$
435 inputText
.setFont(fixedFont
);
436 gd
= new GridData(SWT
.FILL
, SWT
.FILL
, true, true, 3, 1);
437 gd
.heightHint
= inputText
.computeSize(SWT
.DEFAULT
, inputText
.getLineHeight() * 4).y
;
439 inputText
.setLayoutData(gd
);
440 inputText
.setText(getSelectionText());
441 inputText
.addModifyListener(updateListener
);
443 vSash
.setWeights(new int[] {hSash
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
, sashBottom
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
});
445 setControl(container
);
451 private static class InputLineTreeNodeContentProvider
implements ITreeContentProvider
{
454 public Object
[] getElements(Object inputElement
) {
455 return ((List
<?
>) inputElement
).toArray();
459 public Object
[] getChildren(Object parentElement
) {
460 InputLine inputLine
= (InputLine
) parentElement
;
461 if (inputLine
.childrenInputs
== null) {
462 return new InputLine
[0];
464 return inputLine
.childrenInputs
.toArray();
468 public boolean hasChildren(Object element
) {
469 InputLine inputLine
= (InputLine
) element
;
470 return (inputLine
.childrenInputs
!= null && inputLine
.childrenInputs
.size() > 0);
474 public void dispose() {
478 public void inputChanged(Viewer viewer
, Object oldInput
, Object newInput
) {
482 public Object
getParent(Object element
) {
483 InputLine inputLine
= (InputLine
) element
;
484 return inputLine
.parentInput
;
488 private class InputLineTreeLabelProvider
extends ColumnLabelProvider
{
491 public Image
getImage(Object element
) {
496 public String
getText(Object element
) {
497 InputLine inputLine
= (InputLine
) element
;
498 if (inputLine
.parentInput
== null) {
499 return "Root Line " + getName(inputLine
) + " " + inputLine
.cardinality
.toString() + " : " + inputLine
.getRegex(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
501 return "Line " + getName(inputLine
) + " " + inputLine
.cardinality
.toString() + " : " + inputLine
.getRegex(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
505 private class InputLineTreeSelectionChangedListener
implements ISelectionChangedListener
{
507 public void selectionChanged(SelectionChangedEvent event
) {
508 if (selectedLine
!= null) {
509 selectedLine
.dispose();
511 if (!(event
.getSelection().isEmpty()) && event
.getSelection() instanceof IStructuredSelection
) {
512 IStructuredSelection sel
= (IStructuredSelection
) event
.getSelection();
513 InputLine inputLine
= (InputLine
) sel
.getFirstElement();
514 selectedLine
= new Line(lineContainer
, getName(inputLine
), inputLine
);
515 lineContainer
.layout();
516 lineScrolledComposite
.setMinSize(lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
, lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
- 1);
525 public void dispose() {
526 if (fixedFont
!= null) {
533 private void loadDefinition(CustomTxtTraceDefinition def
) {
534 logtypeText
.setText(def
.definitionName
);
535 timestampOutputFormatText
.setText(def
.timeStampOutputFormat
);
536 treeViewer
.setInput(def
.inputs
);
537 if (def
.inputs
.size() > 0) {
538 InputLine inputLine
= def
.inputs
.get(0);
539 treeViewer
.setSelection(new StructuredSelection(inputLine
));
543 private String
getName(InputLine inputLine
) {
544 if (inputLine
.parentInput
== null) {
545 return Integer
.toString(definition
.inputs
.indexOf(inputLine
)+1);
547 return getName(inputLine
.parentInput
) + "." + Integer
.toString(inputLine
.parentInput
.childrenInputs
.indexOf(inputLine
)+1); //$NON-NLS-1$
551 * Get the global list of input names.
553 * @return The list of input names
555 public List
<String
> getInputNames() {
556 List
<String
> inputs
= new ArrayList
<>();
557 for (InputLine inputLine
: definition
.inputs
) {
558 for (String inputName
: getInputNames(inputLine
)) {
559 if (!inputs
.contains(inputName
)) {
560 inputs
.add(inputName
);
568 * Get the list of input names for the given input line.
572 * @return The list of input names
574 public List
<String
> getInputNames(InputLine inputLine
) {
575 List
<String
> inputs
= new ArrayList
<>();
576 if (inputLine
.columns
!= null) {
577 for (InputData inputData
: inputLine
.columns
) {
578 String inputName
= inputData
.name
;
579 if (!inputs
.contains(inputName
)) {
580 inputs
.add(inputName
);
584 if (inputLine
.childrenInputs
!= null) {
585 for (InputLine childInputLine
: inputLine
.childrenInputs
) {
586 for (String inputName
: getInputNames(childInputLine
)) {
587 if (!inputs
.contains(inputName
)) {
588 inputs
.add(inputName
);
596 private void removeLine() {
597 selectedLine
.dispose();
599 lineContainer
.layout();
600 lineScrolledComposite
.setMinSize(lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
, lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
-1);
604 private String
getSelectionText() {
605 if (this.selection
instanceof IStructuredSelection
) {
606 Object sel
= ((IStructuredSelection
) this.selection
).getFirstElement();
607 if (sel
instanceof IFile
) {
608 IFile file
= (IFile
)sel
;
609 BufferedReader reader
= null;
611 reader
= new BufferedReader(new InputStreamReader(file
.getContents()));
612 StringBuilder sb
= new StringBuilder();
614 while ((line
= reader
.readLine()) != null) {
615 sb
.append(line
+ "\n"); //$NON-NLS-1$
617 return sb
.toString();
618 } catch (CoreException e
) {
619 return ""; //$NON-NLS-1$
620 } catch (IOException e
) {
621 return ""; //$NON-NLS-1$
623 if (reader
!= null) {
626 } catch (IOException e
) {
632 return ""; //$NON-NLS-1$
635 private void updatePreviews() {
636 updatePreviews(false);
639 private void updatePreviews(boolean updateAll
) {
640 if (inputText
== null) {
641 // early update during construction
644 inputText
.setStyleRanges(new StyleRange
[] {});
646 try (Scanner scanner
= new Scanner(inputText
.getText());) {
647 scanner
.useDelimiter("\n"); //$NON-NLS-1$
650 // skip starting delimiters
651 String skip
= scanner
.findWithinHorizon("\\A\n+", 0); //$NON-NLS-1$
653 rawPos
+= skip
.length();
656 timeStampFormat
= null;
657 if (selectedLine
!= null) {
658 for (InputGroup input
: selectedLine
.inputs
) {
659 input
.previewText
.setText(Messages
.CustomTxtParserInputWizardPage_noMathcingLine
);
663 Map
<String
, String
> data
= new HashMap
<>();
664 int rootLineMatches
= 0;
665 String firstEntryTimeStamp
= null;
666 String firstEntryTimeStampInputFormat
= null;
668 event
: while (scanner
.hasNext()) {
669 if (rootLineMatches
> 0 && !updateAll
) {
673 log
= scanner
.next();
675 int length
= log
.length();
676 for (InputLine rootInputLine
: definition
.inputs
) {
679 pattern
= rootInputLine
.getPattern();
680 } catch (PatternSyntaxException e
) {
683 Matcher matcher
= pattern
.matcher(log
);
684 if (matcher
.find()) {
686 inputText
.setStyleRange(new StyleRange(rawPos
, length
,
687 COLOR_BLACK
, COLOR_YELLOW
, SWT
.ITALIC
));
688 data
= new HashMap
<>();
689 timeStampFormat
= null;
690 updatePreviewLine(rootInputLine
, matcher
, data
, rawPos
, rootLineMatches
);
691 if (rootLineMatches
== 1) {
692 firstEntryTimeStamp
= data
.get(CustomTraceDefinition
.TAG_TIMESTAMP
);
693 firstEntryTimeStampInputFormat
= timeStampFormat
;
695 HashMap
<InputLine
, Integer
> countMap
= new HashMap
<>();
696 InputLine currentInput
= null;
697 if (rootInputLine
.childrenInputs
!= null && rootInputLine
.childrenInputs
.size() > 0) {
698 currentInput
= rootInputLine
.childrenInputs
.get(0);
699 countMap
.put(currentInput
, 0);
701 rawPos
+= length
+ 1; // +1 for \n
702 while (scanner
.hasNext()) {
703 log
= scanner
.next();
704 length
= log
.length();
705 boolean processed
= false;
706 if (currentInput
== null) {
707 for (InputLine input
: definition
.inputs
) {
708 matcher
= input
.getPattern().matcher(log
);
709 if (matcher
.find()) {
714 if (countMap
.get(currentInput
) >= currentInput
.getMinCount()) {
715 List
<InputLine
> nextInputs
= currentInput
.getNextInputs(countMap
);
716 if (nextInputs
.size() == 0 || nextInputs
.get(nextInputs
.size() - 1).getMinCount() == 0) {
717 for (InputLine input
: definition
.inputs
) {
718 matcher
= input
.getPattern().matcher(log
);
719 if (matcher
.find()) {
724 for (InputLine input
: nextInputs
) {
725 matcher
= input
.getPattern().matcher(log
);
726 if (matcher
.find()) {
727 inputText
.setStyleRange(new StyleRange(rawPos
, length
,
728 COLOR_BLACK
, COLOR_LIGHT_YELLOW
, SWT
.ITALIC
));
729 currentInput
= input
;
730 updatePreviewLine(currentInput
, matcher
, data
, rawPos
, rootLineMatches
);
731 if (countMap
.get(currentInput
) == null) {
732 countMap
.put(currentInput
, 1);
734 countMap
.put(currentInput
, countMap
.get(currentInput
) + 1);
736 Iterator
<InputLine
> iter
= countMap
.keySet().iterator();
737 while (iter
.hasNext()) {
738 InputLine inputLine
= iter
.next();
739 if (inputLine
.level
> currentInput
.level
) {
743 if (currentInput
.childrenInputs
!= null && currentInput
.childrenInputs
.size() > 0) {
744 currentInput
= currentInput
.childrenInputs
.get(0);
745 countMap
.put(currentInput
, 0);
747 if (countMap
.get(currentInput
) >= currentInput
.getMaxCount()) {
748 if (currentInput
.getNextInputs(countMap
).size() > 0) {
749 currentInput
= currentInput
.getNextInputs(countMap
).get(0);
750 if (countMap
.get(currentInput
) == null) {
751 countMap
.put(currentInput
, 0);
753 iter
= countMap
.keySet().iterator();
754 while (iter
.hasNext()) {
755 InputLine inputLine
= iter
.next();
756 if (inputLine
.level
> currentInput
.level
) {
770 if (!processed
&& currentInput
!= null) {
771 matcher
= currentInput
.getPattern().matcher(log
);
772 if (matcher
.find()) {
773 inputText
.setStyleRange(new StyleRange(rawPos
, length
,
774 COLOR_BLACK
, COLOR_LIGHT_YELLOW
, SWT
.ITALIC
));
775 updatePreviewLine(currentInput
, matcher
, data
, rawPos
, rootLineMatches
);
776 countMap
.put(currentInput
, countMap
.get(currentInput
) + 1);
777 if (currentInput
.childrenInputs
!= null && currentInput
.childrenInputs
.size() > 0) {
778 currentInput
= currentInput
.childrenInputs
.get(0);
779 countMap
.put(currentInput
, 0);
781 if (countMap
.get(currentInput
) >= currentInput
.getMaxCount()) {
782 if (currentInput
.getNextInputs(countMap
).size() > 0) {
783 currentInput
= currentInput
.getNextInputs(countMap
).get(0);
784 if (countMap
.get(currentInput
) == null) {
785 countMap
.put(currentInput
, 0);
787 Iterator
<InputLine
> iter
= countMap
.keySet().iterator();
788 while (iter
.hasNext()) {
789 InputLine inputLine
= iter
.next();
790 if (inputLine
.level
> currentInput
.level
) {
802 rawPos
+= length
+ 1; // +1 for \n
808 rawPos
+= length
+ 1; // +1 for \n
812 if (rootLineMatches
== 1) {
813 firstEntryTimeStamp
= data
.get(CustomTraceDefinition
.TAG_TIMESTAMP
);
814 firstEntryTimeStampInputFormat
= timeStampFormat
;
816 if (firstEntryTimeStamp
== null) {
817 timestampPreviewText
.setText(Messages
.CustomTxtParserInputWizardPage_noTimestampGroup
);
818 if (selectedLine
!= null) {
819 for (InputGroup group
: selectedLine
.inputs
) {
820 if (group
.tagCombo
.getText().equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
821 timestampPreviewText
.setText(Messages
.CustomTxtParserInputWizardPage_noMatchingTimestamp
);
828 TmfTimestampFormat timestampFormat
= new TmfTimestampFormat(firstEntryTimeStampInputFormat
);
829 long timestamp
= timestampFormat
.parseValue(firstEntryTimeStamp
);
830 timestampFormat
= new TmfTimestampFormat(timestampOutputFormatText
.getText().trim());
831 timestampPreviewText
.setText(timestampFormat
.format(timestamp
));
832 } catch (ParseException e
) {
833 timestampPreviewText
.setText("*parse exception* [" + firstEntryTimeStamp
+ "] <> [" + firstEntryTimeStampInputFormat
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
834 } catch (IllegalArgumentException e
) {
835 timestampPreviewText
.setText("*parse exception* [Illegal Argument: " + e
.getMessage()+ "]"); //$NON-NLS-1$ //$NON-NLS-2$
842 private void updatePreviewLine(InputLine line
, Matcher matcher
, Map
<String
, String
> data
, int rawPos
, int rootLineMatches
) {
843 for (int i
= 0; i
< line
.columns
.size(); i
++) {
844 InputData input
= line
.columns
.get(i
);
845 if (i
< matcher
.groupCount() && matcher
.group(i
+1) != null) {
846 if (line
.parentInput
== null) {
847 inputText
.setStyleRange(new StyleRange(rawPos
+ matcher
.start(i
+1), matcher
.end(i
+1) - matcher
.start(i
+1),
848 COLOR_BLACK
, COLOR_GREEN
, SWT
.BOLD
));
850 inputText
.setStyleRange(new StyleRange(rawPos
+ matcher
.start(i
+1), matcher
.end(i
+1) - matcher
.start(i
+1),
851 COLOR_BLACK
, COLOR_LIGHT_GREEN
, SWT
.BOLD
));
853 String value
= matcher
.group(i
+1).trim();
854 if (selectedLine
!= null && selectedLine
.inputLine
.equals(line
) && rootLineMatches
== 1 &&
855 selectedLine
.inputs
.get(i
).previewText
.getText().equals(Messages
.CustomTxtParserInputWizardPage_noMatchingLine
)) {
856 selectedLine
.inputs
.get(i
).previewText
.setText(value
);
858 if (value
.length() == 0) {
861 if (input
.action
== CustomTraceDefinition
.ACTION_SET
) {
862 data
.put(input
.name
, value
);
863 if (input
.name
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
864 timeStampFormat
= input
.format
;
866 } else if (input
.action
== CustomTraceDefinition
.ACTION_APPEND
) {
867 String s
= data
.get(input
.name
);
869 data
.put(input
.name
, s
+ value
);
871 data
.put(input
.name
, value
);
873 if (input
.name
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
874 if (timeStampFormat
!= null) {
875 timeStampFormat
+= input
.format
;
877 timeStampFormat
= input
.format
;
880 } else if (input
.action
== CustomTraceDefinition
.ACTION_APPEND_WITH_SEPARATOR
) {
881 String s
= data
.get(input
.name
);
883 data
.put(input
.name
, s
+ " | " + value
); //$NON-NLS-1$
885 data
.put(input
.name
, value
);
887 if (input
.name
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
888 if (timeStampFormat
!= null) {
889 timeStampFormat
+= " | " + input
.format
; //$NON-NLS-1$
891 timeStampFormat
= input
.format
;
896 if (selectedLine
!= null && selectedLine
.inputLine
.equals(line
) && rootLineMatches
== 1) {
897 if (selectedLine
.inputs
.get(i
).previewText
.getText().equals(Messages
.CustomTxtParserInputWizardPage_noMatchingLine
)) {
898 selectedLine
.inputs
.get(i
).previewText
.setText(Messages
.CustomTxtParserInputWizardPage_noMatchingGroup
);
903 // highlight the matching groups that have no corresponponding input
904 for (int i
= line
.columns
.size(); i
< matcher
.groupCount(); i
++) {
905 if (matcher
.group(i
+1) != null) {
906 if (line
.parentInput
== null) {
907 inputText
.setStyleRange(new StyleRange(rawPos
+ matcher
.start(i
+1), matcher
.end(i
+1) - matcher
.start(i
+1),
908 COLOR_BLACK
, COLOR_MAGENTA
));
910 inputText
.setStyleRange(new StyleRange(rawPos
+ matcher
.start(i
+1), matcher
.end(i
+1) - matcher
.start(i
+1),
911 COLOR_BLACK
, COLOR_LIGHT_MAGENTA
));
917 private void openHelpShell(String url
) {
918 if (helpBrowser
!= null && !helpBrowser
.isDisposed()) {
919 helpBrowser
.getShell().setActive();
920 if (!helpBrowser
.getUrl().equals(url
)) {
921 helpBrowser
.setUrl(url
);
925 final Shell helpShell
= new Shell(getShell(), SWT
.SHELL_TRIM
);
926 helpShell
.setLayout(new FillLayout());
927 helpBrowser
= new Browser(helpShell
, SWT
.NONE
);
928 helpBrowser
.addTitleListener(new TitleListener() {
930 public void changed(TitleEvent event
) {
931 helpShell
.setText(event
.title
);
934 Rectangle r
= container
.getBounds();
935 Point p
= container
.toDisplay(r
.x
, r
.y
);
936 Rectangle trim
= helpShell
.computeTrim(p
.x
+ (r
.width
- 750) / 2, p
.y
+ (r
.height
- 400) / 2, 750, 400);
937 helpShell
.setBounds(trim
);
939 helpBrowser
.setUrl(url
);
942 private void openLegend() {
943 final String cg
= Messages
.CustomTxtParserInputWizardPage_capturedGroup
;
944 final String ucg
= Messages
.CustomTxtParserInputWizardPage_unidentifiedCaptureGroup
;
945 final String ut
= Messages
.CustomTxtParserInputWizardPage_uncapturedText
;
947 String line1
= Messages
.CustomTxtParserInputWizardPage_nonMatchingLine
;
948 int line2start
= line1start
+ line1
.length();
949 String line2
= Messages
.CustomTxtParserInputWizardPage_matchingLineRoot
+ cg
+ ' ' + ucg
+ ' ' + ut
+ " \n"; //$NON-NLS-1$
950 int line3start
= line2start
+ line2
.length();
951 String line3
= Messages
.CustomTxtParserInputWizardPage_matchingOtherLine
+ cg
+ ' ' + ucg
+ ' ' + ut
+ " \n"; //$NON-NLS-1$
952 int line4start
= line3start
+ line3
.length();
953 String line4
= Messages
.CustomTxtParserInputWizardPage_matchingOtherLine
+ cg
+ ' ' + ucg
+ ' ' + ut
+ " \n"; //$NON-NLS-1$
954 int line5start
= line4start
+ line4
.length();
955 String line5
= Messages
.CustomTxtParserInputWizardPage_nonMatchingLine
;
956 int line6start
= line5start
+ line5
.length();
957 String line6
= Messages
.CustomTxtParserInputWizardPage_matchingRootLine
+ cg
+ ' ' + ucg
+ ' ' + ut
+ " \n"; //$NON-NLS-1$
959 final Shell legendShell
= new Shell(getShell(), SWT
.DIALOG_TRIM
);
960 legendShell
.setLayout(new FillLayout());
961 StyledText legendText
= new StyledText(legendShell
, SWT
.MULTI
);
962 legendText
.setFont(fixedFont
);
963 legendText
.setText(line1
+ line2
+ line3
+ line4
+ line5
+ line6
);
964 legendText
.setStyleRange(new StyleRange(line2start
, line2
.length(), COLOR_BLACK
, COLOR_YELLOW
, SWT
.ITALIC
));
965 legendText
.setStyleRange(new StyleRange(line3start
, line3
.length(), COLOR_BLACK
, COLOR_LIGHT_YELLOW
, SWT
.ITALIC
));
966 legendText
.setStyleRange(new StyleRange(line4start
, line4
.length(), COLOR_BLACK
, COLOR_LIGHT_YELLOW
, SWT
.ITALIC
));
967 legendText
.setStyleRange(new StyleRange(line6start
, line6
.length(), COLOR_BLACK
, COLOR_YELLOW
, SWT
.ITALIC
));
968 legendText
.setStyleRange(new StyleRange(line2start
+ line2
.indexOf(cg
), cg
.length(), COLOR_BLACK
, COLOR_GREEN
, SWT
.BOLD
));
969 legendText
.setStyleRange(new StyleRange(line2start
+ line2
.indexOf(ucg
), ucg
.length(), COLOR_BLACK
, COLOR_MAGENTA
));
970 legendText
.setStyleRange(new StyleRange(line3start
+ line3
.indexOf(cg
), cg
.length(), COLOR_BLACK
, COLOR_LIGHT_GREEN
, SWT
.BOLD
));
971 legendText
.setStyleRange(new StyleRange(line3start
+ line3
.indexOf(ucg
), ucg
.length(), COLOR_BLACK
, COLOR_LIGHT_MAGENTA
));
972 legendText
.setStyleRange(new StyleRange(line4start
+ line4
.indexOf(cg
), cg
.length(), COLOR_BLACK
, COLOR_LIGHT_GREEN
, SWT
.BOLD
));
973 legendText
.setStyleRange(new StyleRange(line4start
+ line4
.indexOf(ucg
), ucg
.length(), COLOR_BLACK
, COLOR_LIGHT_MAGENTA
));
974 legendText
.setStyleRange(new StyleRange(line6start
+ line6
.indexOf(cg
), cg
.length(), COLOR_BLACK
, COLOR_GREEN
, SWT
.BOLD
));
975 legendText
.setStyleRange(new StyleRange(line6start
+ line6
.indexOf(ucg
), ucg
.length(), COLOR_BLACK
, COLOR_MAGENTA
));
976 legendShell
.setText(Messages
.CustomTxtParserInputWizardPage_previewLegend
);
981 private class UpdateListener
implements ModifyListener
, SelectionListener
{
984 public void modifyText(ModifyEvent e
) {
990 public void widgetDefaultSelected(SelectionEvent e
) {
996 public void widgetSelected(SelectionEvent e
) {
1003 private class Line
{
1004 private static final String INFINITY_STRING
= "\u221E"; //$NON-NLS-1$
1005 private InputLine inputLine
;
1006 private Group group
;
1007 private Composite labelComposite
;
1008 private Text regexText
;
1009 private Composite cardinalityContainer
;
1010 private Combo cardinalityCombo
;
1011 private Label cardinalityMinLabel
;
1012 private Text cardinalityMinText
;
1013 private Label cardinalityMaxLabel
;
1014 private Text cardinalityMaxText
;
1015 private Button infiniteButton
;
1016 private List
<InputGroup
> inputs
= new ArrayList
<>();
1017 private Button addGroupButton
;
1018 private Label addGroupLabel
;
1020 public Line(Composite parent
, String name
, InputLine inputLine
) {
1021 this.inputLine
= inputLine
;
1023 group
= new Group(parent
, SWT
.NONE
);
1024 group
.setText(name
);
1025 group
.setLayout(new GridLayout(2, false));
1026 group
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1028 labelComposite
= new Composite(group
, SWT
.FILL
);
1029 GridLayout labelLayout
= new GridLayout(1, false);
1030 labelLayout
.marginWidth
= 0;
1031 labelLayout
.marginHeight
= 0;
1032 labelComposite
.setLayout(labelLayout
);
1033 labelComposite
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1035 Label label
= new Label(labelComposite
, SWT
.NULL
);
1036 label
.setText(Messages
.CustomTxtParserInputWizardPage_regularExpression
);
1038 Composite regexContainer
= new Composite(group
, SWT
.NONE
);
1039 GridLayout regexLayout
= new GridLayout(2, false);
1040 regexLayout
.marginHeight
= 0;
1041 regexLayout
.marginWidth
= 0;
1042 regexContainer
.setLayout(regexLayout
);
1043 regexContainer
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1045 regexText
= new Text(regexContainer
, SWT
.BORDER
| SWT
.SINGLE
);
1046 GridData gd
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false);
1048 regexText
.setLayoutData(gd
);
1049 regexText
.setText(inputLine
.getRegex());
1050 regexText
.addModifyListener(updateListener
);
1052 Button regexHelpButton
= new Button(regexContainer
, SWT
.PUSH
);
1053 regexHelpButton
.setImage(HELP_IMAGE
);
1054 regexHelpButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_regularExpressionHelp
);
1055 regexHelpButton
.addSelectionListener(new SelectionAdapter() {
1057 public void widgetSelected(SelectionEvent e
) {
1058 openHelpShell(PATTERN_URL
);
1062 label
= new Label(group
, SWT
.NONE
);
1063 label
.setText(Messages
.CustomTxtParserInputWizardPage_cardinality
);
1064 label
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1066 cardinalityContainer
= new Composite(group
, SWT
.NONE
);
1067 GridLayout cardinalityLayout
= new GridLayout(6, false);
1068 cardinalityLayout
.marginHeight
= 0;
1069 cardinalityLayout
.marginWidth
= 0;
1070 cardinalityContainer
.setLayout(cardinalityLayout
);
1071 cardinalityContainer
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1073 cardinalityCombo
= new Combo(cardinalityContainer
, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
1074 cardinalityCombo
.setItems(new String
[] {
1075 Cardinality
.ZERO_OR_MORE
.toString(),
1076 Cardinality
.ONE_OR_MORE
.toString(),
1077 Cardinality
.ZERO_OR_ONE
.toString(),
1078 Cardinality
.ONE
.toString(),
1079 "(?,?)"}); //$NON-NLS-1$
1080 cardinalityCombo
.addSelectionListener(new SelectionListener() {
1082 public void widgetDefaultSelected(SelectionEvent e
) {}
1085 public void widgetSelected(SelectionEvent e
) {
1086 switch (cardinalityCombo
.getSelectionIndex()) {
1088 cardinalityMinLabel
.setVisible(true);
1089 cardinalityMinText
.setVisible(true);
1090 cardinalityMaxLabel
.setVisible(true);
1091 cardinalityMaxText
.setVisible(true);
1092 infiniteButton
.setVisible(true);
1095 cardinalityMinLabel
.setVisible(false);
1096 cardinalityMinText
.setVisible(false);
1097 cardinalityMaxLabel
.setVisible(false);
1098 cardinalityMaxText
.setVisible(false);
1099 infiniteButton
.setVisible(false);
1102 cardinalityContainer
.layout();
1108 cardinalityMinLabel
= new Label(cardinalityContainer
, SWT
.NONE
);
1109 cardinalityMinLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1110 cardinalityMinLabel
.setText(Messages
.CustomTxtParserInputWizardPage_min
);
1111 cardinalityMinLabel
.setVisible(false);
1113 cardinalityMinText
= new Text(cardinalityContainer
, SWT
.BORDER
| SWT
.SINGLE
);
1114 gd
= new GridData(SWT
.CENTER
, SWT
.CENTER
, false, false);
1116 cardinalityMinText
.setLayoutData(gd
);
1117 cardinalityMinText
.setVisible(false);
1119 cardinalityMaxLabel
= new Label(cardinalityContainer
, SWT
.NONE
);
1120 cardinalityMaxLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1121 cardinalityMaxLabel
.setText(Messages
.CustomTxtParserInputWizardPage_max
);
1122 cardinalityMaxLabel
.setVisible(false);
1124 cardinalityMaxText
= new Text(cardinalityContainer
, SWT
.BORDER
| SWT
.SINGLE
);
1125 gd
= new GridData(SWT
.CENTER
, SWT
.CENTER
, false, false);
1127 cardinalityMaxText
.setLayoutData(gd
);
1128 cardinalityMaxText
.setVisible(false);
1130 infiniteButton
= new Button(cardinalityContainer
, SWT
.PUSH
);
1131 infiniteButton
.setText(INFINITY_STRING
);
1132 infiniteButton
.setVisible(false);
1133 infiniteButton
.addSelectionListener(new SelectionAdapter(){
1135 public void widgetSelected(SelectionEvent e
) {
1136 cardinalityMaxText
.setText(INFINITY_STRING
);
1139 if (inputLine
.cardinality
.equals(Cardinality
.ZERO_OR_MORE
)) {
1140 cardinalityCombo
.select(0);
1141 } else if (inputLine
.cardinality
.equals(Cardinality
.ONE_OR_MORE
)) {
1142 cardinalityCombo
.select(1);
1143 } else if (inputLine
.cardinality
.equals(Cardinality
.ZERO_OR_ONE
)) {
1144 cardinalityCombo
.select(2);
1145 } else if (inputLine
.cardinality
.equals(Cardinality
.ONE
)) {
1146 cardinalityCombo
.select(3);
1148 cardinalityCombo
.select(4);
1149 cardinalityMinLabel
.setVisible(true);
1150 cardinalityMinText
.setVisible(true);
1151 if (inputLine
.getMinCount() >= 0) {
1152 cardinalityMinText
.setText(Integer
.toString(inputLine
.getMinCount()));
1154 cardinalityMaxLabel
.setVisible(true);
1155 cardinalityMaxText
.setVisible(true);
1156 if (inputLine
.getMaxCount() == Cardinality
.INF
) {
1157 cardinalityMaxText
.setText(INFINITY_STRING
);
1158 } else if (inputLine
.getMaxCount() >= 0) {
1159 cardinalityMaxText
.setText(Integer
.toString(inputLine
.getMaxCount()));
1161 infiniteButton
.setVisible(true);
1164 VerifyListener digitsListener
= new VerifyListener() {
1166 public void verifyText(VerifyEvent e
) {
1167 if (e
.text
.equals(INFINITY_STRING
)) {
1168 e
.doit
= e
.widget
== cardinalityMaxText
&& e
.start
== 0 && e
.end
== ((Text
) e
.widget
).getText().length();
1170 if (((Text
) e
.widget
).getText().equals(INFINITY_STRING
)) {
1171 e
.doit
= e
.start
== 0 && e
.end
== ((Text
) e
.widget
).getText().length();
1173 for (int i
= 0; i
< e
.text
.length(); i
++) {
1174 if (!Character
.isDigit(e
.text
.charAt(i
))) {
1182 cardinalityMinText
.addModifyListener(updateListener
);
1183 cardinalityMaxText
.addModifyListener(updateListener
);
1184 cardinalityMinText
.addVerifyListener(digitsListener
);
1185 cardinalityMaxText
.addVerifyListener(digitsListener
);
1187 if (inputLine
.columns
!= null) {
1188 for (InputData inputData
: inputLine
.columns
) {
1189 InputGroup inputGroup
= new InputGroup(group
, this, inputs
.size()+1);
1190 if (inputData
.name
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
1191 inputGroup
.tagCombo
.select(0);
1192 inputGroup
.tagText
.setText(inputData
.format
);
1193 inputGroup
.tagLabel
.setText(Messages
.CustomTxtParserInputWizardPage_format
);
1194 inputGroup
.tagLabel
.setVisible(true);
1195 inputGroup
.tagText
.setVisible(true);
1196 inputGroup
.tagText
.addModifyListener(updateListener
);
1197 } else if (inputData
.name
.equals(CustomTraceDefinition
.TAG_MESSAGE
)) {
1198 inputGroup
.tagCombo
.select(1);
1200 inputGroup
.tagCombo
.select(2);
1201 inputGroup
.tagText
.setText(inputData
.name
);
1202 inputGroup
.tagLabel
.setText(Messages
.CustomTxtParserInputWizardPage_name
);
1203 inputGroup
.tagLabel
.setVisible(true);
1204 inputGroup
.tagText
.setVisible(true);
1205 inputGroup
.tagText
.addModifyListener(updateListener
);
1207 inputGroup
.actionCombo
.select(inputData
.action
);
1208 inputs
.add(inputGroup
);
1212 createAddGroupButton();
1215 private void createAddGroupButton() {
1216 addGroupButton
= new Button(group
, SWT
.PUSH
);
1217 addGroupButton
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1218 addGroupButton
.setImage(ADD_IMAGE
);
1219 addGroupButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_addGroup
);
1220 addGroupButton
.addSelectionListener(new SelectionAdapter() {
1222 public void widgetSelected(SelectionEvent e
) {
1223 removeAddGroupButton();
1224 inputs
.add(new InputGroup(group
, Line
.this, inputs
.size()+1));
1225 createAddGroupButton();
1226 lineContainer
.layout();
1227 lineScrolledComposite
.setMinSize(lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
, lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
-1);
1228 group
.getParent().layout();
1234 addGroupLabel
= new Label(group
, SWT
.NULL
);
1235 addGroupLabel
.setText(Messages
.CustomTxtParserInputWizardPage_newGroup
);
1238 private void removeAddGroupButton() {
1239 addGroupButton
.dispose();
1240 addGroupLabel
.dispose();
1243 private void removeInput(int inputNumber
) {
1244 int nb
= inputNumber
;
1245 if (--nb
< inputs
.size()) {
1246 inputs
.remove(nb
).dispose();
1247 for (int i
= nb
; i
< inputs
.size(); i
++) {
1248 inputs
.get(i
).setInputNumber(i
+1);
1250 lineContainer
.layout();
1251 lineScrolledComposite
.setMinSize(lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
, lineContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
-1);
1252 group
.getParent().layout();
1256 private void dispose() {
1260 private void extractInputs() {
1261 inputLine
.setRegex(selectedLine
.regexText
.getText());
1262 switch (cardinalityCombo
.getSelectionIndex()) {
1264 inputLine
.cardinality
= Cardinality
.ZERO_OR_MORE
;
1267 inputLine
.cardinality
= Cardinality
.ONE_OR_MORE
;
1270 inputLine
.cardinality
= Cardinality
.ZERO_OR_ONE
;
1273 inputLine
.cardinality
= Cardinality
.ONE
;
1278 min
= Integer
.parseInt(cardinalityMinText
.getText());
1279 } catch (NumberFormatException e
) {
1283 if (cardinalityMaxText
.getText().equals(INFINITY_STRING
)) {
1284 max
= Cardinality
.INF
;
1286 max
= Integer
.parseInt(cardinalityMaxText
.getText());
1288 } catch (NumberFormatException e
) {
1291 inputLine
.cardinality
= new Cardinality(min
, max
);
1294 inputLine
.cardinality
= Cardinality
.ZERO_OR_MORE
;
1297 inputLine
.columns
= new ArrayList
<>(inputs
.size());
1298 for (int i
= 0; i
< inputs
.size(); i
++) {
1299 InputGroup grp
= inputs
.get(i
);
1300 InputData inputData
= new InputData();
1301 if (grp
.tagCombo
.getText().equals(CustomTraceDefinition
.TAG_OTHER
)) {
1302 inputData
.name
= grp
.tagText
.getText().trim();
1304 inputData
.name
= grp
.tagCombo
.getText();
1305 if (grp
.tagCombo
.getText().equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
1306 inputData
.format
= grp
.tagText
.getText().trim();
1309 inputData
.action
= grp
.actionCombo
.getSelectionIndex();
1310 inputLine
.columns
.add(inputData
);
1315 private class InputGroup
{
1317 private int inputNumber
;
1319 // children of parent (must be disposed)
1320 private Composite labelComposite
;
1321 private Composite tagComposite
;
1322 private Label previewLabel
;
1323 private Text previewText
;
1325 // children of labelComposite
1326 private Label inputLabel
;
1328 // children of tagComposite
1329 private Combo tagCombo
;
1330 private Label tagLabel
;
1331 private Text tagText
;
1332 private Combo actionCombo
;
1334 public InputGroup(Composite parent
, Line line
, int inputNumber
) {
1336 this.inputNumber
= inputNumber
;
1338 labelComposite
= new Composite(parent
, SWT
.FILL
);
1339 GridLayout labelLayout
= new GridLayout(2, false);
1340 labelLayout
.marginWidth
= 0;
1341 labelLayout
.marginHeight
= 0;
1342 labelComposite
.setLayout(labelLayout
);
1343 labelComposite
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1345 Button deleteButton
= new Button(labelComposite
, SWT
.PUSH
);
1346 deleteButton
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1347 deleteButton
.setImage(DELETE_IMAGE
);
1348 deleteButton
.setToolTipText(Messages
.CustomTxtParserInputWizardPage_removeGroup
);
1349 deleteButton
.addSelectionListener(new SelectionAdapter() {
1351 public void widgetSelected(SelectionEvent e
) {
1352 InputGroup
.this.line
.removeInput(InputGroup
.this.inputNumber
);
1358 inputLabel
= new Label(labelComposite
, SWT
.NULL
);
1359 inputLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1360 inputLabel
.setText(Messages
.CustomTxtParserInputWizardPage_group
+ inputNumber
+ ":"); //$NON-NLS-1$
1362 tagComposite
= new Composite(parent
, SWT
.FILL
);
1363 GridLayout tagLayout
= new GridLayout(4, false);
1364 tagLayout
.marginWidth
= 0;
1365 tagLayout
.marginHeight
= 0;
1366 tagComposite
.setLayout(tagLayout
);
1367 tagComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1369 tagCombo
= new Combo(tagComposite
, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
1370 tagCombo
.setItems(new String
[] {CustomTraceDefinition
.TAG_TIMESTAMP
,
1371 CustomTraceDefinition
.TAG_MESSAGE
,
1372 CustomTraceDefinition
.TAG_OTHER
});
1374 tagCombo
.addSelectionListener(new SelectionListener(){
1376 public void widgetDefaultSelected(SelectionEvent e
) {}
1378 public void widgetSelected(SelectionEvent e
) {
1379 tagText
.removeModifyListener(updateListener
);
1380 switch (tagCombo
.getSelectionIndex()) {
1381 case 0: //Time Stamp
1382 tagLabel
.setText(Messages
.CustomTxtParserInputWizardPage_format
);
1383 tagLabel
.setVisible(true);
1384 tagText
.setVisible(true);
1385 tagText
.addModifyListener(updateListener
);
1388 tagLabel
.setVisible(false);
1389 tagText
.setVisible(false);
1392 tagLabel
.setText(Messages
.CustomTxtParserInputWizardPage_name
);
1393 tagLabel
.setVisible(true);
1394 tagText
.setVisible(true);
1395 tagText
.addModifyListener(updateListener
);
1398 tagLabel
.setVisible(false);
1399 tagText
.setVisible(false);
1404 tagComposite
.layout();
1409 tagLabel
= new Label(tagComposite
, SWT
.NULL
);
1410 tagLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1411 tagLabel
.setVisible(false);
1413 tagText
= new Text(tagComposite
, SWT
.BORDER
| SWT
.SINGLE
);
1414 GridData gd
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false);
1416 tagText
.setLayoutData(gd
);
1417 tagText
.setVisible(false);
1419 actionCombo
= new Combo(tagComposite
, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
1420 actionCombo
.setItems(new String
[] {Messages
.CustomTxtParserInputWizardPage_set
, Messages
.CustomTxtParserInputWizardPage_append
, Messages
.CustomTxtParserInputWizardPage_appendWith
});
1421 actionCombo
.select(0);
1422 actionCombo
.addSelectionListener(updateListener
);
1424 previewLabel
= new Label(parent
, SWT
.NULL
);
1425 previewLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1426 previewLabel
.setText(Messages
.CustomTxtParserInputWizardPage_preview
);
1428 previewText
= new Text(parent
, SWT
.BORDER
| SWT
.SINGLE
| SWT
.READ_ONLY
);
1429 gd
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false);
1431 previewText
.setLayoutData(gd
);
1432 previewText
.setText(Messages
.CustomTxtParserInputWizardPage_noMatch
);
1433 previewText
.setBackground(COLOR_WIDGET_BACKGROUND
);
1436 private void dispose() {
1437 labelComposite
.dispose();
1438 tagComposite
.dispose();
1439 previewLabel
.dispose();
1440 previewText
.dispose();
1443 private void setInputNumber(int inputNumber
) {
1444 this.inputNumber
= inputNumber
;
1445 inputLabel
.setText(Messages
.CustomTxtParserInputWizardPage_group
+ inputNumber
+ ":"); //$NON-NLS-1$
1446 labelComposite
.layout();
1450 private void validate() {
1452 definition
.definitionName
= logtypeText
.getText().trim();
1453 definition
.timeStampOutputFormat
= timestampOutputFormatText
.getText().trim();
1455 if (selectedLine
!= null) {
1456 selectedLine
.extractInputs();
1457 treeViewer
.refresh();
1460 StringBuffer errors
= new StringBuffer();
1462 if (definition
.definitionName
.length() == 0) {
1463 errors
.append("Enter a name for the new log type. "); //$NON-NLS-1$
1464 logtypeText
.setBackground(COLOR_LIGHT_RED
);
1466 logtypeText
.setBackground(COLOR_TEXT_BACKGROUND
);
1467 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
1468 if (definition
.definitionName
.equals(def
.definitionName
) &&
1469 (editDefinitionName
== null || !editDefinitionName
.equals(definition
.definitionName
))) {
1470 errors
.append("The log type name already exists. "); //$NON-NLS-1$
1471 logtypeText
.setBackground(COLOR_LIGHT_RED
);
1477 timestampFound
= false;
1478 for (int i
= 0; i
< definition
.inputs
.size(); i
++) {
1480 InputLine inputLine
= definition
.inputs
.get(i
);
1481 String name
= Integer
.toString(i
+1);
1482 errors
.append(validateLine(inputLine
, name
));
1484 if (timestampFound
) {
1485 if (definition
.timeStampOutputFormat
.length() == 0) {
1486 errors
.append("Enter the output format for the Time Stamp field. "); //$NON-NLS-1$
1487 timestampOutputFormatText
.setBackground(COLOR_LIGHT_RED
);
1490 new TmfTimestampFormat(definition
.timeStampOutputFormat
);
1491 timestampOutputFormatText
.setBackground(COLOR_TEXT_BACKGROUND
);
1492 } catch (IllegalArgumentException e
) {
1493 errors
.append("Enter a valid output format for the Time Stamp field [" + e
.getMessage() + "]."); //$NON-NLS-1$ //$NON-NLS-2$
1494 timestampOutputFormatText
.setBackground(COLOR_LIGHT_RED
);
1499 timestampOutputFormatText
.setBackground(COLOR_TEXT_BACKGROUND
);
1502 if (errors
.length() == 0) {
1503 setDescription(defaultDescription
);
1504 setPageComplete(true);
1506 setDescription(errors
.toString());
1507 setPageComplete(false);
1512 * Validate an input line.
1515 * The line to clean up
1517 * The name of the line
1518 * @return The cleaned up line
1520 public StringBuffer
validateLine(InputLine inputLine
, String name
) {
1521 StringBuffer errors
= new StringBuffer();
1523 if (selectedLine
!= null && selectedLine
.inputLine
.equals(inputLine
)) {
1524 line
= selectedLine
;
1527 Pattern
.compile(inputLine
.getRegex());
1529 line
.regexText
.setBackground(COLOR_TEXT_BACKGROUND
);
1531 } catch (PatternSyntaxException e
) {
1532 errors
.append("Enter a valid regular expression (Line "+name
+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1534 line
.regexText
.setBackground(COLOR_LIGHT_RED
);
1537 if (inputLine
.getMinCount() == -1) {
1538 errors
.append("Enter a minimum value for cardinality (Line "+name
+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1540 line
.cardinalityMinText
.setBackground(COLOR_LIGHT_RED
);
1544 line
.cardinalityMinText
.setBackground(COLOR_TEXT_BACKGROUND
);
1547 if (inputLine
.getMaxCount() == -1) {
1548 errors
.append("Enter a maximum value for cardinality (Line "+name
+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1550 line
.cardinalityMaxText
.setBackground(COLOR_LIGHT_RED
);
1552 } else if (inputLine
.getMinCount() > inputLine
.getMaxCount()) {
1553 errors
.append("Enter correct (min <= max) values for cardinality (Line "+name
+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1555 line
.cardinalityMinText
.setBackground(COLOR_LIGHT_RED
);
1558 line
.cardinalityMaxText
.setBackground(COLOR_LIGHT_RED
);
1562 line
.cardinalityMaxText
.setBackground(COLOR_TEXT_BACKGROUND
);
1565 for (int i
= 0; inputLine
.columns
!= null && i
< inputLine
.columns
.size(); i
++) {
1566 InputData inputData
= inputLine
.columns
.get(i
);
1567 InputGroup group
= null;
1569 group
= line
.inputs
.get(i
);
1571 if (inputData
.name
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
1572 timestampFound
= true;
1573 if (inputData
.format
.length() == 0) {
1574 errors
.append("Enter the input format for the Time Stamp (Line "+name
+" Group "+(i
+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1575 if (group
!= null) {
1576 group
.tagText
.setBackground(COLOR_LIGHT_RED
);
1580 new TmfTimestampFormat(inputData
.format
);
1581 if (group
!= null) {
1582 group
.tagText
.setBackground(COLOR_TEXT_BACKGROUND
);
1584 } catch (IllegalArgumentException e
) {
1585 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$
1586 if (group
!= null) {
1587 group
.tagText
.setBackground(COLOR_LIGHT_RED
);
1591 } else if (inputData
.name
.length() == 0) {
1592 errors
.append("Enter a name for the data group (Line "+name
+" Group "+(i
+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1593 if (group
!= null) {
1594 group
.tagText
.setBackground(COLOR_LIGHT_RED
);
1597 if (group
!= null) {
1598 group
.tagText
.setBackground(COLOR_TEXT_BACKGROUND
);
1602 for (int i
= 0; inputLine
.childrenInputs
!= null && i
< inputLine
.childrenInputs
.size(); i
++) {
1603 errors
.append(validateLine(inputLine
.childrenInputs
.get(i
), name
+"."+(i
+1))); //$NON-NLS-1$
1609 * Get the trace definition.
1611 * @return The trace definition
1613 public CustomTxtTraceDefinition
getDefinition() {
1618 * Get the raw text of the input.
1620 * @return The raw input text
1622 public char[] getInputText() {
1623 return inputText
.getText().toCharArray();