1 /*******************************************************************************
2 * Copyright (c) 2010, 2013 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
.ByteArrayInputStream
;
17 import java
.io
.IOException
;
18 import java
.io
.InputStream
;
19 import java
.io
.InputStreamReader
;
20 import java
.text
.ParseException
;
21 import java
.text
.SimpleDateFormat
;
22 import java
.util
.ArrayList
;
23 import java
.util
.Date
;
24 import java
.util
.List
;
26 import javax
.xml
.parsers
.DocumentBuilder
;
27 import javax
.xml
.parsers
.DocumentBuilderFactory
;
28 import javax
.xml
.parsers
.ParserConfigurationException
;
30 import org
.eclipse
.core
.resources
.IFile
;
31 import org
.eclipse
.core
.runtime
.CoreException
;
32 import org
.eclipse
.jface
.viewers
.AbstractTreeViewer
;
33 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
34 import org
.eclipse
.jface
.viewers
.ISelection
;
35 import org
.eclipse
.jface
.viewers
.ISelectionChangedListener
;
36 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
37 import org
.eclipse
.jface
.viewers
.ITreeContentProvider
;
38 import org
.eclipse
.jface
.viewers
.SelectionChangedEvent
;
39 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
40 import org
.eclipse
.jface
.viewers
.TreeViewer
;
41 import org
.eclipse
.jface
.viewers
.Viewer
;
42 import org
.eclipse
.jface
.wizard
.WizardPage
;
43 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Activator
;
44 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Messages
;
45 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomTraceDefinition
;
46 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomXmlTrace
;
47 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomXmlTraceDefinition
;
48 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomXmlTraceDefinition
.InputAttribute
;
49 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomXmlTraceDefinition
.InputElement
;
50 import org
.eclipse
.swt
.SWT
;
51 import org
.eclipse
.swt
.browser
.Browser
;
52 import org
.eclipse
.swt
.browser
.TitleEvent
;
53 import org
.eclipse
.swt
.browser
.TitleListener
;
54 import org
.eclipse
.swt
.custom
.SashForm
;
55 import org
.eclipse
.swt
.custom
.ScrolledComposite
;
56 import org
.eclipse
.swt
.custom
.StyleRange
;
57 import org
.eclipse
.swt
.custom
.StyledText
;
58 import org
.eclipse
.swt
.events
.ModifyEvent
;
59 import org
.eclipse
.swt
.events
.ModifyListener
;
60 import org
.eclipse
.swt
.events
.SelectionAdapter
;
61 import org
.eclipse
.swt
.events
.SelectionEvent
;
62 import org
.eclipse
.swt
.events
.SelectionListener
;
63 import org
.eclipse
.swt
.graphics
.Color
;
64 import org
.eclipse
.swt
.graphics
.Font
;
65 import org
.eclipse
.swt
.graphics
.FontData
;
66 import org
.eclipse
.swt
.graphics
.Image
;
67 import org
.eclipse
.swt
.layout
.FillLayout
;
68 import org
.eclipse
.swt
.layout
.GridData
;
69 import org
.eclipse
.swt
.layout
.GridLayout
;
70 import org
.eclipse
.swt
.widgets
.Button
;
71 import org
.eclipse
.swt
.widgets
.Combo
;
72 import org
.eclipse
.swt
.widgets
.Composite
;
73 import org
.eclipse
.swt
.widgets
.Display
;
74 import org
.eclipse
.swt
.widgets
.Group
;
75 import org
.eclipse
.swt
.widgets
.Label
;
76 import org
.eclipse
.swt
.widgets
.Shell
;
77 import org
.eclipse
.swt
.widgets
.Text
;
78 import org
.w3c
.dom
.Document
;
79 import org
.w3c
.dom
.Element
;
80 import org
.w3c
.dom
.NamedNodeMap
;
81 import org
.w3c
.dom
.Node
;
82 import org
.w3c
.dom
.NodeList
;
83 import org
.xml
.sax
.EntityResolver
;
84 import org
.xml
.sax
.ErrorHandler
;
85 import org
.xml
.sax
.InputSource
;
86 import org
.xml
.sax
.SAXException
;
87 import org
.xml
.sax
.SAXParseException
;
90 * Input wizard page for custom XML trace parsers.
92 * @author Patrick Tasse
94 public class CustomXmlParserInputWizardPage
extends WizardPage
{
96 private static final String DEFAULT_TIMESTAMP_FORMAT
= "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
97 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$
98 private static final Image ELEMENT_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/element_icon.gif"); //$NON-NLS-1$
99 private static final Image ADD_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/add_button.gif"); //$NON-NLS-1$
100 private static final Image ADD_NEXT_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/addnext_button.gif"); //$NON-NLS-1$
101 private static final Image ADD_CHILD_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/addchild_button.gif"); //$NON-NLS-1$
102 private static final Image ADD_MANY_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/addmany_button.gif"); //$NON-NLS-1$
103 private static final Image DELETE_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/delete_button.gif"); //$NON-NLS-1$
104 private static final Image MOVE_UP_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/moveup_button.gif"); //$NON-NLS-1$
105 private static final Image MOVE_DOWN_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/movedown_button.gif"); //$NON-NLS-1$
106 private static final Image HELP_IMAGE
= Activator
.getDefault().getImageFromPath("/icons/elcl16/help_button.gif"); //$NON-NLS-1$
107 private static final Color COLOR_LIGHT_RED
= new Color(Display
.getDefault(), 255, 192, 192);
108 private static final Color COLOR_TEXT_BACKGROUND
= Display
.getDefault().getSystemColor(SWT
.COLOR_WHITE
);
109 private static final Color COLOR_WIDGET_BACKGROUND
= Display
.getDefault().getSystemColor(SWT
.COLOR_WIDGET_BACKGROUND
);
111 private final ISelection selection
;
112 private CustomXmlTraceDefinition definition
;
113 private String editDefinitionName
;
114 private String defaultDescription
;
115 private ElementNode selectedElement
;
116 private Composite container
;
117 private Text logtypeText
;
118 private Text timeStampOutputFormatText
;
119 private Text timeStampPreviewText
;
120 private Button removeButton
;
121 private Button addChildButton
;
122 private Button addNextButton
;
123 private Button moveUpButton
;
124 private Button moveDownButton
;
125 private ScrolledComposite elementScrolledComposite
;
126 private TreeViewer treeViewer
;
127 private Composite elementContainer
;
128 private Text errorText
;
129 private StyledText inputText
;
130 private Font fixedFont
;
131 private UpdateListener updateListener
;
132 private Browser helpBrowser
;
133 private Element documentElement
;
135 // variables used recursively through element traversal
136 private String timeStampValue
;
137 private String timeStampFormat
;
138 private boolean timeStampFound
;
139 private int logEntriesCount
;
140 private boolean logEntryFound
;
150 protected CustomXmlParserInputWizardPage(ISelection selection
, CustomXmlTraceDefinition definition
) {
151 super("CustomXmlParserWizardPage"); //$NON-NLS-1$
152 if (definition
== null) {
153 setTitle(Messages
.CustomXmlParserInputWizardPage_titleNew
);
154 defaultDescription
= Messages
.CustomXmlParserInputWizardPage_descriptionNew
;
156 setTitle(Messages
.CustomXmlParserInputWizardPage_titleEdit
);
157 defaultDescription
= Messages
.CustomXmlParserInputWizardPage_descriptionEdit
;
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
.CustomXmlParserInputWizardPage_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
.CustomXmlParserInputWizardPage_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 dateFormatHelpButton
= new Button(headerComposite
, SWT
.PUSH
);
195 dateFormatHelpButton
.setImage(HELP_IMAGE
);
196 dateFormatHelpButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_dateFormatHelp
);
197 dateFormatHelpButton
.addSelectionListener(new SelectionAdapter() {
199 public void widgetSelected(SelectionEvent e
) {
200 openHelpShell(SIMPLE_DATE_FORMAT_URL
);
204 Label timeStampPreviewLabel
= new Label(headerComposite
, SWT
.NULL
);
205 timeStampPreviewLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 3, 1));
206 timeStampPreviewLabel
.setText(Messages
.CustomXmlParserInputWizardPage_preview
);
208 timeStampPreviewText
= new Text(headerComposite
, SWT
.BORDER
| SWT
.SINGLE
| SWT
.READ_ONLY
);
209 timeStampPreviewText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 2, 1));
210 timeStampPreviewText
.setText("*no time stamp element or attribute*"); //$NON-NLS-1$
214 SashForm vSash
= new SashForm(container
, SWT
.VERTICAL
);
215 vSash
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
216 vSash
.setBackground(vSash
.getDisplay().getSystemColor(SWT
.COLOR_GRAY
));
218 SashForm hSash
= new SashForm(vSash
, SWT
.HORIZONTAL
);
219 hSash
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
221 ScrolledComposite treeScrolledComposite
= new ScrolledComposite(hSash
, SWT
.V_SCROLL
| SWT
.H_SCROLL
);
222 treeScrolledComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
223 Composite treeContainer
= new Composite(treeScrolledComposite
, SWT
.NONE
);
224 treeContainer
.setLayout(new FillLayout());
225 treeScrolledComposite
.setContent(treeContainer
);
226 treeScrolledComposite
.setExpandHorizontal(true);
227 treeScrolledComposite
.setExpandVertical(true);
229 treeViewer
= new TreeViewer(treeContainer
, SWT
.SINGLE
| SWT
.BORDER
);
230 treeViewer
.setContentProvider(new InputElementTreeNodeContentProvider());
231 treeViewer
.setLabelProvider(new InputElementTreeLabelProvider());
232 treeViewer
.addSelectionChangedListener(new InputElementTreeSelectionChangedListener());
233 treeContainer
.layout();
235 treeScrolledComposite
236 .setMinSize(treeContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
, treeContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
);
238 elementScrolledComposite
= new ScrolledComposite(hSash
, SWT
.V_SCROLL
);
239 elementScrolledComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
240 elementContainer
= new Composite(elementScrolledComposite
, SWT
.NONE
);
241 GridLayout gl
= new GridLayout();
244 elementContainer
.setLayout(gl
);
245 elementScrolledComposite
.setContent(elementContainer
);
246 elementScrolledComposite
.setExpandHorizontal(true);
247 elementScrolledComposite
.setExpandVertical(true);
249 if (definition
== null) {
250 definition
= new CustomXmlTraceDefinition();
252 loadDefinition(definition
);
253 treeViewer
.expandAll();
254 elementContainer
.layout();
256 logtypeText
.addModifyListener(updateListener
);
257 timeStampOutputFormatText
.addModifyListener(updateListener
);
259 elementScrolledComposite
.setMinSize(elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
,
260 elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
- 1);
262 hSash
.setWeights(new int[] { 1, 2 });
264 if (definition
.rootInputElement
== null) {
265 removeButton
.setEnabled(false);
266 addChildButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_addDocumentElement
);
267 addNextButton
.setEnabled(false);
268 moveUpButton
.setEnabled(false);
269 moveDownButton
.setEnabled(false);
270 } else { // root is selected
271 addNextButton
.setEnabled(false);
274 Composite sashBottom
= new Composite(vSash
, SWT
.NONE
);
275 GridLayout sashBottomLayout
= new GridLayout(2, false);
276 sashBottomLayout
.marginHeight
= 0;
277 sashBottomLayout
.marginWidth
= 0;
278 sashBottom
.setLayout(sashBottomLayout
);
280 Label previewLabel
= new Label(sashBottom
, SWT
.NULL
);
281 previewLabel
.setText(Messages
.CustomXmlParserInputWizardPage_previewInput
);
283 errorText
= new Text(sashBottom
, SWT
.SINGLE
| SWT
.READ_ONLY
);
284 errorText
.setBackground(COLOR_WIDGET_BACKGROUND
);
285 errorText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
286 errorText
.setVisible(false);
288 inputText
= new StyledText(sashBottom
, SWT
.MULTI
| SWT
.V_SCROLL
| SWT
.H_SCROLL
);
289 if (fixedFont
== null) {
290 if (System
.getProperty("os.name").contains("Windows")) { //$NON-NLS-1$ //$NON-NLS-2$
291 fixedFont
= new Font(Display
.getCurrent(), new FontData("Courier New", 10, SWT
.NORMAL
)); //$NON-NLS-1$
293 fixedFont
= new Font(Display
.getCurrent(), new FontData("Monospace", 10, SWT
.NORMAL
)); //$NON-NLS-1$
296 inputText
.setFont(fixedFont
);
297 GridData gd
= new GridData(SWT
.FILL
, SWT
.FILL
, true, true, 2, 1);
298 gd
.heightHint
= inputText
.computeSize(SWT
.DEFAULT
, inputText
.getLineHeight() * 4).y
;
300 inputText
.setLayoutData(gd
);
301 inputText
.setText(getSelectionText());
302 inputText
.addModifyListener(new ModifyListener() {
304 public void modifyText(ModifyEvent e
) {
305 parseXmlInput(inputText
.getText());
308 inputText
.addModifyListener(updateListener
);
310 vSash
.setWeights(new int[] { hSash
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
, sashBottom
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
});
312 setControl(container
);
315 private void createButtonBar() {
316 Composite buttonBar
= new Composite(container
, SWT
.NONE
);
317 GridLayout buttonBarLayout
= new GridLayout(6, false);
318 buttonBarLayout
.marginHeight
= 0;
319 buttonBarLayout
.marginWidth
= 0;
320 buttonBar
.setLayout(buttonBarLayout
);
322 removeButton
= new Button(buttonBar
, SWT
.PUSH
);
323 removeButton
.setImage(DELETE_IMAGE
);
324 removeButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_removeElement
);
325 removeButton
.addSelectionListener(new SelectionAdapter() {
327 public void widgetSelected(SelectionEvent e
) {
328 if (treeViewer
.getSelection().isEmpty() || selectedElement
== null) {
332 InputElement inputElement
= (InputElement
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
333 if (inputElement
== definition
.rootInputElement
) {
334 definition
.rootInputElement
= null;
336 inputElement
.parentElement
.childElements
.remove(inputElement
);
338 treeViewer
.refresh();
341 removeButton
.setEnabled(false);
342 if (definition
.rootInputElement
== null) {
343 addChildButton
.setEnabled(true);
344 addChildButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_addDocumentEleemnt
);
346 addChildButton
.setEnabled(false);
348 addNextButton
.setEnabled(false);
349 moveUpButton
.setEnabled(false);
350 moveDownButton
.setEnabled(false);
354 addChildButton
= new Button(buttonBar
, SWT
.PUSH
);
355 addChildButton
.setImage(ADD_CHILD_IMAGE
);
356 addChildButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_addChildElement
);
357 addChildButton
.addSelectionListener(new SelectionAdapter() {
359 public void widgetSelected(SelectionEvent e
) {
360 InputElement inputElement
= new InputElement("", false, CustomXmlTraceDefinition
.TAG_IGNORE
, 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$
361 if (definition
.rootInputElement
== null) {
362 definition
.rootInputElement
= inputElement
;
363 inputElement
.elementName
= getChildNameSuggestion(null);
364 } else if (treeViewer
.getSelection().isEmpty()) {
367 InputElement parentInputElement
= (InputElement
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
368 parentInputElement
.addChild(inputElement
);
369 inputElement
.elementName
= getChildNameSuggestion(parentInputElement
);
371 treeViewer
.refresh();
372 treeViewer
.setSelection(new StructuredSelection(inputElement
), true);
376 addNextButton
= new Button(buttonBar
, SWT
.PUSH
);
377 addNextButton
.setImage(ADD_NEXT_IMAGE
);
378 addNextButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_addNextElement
);
379 addNextButton
.addSelectionListener(new SelectionAdapter() {
381 public void widgetSelected(SelectionEvent e
) {
382 InputElement inputElement
= new InputElement("", false, CustomXmlTraceDefinition
.TAG_IGNORE
, 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$
383 if (definition
.rootInputElement
== null) {
384 definition
.rootInputElement
= inputElement
;
385 inputElement
.elementName
= getChildNameSuggestion(null);
386 } else if (treeViewer
.getSelection().isEmpty()) {
389 InputElement previousInputElement
= (InputElement
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
390 if (previousInputElement
== definition
.rootInputElement
) {
393 previousInputElement
.addNext(inputElement
);
394 inputElement
.elementName
= getChildNameSuggestion(inputElement
.parentElement
);
396 treeViewer
.refresh();
397 treeViewer
.setSelection(new StructuredSelection(inputElement
), true);
401 Button feelingLuckyButton
= new Button(buttonBar
, SWT
.PUSH
);
402 feelingLuckyButton
.setImage(ADD_MANY_IMAGE
);
403 feelingLuckyButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_feelingLucky
);
404 feelingLuckyButton
.addSelectionListener(new SelectionAdapter() {
406 public void widgetSelected(SelectionEvent e
) {
407 InputElement inputElement
= null;
408 if (definition
.rootInputElement
== null) {
409 if (getChildNameSuggestion(null).length() != 0) {
410 inputElement
= new InputElement(getChildNameSuggestion(null), false, CustomXmlTraceDefinition
.TAG_IGNORE
, 0, "", null); //$NON-NLS-1$
411 definition
.rootInputElement
= inputElement
;
412 feelingLucky(inputElement
);
416 } else if (treeViewer
.getSelection().isEmpty()) {
419 inputElement
= (InputElement
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
420 feelingLucky(inputElement
);
422 treeViewer
.refresh();
423 treeViewer
.setSelection(new StructuredSelection(inputElement
), true);
424 treeViewer
.expandToLevel(inputElement
, AbstractTreeViewer
.ALL_LEVELS
);
428 moveUpButton
= new Button(buttonBar
, SWT
.PUSH
);
429 moveUpButton
.setImage(MOVE_UP_IMAGE
);
430 moveUpButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_moveUp
);
431 moveUpButton
.addSelectionListener(new SelectionAdapter() {
433 public void widgetSelected(SelectionEvent e
) {
434 if (treeViewer
.getSelection().isEmpty()) {
437 InputElement inputElement
= (InputElement
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
438 if (inputElement
== definition
.rootInputElement
) {
441 inputElement
.moveUp();
442 treeViewer
.refresh();
448 moveDownButton
= new Button(buttonBar
, SWT
.PUSH
);
449 moveDownButton
.setImage(MOVE_DOWN_IMAGE
);
450 moveDownButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_moveDown
);
451 moveDownButton
.addSelectionListener(new SelectionAdapter() {
453 public void widgetSelected(SelectionEvent e
) {
454 if (treeViewer
.getSelection().isEmpty()) {
457 InputElement inputElement
= (InputElement
) ((IStructuredSelection
) treeViewer
.getSelection()).getFirstElement();
458 if (inputElement
== definition
.rootInputElement
) {
461 inputElement
.moveDown();
462 treeViewer
.refresh();
469 private void feelingLucky(InputElement inputElement
) {
471 String attributeName
= getAttributeNameSuggestion(inputElement
);
472 if (attributeName
.length() == 0) {
475 InputAttribute attribute
= new InputAttribute(attributeName
, attributeName
, 0, ""); //$NON-NLS-1$
476 inputElement
.addAttribute(attribute
);
479 String childName
= getChildNameSuggestion(inputElement
);
480 if (childName
.length() == 0) {
483 InputElement childElement
= new InputElement(childName
, false, CustomXmlTraceDefinition
.TAG_IGNORE
, 0, "", null); //$NON-NLS-1$
484 inputElement
.addChild(childElement
);
485 feelingLucky(childElement
);
489 private static class InputElementTreeNodeContentProvider
implements ITreeContentProvider
{
492 public Object
[] getElements(Object inputElement
) {
493 CustomXmlTraceDefinition def
= (CustomXmlTraceDefinition
) inputElement
;
494 if (def
.rootInputElement
!= null) {
495 return new Object
[] { def
.rootInputElement
};
497 return new Object
[0];
501 public Object
[] getChildren(Object parentElement
) {
502 InputElement inputElement
= (InputElement
) parentElement
;
503 if (inputElement
.childElements
== null) {
504 return new InputElement
[0];
506 return inputElement
.childElements
.toArray();
510 public boolean hasChildren(Object element
) {
511 InputElement inputElement
= (InputElement
) element
;
512 return (inputElement
.childElements
!= null && inputElement
.childElements
.size() > 0);
516 public void dispose() {
520 public void inputChanged(Viewer viewer
, Object oldInput
, Object newInput
) {
524 public Object
getParent(Object element
) {
525 InputElement inputElement
= (InputElement
) element
;
526 return inputElement
.parentElement
;
530 private static class InputElementTreeLabelProvider
extends ColumnLabelProvider
{
533 public Image
getImage(Object element
) {
534 return ELEMENT_IMAGE
;
538 public String
getText(Object element
) {
539 InputElement inputElement
= (InputElement
) element
;
540 return (inputElement
.elementName
.trim().length() == 0) ?
"?" : inputElement
.elementName
; //$NON-NLS-1$
544 private class InputElementTreeSelectionChangedListener
implements ISelectionChangedListener
{
546 public void selectionChanged(SelectionChangedEvent event
) {
547 if (selectedElement
!= null) {
548 selectedElement
.dispose();
550 if (!(event
.getSelection().isEmpty()) && event
.getSelection() instanceof IStructuredSelection
) {
551 IStructuredSelection sel
= (IStructuredSelection
) event
.getSelection();
552 InputElement inputElement
= (InputElement
) sel
.getFirstElement();
553 selectedElement
= new ElementNode(elementContainer
, inputElement
);
554 elementContainer
.layout();
555 elementScrolledComposite
.setMinSize(elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
,
556 elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
- 1);
560 removeButton
.setEnabled(true);
561 addChildButton
.setEnabled(true);
562 addChildButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_addChildElement
);
563 if (definition
.rootInputElement
== inputElement
) {
564 addNextButton
.setEnabled(false);
566 addNextButton
.setEnabled(true);
568 moveUpButton
.setEnabled(true);
569 moveDownButton
.setEnabled(true);
571 removeButton
.setEnabled(false);
572 if (definition
.rootInputElement
== null) {
573 addChildButton
.setEnabled(true);
574 addChildButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_addDocumentElement
);
576 addChildButton
.setEnabled(false);
578 addNextButton
.setEnabled(false);
579 moveUpButton
.setEnabled(false);
580 moveDownButton
.setEnabled(false);
586 public void dispose() {
587 if (fixedFont
!= null) {
594 private void loadDefinition(CustomXmlTraceDefinition def
) {
595 logtypeText
.setText(def
.definitionName
);
596 timeStampOutputFormatText
.setText(def
.timeStampOutputFormat
);
597 treeViewer
.setInput(def
);
599 if (def
.rootInputElement
!= null) {
600 treeViewer
.setSelection(new StructuredSelection(def
.rootInputElement
));
604 private String
getName(InputElement inputElement
) {
605 String name
= (inputElement
.elementName
.trim().length() == 0) ?
"?" : inputElement
.elementName
.trim(); //$NON-NLS-1$
606 if (inputElement
.parentElement
== null) {
609 return getName(inputElement
.parentElement
) + " : " + name
; //$NON-NLS-1$
612 private String
getName(InputAttribute inputAttribute
, InputElement inputElement
) {
613 String name
= (inputAttribute
.attributeName
.trim().length() == 0) ?
"?" : inputAttribute
.attributeName
.trim(); //$NON-NLS-1$
614 return getName(inputElement
) + " : " + name
; //$NON-NLS-1$
618 public void setVisible(boolean visible
) {
623 super.setVisible(visible
);
627 * Get the global list of input names.
629 * @return The list of input names
631 public List
<String
> getInputNames() {
632 return getInputNames(definition
.rootInputElement
);
636 * Get the list of input names for a given element.
638 * @param inputElement
640 * @return The input names for this element
642 public List
<String
> getInputNames(InputElement inputElement
) {
643 List
<String
> inputs
= new ArrayList
<>();
644 if (inputElement
.inputName
!= null && !inputElement
.inputName
.equals(CustomXmlTraceDefinition
.TAG_IGNORE
)) {
645 String inputName
= inputElement
.inputName
;
646 if (!inputs
.contains(inputName
)) {
647 inputs
.add(inputName
);
650 if (inputElement
.attributes
!= null) {
651 for (InputAttribute attribute
: inputElement
.attributes
) {
652 String inputName
= attribute
.inputName
;
653 if (!inputs
.contains(inputName
)) {
654 inputs
.add(inputName
);
658 if (inputElement
.childElements
!= null) {
659 for (InputElement childInputElement
: inputElement
.childElements
) {
660 for (String inputName
: getInputNames(childInputElement
)) {
661 if (!inputs
.contains(inputName
)) {
662 inputs
.add(inputName
);
670 private void removeElement() {
671 selectedElement
.dispose();
672 selectedElement
= null;
673 elementContainer
.layout();
674 elementScrolledComposite
.setMinSize(elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
,
675 elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
- 1);
679 private String
getSelectionText() {
680 InputStream inputStream
= null;
681 if (this.selection
instanceof IStructuredSelection
) {
682 Object sel
= ((IStructuredSelection
) this.selection
).getFirstElement();
683 if (sel
instanceof IFile
) {
684 IFile file
= (IFile
) sel
;
686 inputStream
= file
.getContents();
687 } catch (CoreException e
) {
688 return ""; //$NON-NLS-1$
692 if (inputStream
!= null) {
693 try (BufferedReader reader
= new BufferedReader(new InputStreamReader(inputStream
));) {
694 StringBuilder sb
= new StringBuilder();
696 while ((line
= reader
.readLine()) != null) {
697 sb
.append(line
+ "\n"); //$NON-NLS-1$
699 parseXmlInput(sb
.toString());
700 return sb
.toString();
701 } catch (IOException e
) {
702 return ""; //$NON-NLS-1$
705 return ""; //$NON-NLS-1$
708 private void parseXmlInput(final String string
) {
710 DocumentBuilderFactory dbf
= DocumentBuilderFactory
.newInstance();
711 DocumentBuilder db
= dbf
.newDocumentBuilder();
713 // The following allows xml parsing without access to the dtd
714 EntityResolver resolver
= new EntityResolver() {
716 public InputSource
resolveEntity(String publicId
, String systemId
) {
717 String empty
= ""; //$NON-NLS-1$
718 ByteArrayInputStream bais
= new ByteArrayInputStream(empty
.getBytes());
719 return new InputSource(bais
);
722 db
.setEntityResolver(resolver
);
724 // The following catches xml parsing exceptions
725 db
.setErrorHandler(new ErrorHandler() {
727 public void error(SAXParseException saxparseexception
) throws SAXException
{
731 public void warning(SAXParseException saxparseexception
) throws SAXException
{
735 public void fatalError(SAXParseException saxparseexception
) throws SAXException
{
736 if (string
.trim().length() != 0) {
737 errorText
.setText(saxparseexception
.getMessage());
738 errorText
.setBackground(COLOR_LIGHT_RED
);
739 errorText
.setVisible(true);
741 throw saxparseexception
;
745 errorText
.setVisible(false);
747 doc
= db
.parse(new ByteArrayInputStream(string
.getBytes()));
748 documentElement
= doc
.getDocumentElement();
749 } catch (ParserConfigurationException e
) {
750 Activator
.getDefault().logError("Error pasing XML input string: " + string
, e
); //$NON-NLS-1$
751 documentElement
= null;
752 } catch (SAXException e
) {
753 documentElement
= null;
754 } catch (IOException e
) {
755 Activator
.getDefault().logError("Error pasing XML input string: " + string
, e
); //$NON-NLS-1$
756 documentElement
= null;
760 private void initValues() {
761 timeStampValue
= null;
762 timeStampFormat
= null;
764 logEntryFound
= false;
767 private void updatePreviews() {
768 if (inputText
== null) {
769 // early update during construction
772 inputText
.setStyleRanges(new StyleRange
[] {});
773 if (selectedElement
== null) {
779 selectedElement
.updatePreview();
781 if (timeStampValue
!= null && timeStampFormat
!= null) {
783 SimpleDateFormat dateFormat
= new SimpleDateFormat(timeStampFormat
);
784 Date date
= dateFormat
.parse(timeStampValue
);
785 dateFormat
= new SimpleDateFormat(timeStampOutputFormatText
.getText().trim());
786 timeStampPreviewText
.setText(dateFormat
.format(date
));
787 } catch (ParseException e
) {
788 timeStampPreviewText
.setText("*parse exception* [" + timeStampValue
+ "] <> [" + timeStampFormat
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
789 } catch (IllegalArgumentException e
) {
790 timeStampPreviewText
.setText("*parse exception* [Illegal Argument]"); //$NON-NLS-1$
793 timeStampPreviewText
.setText("*no matching time stamp*"); //$NON-NLS-1$
797 private void openHelpShell(String url
) {
798 if (helpBrowser
!= null && !helpBrowser
.isDisposed()) {
799 helpBrowser
.getShell().setActive();
800 if (!helpBrowser
.getUrl().equals(url
)) {
801 helpBrowser
.setUrl(url
);
805 final Shell helpShell
= new Shell(getShell(), SWT
.SHELL_TRIM
);
806 helpShell
.setLayout(new FillLayout());
807 helpBrowser
= new Browser(helpShell
, SWT
.NONE
);
808 helpBrowser
.addTitleListener(new TitleListener() {
810 public void changed(TitleEvent event
) {
811 helpShell
.setText(event
.title
);
814 helpBrowser
.setBounds(0, 0, 600, 400);
817 helpBrowser
.setUrl(url
);
820 private class UpdateListener
implements ModifyListener
, SelectionListener
{
823 public void modifyText(ModifyEvent e
) {
829 public void widgetDefaultSelected(SelectionEvent e
) {
835 public void widgetSelected(SelectionEvent e
) {
842 private class ElementNode
{
843 private final InputElement inputElement
;
844 private final Group group
;
845 private List
<Attribute
> attributes
= new ArrayList
<>();
846 private List
<ElementNode
> childElements
= new ArrayList
<>();
847 private Text elementNameText
;
848 private Composite tagComposite
;
849 private Combo tagCombo
;
850 private Label tagLabel
;
851 private Text tagText
;
852 private Combo actionCombo
;
853 private Label previewLabel
;
854 private Text previewText
;
855 private Button logEntryButton
;
856 private Label fillerLabel
;
857 private Composite addAttributeComposite
;
858 private Button addAttributeButton
;
859 private Label addAttributeLabel
;
861 public ElementNode(Composite parent
, InputElement inputElement
) {
862 this.inputElement
= inputElement
;
864 group
= new Group(parent
, SWT
.NONE
);
865 GridLayout gl
= new GridLayout(2, false);
868 group
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
869 group
.setText(getName(inputElement
));
871 Label label
= new Label(group
, SWT
.NULL
);
872 label
.setText(Messages
.CustomXmlParserInputWizardPage_elementName
);
873 label
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
875 elementNameText
= new Text(group
, SWT
.BORDER
| SWT
.SINGLE
);
876 GridData gd
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false);
878 elementNameText
.setLayoutData(gd
);
879 elementNameText
.addModifyListener(new ModifyListener() {
881 public void modifyText(ModifyEvent e
) {
882 ElementNode
.this.inputElement
.elementName
= elementNameText
.getText().trim();
883 group
.setText(getName(ElementNode
.this.inputElement
));
886 elementNameText
.setText(inputElement
.elementName
);
887 elementNameText
.addModifyListener(updateListener
);
889 if (inputElement
.parentElement
!= null) {
890 previewLabel
= new Label(group
, SWT
.NULL
);
891 previewLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
892 previewLabel
.setText(Messages
.CustomXmlParserInputWizardPage_preview
);
894 previewText
= new Text(group
, SWT
.BORDER
| SWT
.SINGLE
| SWT
.READ_ONLY
);
895 gd
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false);
897 previewText
.setLayoutData(gd
);
898 previewText
.setText(Messages
.CustomXmlParserInputWizardPage_noMatchingElement
);
899 previewText
.setBackground(COLOR_WIDGET_BACKGROUND
);
901 logEntryButton
= new Button(group
, SWT
.CHECK
);
902 logEntryButton
.setText(Messages
.CustomXmlParserInputWizardPage_logEntry
);
903 logEntryButton
.setSelection(inputElement
.logEntry
);
904 logEntryButton
.addSelectionListener(new SelectionListener() {
906 public void widgetDefaultSelected(SelectionEvent e
) {
910 public void widgetSelected(SelectionEvent e
) {
911 InputElement parentElem
= ElementNode
.this.inputElement
.parentElement
;
912 while (parentElem
!= null) {
913 parentElem
.logEntry
= false;
914 parentElem
= parentElem
.parentElement
;
918 logEntryButton
.addSelectionListener(updateListener
);
920 tagComposite
= new Composite(group
, SWT
.FILL
);
921 GridLayout tagLayout
= new GridLayout(4, false);
922 tagLayout
.marginWidth
= 0;
923 tagLayout
.marginHeight
= 0;
924 tagComposite
.setLayout(tagLayout
);
925 tagComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
927 tagCombo
= new Combo(tagComposite
, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
928 tagCombo
.setItems(new String
[] { CustomXmlTraceDefinition
.TAG_IGNORE
, CustomTraceDefinition
.TAG_TIMESTAMP
,
929 CustomTraceDefinition
.TAG_MESSAGE
, CustomTraceDefinition
.TAG_OTHER
});
930 tagCombo
.setVisibleItemCount(tagCombo
.getItemCount());
931 tagCombo
.addSelectionListener(new SelectionListener() {
933 public void widgetDefaultSelected(SelectionEvent e
) {
937 public void widgetSelected(SelectionEvent e
) {
938 tagText
.removeModifyListener(updateListener
);
939 switch (tagCombo
.getSelectionIndex()) {
941 tagLabel
.setVisible(false);
942 tagText
.setVisible(false);
943 actionCombo
.setVisible(false);
945 case 1: // Time Stamp
946 tagLabel
.setText(Messages
.CustomXmlParserInputWizardPage_format
);
947 tagLabel
.setVisible(true);
948 tagText
.setVisible(true);
949 tagText
.addModifyListener(updateListener
);
950 actionCombo
.setVisible(true);
953 tagLabel
.setVisible(false);
954 tagText
.setVisible(false);
955 actionCombo
.setVisible(true);
958 tagLabel
.setText(Messages
.CustomXmlParserInputWizardPage_tagName
);
959 tagLabel
.setVisible(true);
960 if (tagText
.getText().trim().length() == 0) {
961 tagText
.setText(elementNameText
.getText().trim());
963 tagText
.setVisible(true);
964 tagText
.addModifyListener(updateListener
);
965 actionCombo
.setVisible(true);
970 tagComposite
.layout();
976 tagLabel
= new Label(tagComposite
, SWT
.NULL
);
977 tagLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
979 tagText
= new Text(tagComposite
, SWT
.BORDER
| SWT
.SINGLE
);
980 gd
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false);
982 tagText
.setLayoutData(gd
);
984 actionCombo
= new Combo(tagComposite
, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
985 actionCombo
.setItems(new String
[] { Messages
.CustomXmlParserInputWizardPage_set
, Messages
.CustomXmlParserInputWizardPage_append
,
986 Messages
.CustomXmlParserInputWizardPage_appendWith
});
987 actionCombo
.select(inputElement
.inputAction
);
988 actionCombo
.addSelectionListener(updateListener
);
990 if (inputElement
.inputName
.equals(CustomXmlTraceDefinition
.TAG_IGNORE
)) {
992 tagLabel
.setVisible(false);
993 tagText
.setVisible(false);
994 actionCombo
.setVisible(false);
995 } else if (inputElement
.inputName
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
997 tagLabel
.setText(Messages
.CustomXmlParserInputWizardPage_format
);
998 tagText
.setText(inputElement
.inputFormat
);
999 tagText
.addModifyListener(updateListener
);
1000 } else if (inputElement
.inputName
.equals(CustomTraceDefinition
.TAG_MESSAGE
)) {
1002 tagLabel
.setVisible(false);
1003 tagText
.setVisible(false);
1006 tagLabel
.setText(Messages
.CustomXmlParserInputWizardPage_tagName
);
1007 tagText
.setText(inputElement
.inputName
);
1008 tagText
.addModifyListener(updateListener
);
1012 if (inputElement
.attributes
!= null) {
1013 for (InputAttribute inputAttribute
: inputElement
.attributes
) {
1014 Attribute attribute
= new Attribute(group
, this, inputAttribute
, attributes
.size() + 1);
1015 attributes
.add(attribute
);
1022 private void updatePreview() {
1023 Element element
= getPreviewElement(inputElement
);
1024 if (inputElement
.parentElement
!= null) { // no preview text for
1026 previewText
.setText(Messages
.CustomXmlParserInputWizardPage_noMatchingElement
);
1027 if (element
!= null) {
1028 previewText
.setText(CustomXmlTrace
.parseElement(element
, new StringBuffer()).toString());
1029 if (logEntryButton
.getSelection()) {
1030 if (!logEntryFound
) {
1031 logEntryFound
= true;
1034 logEntryButton
.setSelection(false); // remove nested
1038 if (tagCombo
.getText().equals(CustomTraceDefinition
.TAG_TIMESTAMP
) && logEntriesCount
<= 1) {
1039 String value
= previewText
.getText().trim();
1040 if (value
.length() != 0) {
1041 if (actionCombo
.getSelectionIndex() == CustomTraceDefinition
.ACTION_SET
) {
1042 timeStampValue
= value
;
1043 timeStampFormat
= tagText
.getText().trim();
1044 } else if (actionCombo
.getSelectionIndex() == CustomTraceDefinition
.ACTION_APPEND
) {
1045 if (timeStampValue
!= null) {
1046 timeStampValue
+= value
;
1047 timeStampFormat
+= tagText
.getText().trim();
1049 timeStampValue
= value
;
1050 timeStampFormat
= tagText
.getText().trim();
1052 } else if (actionCombo
.getSelectionIndex() == CustomTraceDefinition
.ACTION_APPEND_WITH_SEPARATOR
) {
1053 if (timeStampValue
!= null) {
1054 timeStampValue
+= " | " + value
; //$NON-NLS-1$
1055 timeStampFormat
+= " | " + tagText
.getText().trim(); //$NON-NLS-1$
1057 timeStampValue
= value
;
1058 timeStampFormat
= tagText
.getText().trim();
1065 for (Attribute attribute
: attributes
) {
1066 if (element
!= null) {
1067 String value
= element
.getAttribute(attribute
.attributeNameText
.getText().trim());
1068 if (value
.length() != 0) {
1069 attribute
.previewText
.setText(value
);
1070 if (attribute
.tagCombo
.getText().equals(CustomTraceDefinition
.TAG_TIMESTAMP
) && logEntriesCount
<= 1) {
1071 if (attribute
.actionCombo
.getSelectionIndex() == CustomTraceDefinition
.ACTION_SET
) {
1072 timeStampValue
= value
;
1073 timeStampFormat
= attribute
.tagText
.getText().trim();
1074 } else if (attribute
.actionCombo
.getSelectionIndex() == CustomTraceDefinition
.ACTION_APPEND
) {
1075 if (timeStampValue
!= null) {
1076 timeStampValue
+= value
;
1077 timeStampFormat
+= attribute
.tagText
.getText().trim();
1079 timeStampValue
= value
;
1080 timeStampFormat
= attribute
.tagText
.getText().trim();
1082 } else if (attribute
.actionCombo
.getSelectionIndex() == CustomTraceDefinition
.ACTION_APPEND_WITH_SEPARATOR
) {
1083 if (timeStampValue
!= null) {
1084 timeStampValue
+= " | " + value
; //$NON-NLS-1$
1085 timeStampFormat
+= " | " + attribute
.tagText
.getText().trim(); //$NON-NLS-1$
1087 timeStampValue
= value
;
1088 timeStampFormat
= attribute
.tagText
.getText().trim();
1093 attribute
.previewText
.setText(Messages
.CustomXmlParserInputWizardPage_noMatchingAttribute
);
1096 attribute
.previewText
.setText(Messages
.CustomXmlParserInputWizardPage_noMatchingElement
);
1099 for (ElementNode child
: childElements
) {
1100 child
.updatePreview();
1102 if (logEntryButton
!= null && logEntryButton
.getSelection()) {
1103 logEntryFound
= false;
1107 private void createAddButton() {
1108 fillerLabel
= new Label(group
, SWT
.NONE
);
1110 addAttributeComposite
= new Composite(group
, SWT
.NONE
);
1111 addAttributeComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1112 GridLayout addAttributeLayout
= new GridLayout(2, false);
1113 addAttributeLayout
.marginHeight
= 0;
1114 addAttributeLayout
.marginWidth
= 0;
1115 addAttributeComposite
.setLayout(addAttributeLayout
);
1117 addAttributeButton
= new Button(addAttributeComposite
, SWT
.PUSH
);
1118 addAttributeButton
.setImage(ADD_IMAGE
);
1119 addAttributeButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_addAttribute
);
1120 addAttributeButton
.addSelectionListener(new SelectionAdapter() {
1122 public void widgetSelected(SelectionEvent e
) {
1124 String attributeName
= getAttributeNameSuggestion(inputElement
);
1125 InputAttribute inputAttribute
= new InputAttribute(attributeName
, attributeName
, 0, ""); //$NON-NLS-1$
1126 attributes
.add(new Attribute(group
, ElementNode
.this, inputAttribute
, attributes
.size() + 1));
1128 elementContainer
.layout();
1129 elementScrolledComposite
.setMinSize(elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
,
1130 elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
- 1);
1131 group
.getParent().layout();
1137 addAttributeLabel
= new Label(addAttributeComposite
, SWT
.NULL
);
1138 addAttributeLabel
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1139 addAttributeLabel
.setText(Messages
.CustomXmlParserInputWizardPage_newAttibute
);
1142 private void removeAddButton() {
1143 fillerLabel
.dispose();
1144 addAttributeComposite
.dispose();
1147 private void removeAttribute(int attributeNumber
) {
1148 int nb
= attributeNumber
;
1149 if (--nb
< attributes
.size()) {
1150 attributes
.remove(nb
).dispose();
1151 for (int i
= nb
; i
< attributes
.size(); i
++) {
1152 attributes
.get(i
).setAttributeNumber(i
+ 1);
1154 elementContainer
.layout();
1155 elementScrolledComposite
.setMinSize(elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).x
,
1156 elementContainer
.computeSize(SWT
.DEFAULT
, SWT
.DEFAULT
).y
- 1);
1157 group
.getParent().layout();
1161 private void dispose() {
1165 private void extractInputs() {
1166 inputElement
.elementName
= elementNameText
.getText().trim();
1167 if (inputElement
.parentElement
!= null) {
1168 inputElement
.logEntry
= logEntryButton
.getSelection();
1169 if (tagCombo
.getText().equals(CustomTraceDefinition
.TAG_OTHER
)) {
1170 inputElement
.inputName
= tagText
.getText().trim();
1172 inputElement
.inputName
= tagCombo
.getText();
1173 if (tagCombo
.getText().equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
1174 inputElement
.inputFormat
= tagText
.getText().trim();
1177 inputElement
.inputAction
= actionCombo
.getSelectionIndex();
1179 inputElement
.attributes
= new ArrayList
<>(attributes
.size());
1180 for (int i
= 0; i
< attributes
.size(); i
++) {
1181 Attribute attribute
= attributes
.get(i
);
1182 InputAttribute inputAttribute
= new InputAttribute();
1183 inputAttribute
.attributeName
= attribute
.attributeNameText
.getText().trim();
1184 if (attribute
.tagCombo
.getText().equals(CustomTraceDefinition
.TAG_OTHER
)) {
1185 inputAttribute
.inputName
= attribute
.tagText
.getText().trim();
1187 inputAttribute
.inputName
= attribute
.tagCombo
.getText();
1188 if (attribute
.tagCombo
.getText().equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
1189 inputAttribute
.inputFormat
= attribute
.tagText
.getText().trim();
1192 inputAttribute
.inputAction
= attribute
.actionCombo
.getSelectionIndex();
1193 inputElement
.addAttribute(inputAttribute
);
1198 private class Attribute
{
1199 private ElementNode element
;
1200 private int attributeNumber
;
1202 // children of parent (must be disposed)
1203 private Composite labelComposite
;
1204 private Composite attributeComposite
;
1205 private Label filler
;
1206 private Composite tagComposite
;
1208 // children of labelComposite
1209 private Label attributeLabel
;
1211 // children of attributeComposite
1212 private Text attributeNameText
;
1213 private Text previewText
;
1215 // children of tagComposite
1216 private Combo tagCombo
;
1217 private Label tagLabel
;
1218 private Text tagText
;
1219 private Combo actionCombo
;
1221 public Attribute(Composite parent
, ElementNode element
, InputAttribute inputAttribute
, int attributeNumber
) {
1222 this.element
= element
;
1223 this.attributeNumber
= attributeNumber
;
1225 labelComposite
= new Composite(parent
, SWT
.FILL
);
1226 GridLayout labelLayout
= new GridLayout(2, false);
1227 labelLayout
.marginWidth
= 0;
1228 labelLayout
.marginHeight
= 0;
1229 labelComposite
.setLayout(labelLayout
);
1230 labelComposite
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1232 Button deleteButton
= new Button(labelComposite
, SWT
.PUSH
);
1233 deleteButton
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1234 deleteButton
.setImage(DELETE_IMAGE
);
1235 deleteButton
.setToolTipText(Messages
.CustomXmlParserInputWizardPage_removeAttribute
);
1236 deleteButton
.addSelectionListener(new SelectionAdapter() {
1238 public void widgetSelected(SelectionEvent e
) {
1239 Attribute
.this.element
.removeAttribute(Attribute
.this.attributeNumber
);
1245 attributeLabel
= new Label(labelComposite
, SWT
.NULL
);
1246 attributeLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1247 attributeLabel
.setText(Messages
.CustomXmlParserInputWizardPage_attibute
);
1249 attributeComposite
= new Composite(parent
, SWT
.FILL
);
1250 GridLayout attributeLayout
= new GridLayout(4, false);
1251 attributeLayout
.marginWidth
= 0;
1252 attributeLayout
.marginHeight
= 0;
1253 attributeComposite
.setLayout(attributeLayout
);
1254 attributeComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1256 Label nameLabel
= new Label(attributeComposite
, SWT
.NONE
);
1257 nameLabel
.setText(Messages
.CustomXmlParserInputWizardPage_name
);
1259 attributeNameText
= new Text(attributeComposite
, SWT
.BORDER
| SWT
.SINGLE
);
1260 attributeNameText
.setLayoutData(new GridData(120, SWT
.DEFAULT
));
1261 attributeNameText
.setText(inputAttribute
.attributeName
);
1262 attributeNameText
.addModifyListener(updateListener
);
1264 Label previewLabel
= new Label(attributeComposite
, SWT
.NONE
);
1265 previewLabel
.setText(Messages
.CustomXmlParserInputWizardPage_preview
);
1267 previewText
= new Text(attributeComposite
, SWT
.BORDER
| SWT
.SINGLE
| SWT
.READ_ONLY
);
1268 GridData gd
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false);
1270 previewText
.setLayoutData(gd
);
1271 previewText
.setText(Messages
.CustomXmlParserInputWizardPage_noMatch
);
1272 previewText
.setBackground(COLOR_WIDGET_BACKGROUND
);
1274 filler
= new Label(parent
, SWT
.NULL
);
1276 tagComposite
= new Composite(parent
, SWT
.FILL
);
1277 GridLayout tagLayout
= new GridLayout(4, false);
1278 tagLayout
.marginWidth
= 0;
1279 tagLayout
.marginHeight
= 0;
1280 tagComposite
.setLayout(tagLayout
);
1281 tagComposite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1283 tagCombo
= new Combo(tagComposite
, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
1284 tagCombo
.setItems(new String
[] { CustomTraceDefinition
.TAG_TIMESTAMP
, CustomTraceDefinition
.TAG_MESSAGE
,
1285 CustomTraceDefinition
.TAG_OTHER
});
1286 tagCombo
.select(2); // Other
1287 tagCombo
.addSelectionListener(new SelectionListener() {
1289 public void widgetDefaultSelected(SelectionEvent e
) {
1293 public void widgetSelected(SelectionEvent e
) {
1294 tagText
.removeModifyListener(updateListener
);
1295 switch (tagCombo
.getSelectionIndex()) {
1296 case 0: // Time Stamp
1297 tagLabel
.setText(Messages
.CustomXmlParserInputWizardPage_format
);
1298 tagLabel
.setVisible(true);
1299 tagText
.setVisible(true);
1300 tagText
.addModifyListener(updateListener
);
1303 tagLabel
.setVisible(false);
1304 tagText
.setVisible(false);
1307 tagLabel
.setText(Messages
.CustomXmlParserInputWizardPage_tagName
);
1308 tagLabel
.setVisible(true);
1309 if (tagText
.getText().trim().length() == 0) {
1310 tagText
.setText(attributeNameText
.getText().trim());
1312 tagText
.setVisible(true);
1313 tagText
.addModifyListener(updateListener
);
1318 tagComposite
.layout();
1324 tagLabel
= new Label(tagComposite
, SWT
.NULL
);
1325 tagLabel
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false));
1327 tagText
= new Text(tagComposite
, SWT
.BORDER
| SWT
.SINGLE
);
1328 gd
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false);
1330 tagText
.setLayoutData(gd
);
1331 tagText
.setText(attributeNameText
.getText());
1333 actionCombo
= new Combo(tagComposite
, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
1334 actionCombo
.setItems(new String
[] { Messages
.CustomXmlParserInputWizardPage_set
, Messages
.CustomXmlParserInputWizardPage_append
,
1335 Messages
.CustomXmlParserInputWizardPage_appendWith
});
1336 actionCombo
.select(inputAttribute
.inputAction
);
1337 actionCombo
.addSelectionListener(updateListener
);
1339 if (inputAttribute
.inputName
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
1341 tagLabel
.setText(Messages
.CustomXmlParserInputWizardPage_format
);
1342 tagText
.setText(inputAttribute
.inputFormat
);
1343 tagText
.addModifyListener(updateListener
);
1344 } else if (inputAttribute
.inputName
.equals(CustomTraceDefinition
.TAG_MESSAGE
)) {
1346 tagLabel
.setVisible(false);
1347 tagText
.setVisible(false);
1350 tagLabel
.setText(Messages
.CustomXmlParserInputWizardPage_tagName
);
1351 tagText
.setText(inputAttribute
.inputName
);
1352 tagText
.addModifyListener(updateListener
);
1356 private void dispose() {
1357 labelComposite
.dispose();
1358 attributeComposite
.dispose();
1360 tagComposite
.dispose();
1363 private void setAttributeNumber(int attributeNumber
) {
1364 this.attributeNumber
= attributeNumber
;
1365 labelComposite
.layout();
1369 private Element
getPreviewElement(InputElement inputElement
) {
1370 InputElement currentElement
= inputElement
;
1371 Element element
= documentElement
;
1372 if (element
!= null) {
1373 if (!documentElement
.getNodeName().equals(definition
.rootInputElement
.elementName
)) {
1376 ArrayList
<String
> elementNames
= new ArrayList
<>();
1377 while (currentElement
!= null) {
1378 elementNames
.add(currentElement
.elementName
);
1379 currentElement
= currentElement
.parentElement
;
1381 for (int i
= elementNames
.size() - 1; --i
>= 0;) {
1382 NodeList childList
= element
.getChildNodes();
1384 for (int j
= 0; j
< childList
.getLength(); j
++) {
1385 Node child
= childList
.item(j
);
1386 if (child
instanceof Element
&& child
.getNodeName().equals(elementNames
.get(i
))) {
1387 element
= (Element
) child
;
1391 if (element
== null) {
1395 if (element
!= null) {
1402 private String
getChildNameSuggestion(InputElement inputElement
) {
1403 if (inputElement
== null) {
1404 if (documentElement
!= null) {
1405 return documentElement
.getNodeName();
1408 Element element
= getPreviewElement(inputElement
);
1409 if (element
!= null) {
1410 NodeList childNodes
= element
.getChildNodes();
1411 for (int i
= 0; i
< childNodes
.getLength(); i
++) {
1412 Node node
= childNodes
.item(i
);
1413 if (node
instanceof Element
) {
1414 boolean unused
= true;
1415 if (inputElement
.childElements
!= null) {
1416 for (InputElement child
: inputElement
.childElements
) {
1417 if (child
.elementName
.equals(node
.getNodeName())) {
1424 return node
.getNodeName();
1430 return ""; //$NON-NLS-1$
1433 private String
getAttributeNameSuggestion(InputElement inputElement
) {
1434 Element element
= getPreviewElement(inputElement
);
1435 if (element
!= null) {
1436 NamedNodeMap attributeMap
= element
.getAttributes();
1437 for (int i
= 0; i
< attributeMap
.getLength(); i
++) {
1438 Node node
= attributeMap
.item(i
);
1439 boolean unused
= true;
1440 if (inputElement
.attributes
!= null) {
1441 for (InputAttribute attribute
: inputElement
.attributes
) {
1442 if (attribute
.attributeName
.equals(node
.getNodeName())) {
1449 return node
.getNodeName();
1453 return ""; //$NON-NLS-1$
1456 private void validate() {
1457 definition
.definitionName
= logtypeText
.getText().trim();
1458 definition
.timeStampOutputFormat
= timeStampOutputFormatText
.getText().trim();
1460 if (selectedElement
!= null) {
1461 selectedElement
.extractInputs();
1462 treeViewer
.refresh();
1465 StringBuffer errors
= new StringBuffer();
1467 if (definition
.definitionName
.length() == 0) {
1468 errors
.append(Messages
.CustomXmlParserInputWizardPage_emptyLogTypeError
);
1469 logtypeText
.setBackground(COLOR_LIGHT_RED
);
1471 logtypeText
.setBackground(COLOR_TEXT_BACKGROUND
);
1472 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
1473 if (definition
.definitionName
.equals(def
.definitionName
) &&
1474 (editDefinitionName
== null || !editDefinitionName
.equals(definition
.definitionName
))) {
1475 errors
.append(Messages
.CustomXmlParserInputWizardPage_duplicatelogTypeError
);
1476 logtypeText
.setBackground(COLOR_LIGHT_RED
);
1482 if (definition
.rootInputElement
== null) {
1483 errors
.append(Messages
.CustomXmlParserInputWizardPage_noDocumentError
);
1486 if (definition
.rootInputElement
!= null) {
1487 logEntryFound
= false;
1488 timeStampFound
= false;
1490 errors
.append(validateElement(definition
.rootInputElement
));
1492 if ((definition
.rootInputElement
.attributes
!= null && definition
.rootInputElement
.attributes
.size() != 0)
1493 || (definition
.rootInputElement
.childElements
!= null && definition
.rootInputElement
.childElements
.size() != 0)
1494 || errors
.length() == 0) {
1495 if (!logEntryFound
) {
1496 errors
.append(Messages
.CustomXmlParserInputWizardPage_missingLogEntryError
);
1499 if (timeStampFound
) {
1500 if (timeStampOutputFormatText
.getText().trim().length() == 0) {
1501 errors
.append(Messages
.CustomXmlParserInputWizardPage_missingTimestampFmtError
);
1502 timeStampOutputFormatText
.setBackground(COLOR_LIGHT_RED
);
1505 new SimpleDateFormat(timeStampOutputFormatText
.getText().trim());
1506 timeStampOutputFormatText
.setBackground(COLOR_TEXT_BACKGROUND
);
1507 } catch (IllegalArgumentException e
) {
1508 errors
.append(Messages
.CustomXmlParserInputWizardPage_invalidTimestampFmtError
);
1509 timeStampOutputFormatText
.setBackground(COLOR_LIGHT_RED
);
1513 timeStampPreviewText
.setText(Messages
.CustomXmlParserInputWizardPage_notimestamporAttributeError
);
1517 timeStampPreviewText
.setText(Messages
.CustomXmlParserInputWizardPage_notimestamporAttributeError
);
1520 if (errors
.length() == 0) {
1521 setDescription(defaultDescription
);
1522 setPageComplete(true);
1524 setDescription(errors
.toString());
1525 setPageComplete(false);
1530 * Clean up the specified XML element.
1532 * @param inputElement
1533 * The element to clean up
1534 * @return The validated element
1536 public StringBuffer
validateElement(InputElement inputElement
) {
1537 StringBuffer errors
= new StringBuffer();
1538 ElementNode elementNode
= null;
1539 if (selectedElement
!= null && selectedElement
.inputElement
.equals(inputElement
)) {
1540 elementNode
= selectedElement
;
1542 if (inputElement
== definition
.rootInputElement
) {
1543 if (inputElement
.elementName
.length() == 0) {
1544 errors
.append(Messages
.CustomXmlParserInputWizardPage_missingDocumentElementError
);
1545 if (elementNode
!= null) {
1546 elementNode
.elementNameText
.setBackground(COLOR_LIGHT_RED
);
1549 if (elementNode
!= null) {
1550 elementNode
.elementNameText
.setBackground(COLOR_TEXT_BACKGROUND
);
1554 if (inputElement
!= definition
.rootInputElement
) {
1555 if (inputElement
.logEntry
) {
1556 logEntryFound
= true;
1558 if (inputElement
.inputName
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
1559 timeStampFound
= true;
1560 if (inputElement
.inputFormat
.length() == 0) {
1561 errors
.append(Messages
.CustomXmlParserInputWizardPage_timestampFormatPrompt
1562 + " (" + Messages
.CustomXmlParserInputWizardPage_timestampElementPrompt
+ " " + getName(inputElement
) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1563 if (elementNode
!= null) {
1564 elementNode
.tagText
.setBackground(COLOR_LIGHT_RED
);
1568 new SimpleDateFormat(inputElement
.inputFormat
);
1569 if (elementNode
!= null) {
1570 elementNode
.tagText
.setBackground(COLOR_TEXT_BACKGROUND
);
1572 } catch (IllegalArgumentException e
) {
1573 errors
.append(Messages
.CustomXmlParserInputWizardPage_invalidTimestampFmtError
1574 + " (" + Messages
.CustomXmlParserInputWizardPage_timestampElementPrompt
+ " " + getName(inputElement
) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1575 if (elementNode
!= null) {
1576 elementNode
.tagText
.setBackground(COLOR_LIGHT_RED
);
1580 } else if (inputElement
.inputName
.length() == 0) {
1581 errors
.append(Messages
.CustomXmlParserInputWizardPage_missingInputElementNameError
);
1582 if (elementNode
!= null) {
1583 elementNode
.tagText
.setBackground(COLOR_LIGHT_RED
);
1586 if (elementNode
!= null) {
1587 elementNode
.tagText
.setBackground(COLOR_TEXT_BACKGROUND
);
1591 if (inputElement
.attributes
!= null) {
1592 if (elementNode
!= null) {
1593 for (Attribute attribute
: elementNode
.attributes
) {
1594 attribute
.attributeNameText
.setBackground(COLOR_TEXT_BACKGROUND
);
1597 for (int i
= 0; i
< inputElement
.attributes
.size(); i
++) {
1598 InputAttribute attribute
= inputElement
.attributes
.get(i
);
1599 boolean duplicate
= false;
1600 for (int j
= i
+ 1; j
< inputElement
.attributes
.size(); j
++) {
1601 InputAttribute otherAttribute
= inputElement
.attributes
.get(j
);
1602 if (otherAttribute
.attributeName
.equals(attribute
.attributeName
)) {
1604 if (elementNode
!= null) {
1605 elementNode
.attributes
.get(j
).attributeNameText
.setBackground(COLOR_LIGHT_RED
);
1609 if (attribute
.attributeName
.length() == 0) {
1610 errors
.append(Messages
.CustomXmlParserInputWizardPage_missingAttribute
1611 + " (" + Messages
.CustomXmlParserInputWizardPage_attributePrompt
+ " " + getName(inputElement
) + ": ?). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1612 if (elementNode
!= null) {
1613 elementNode
.attributes
.get(i
).attributeNameText
.setBackground(COLOR_LIGHT_RED
);
1615 } else if (duplicate
) {
1616 errors
.append(Messages
.CustomXmlParserInputWizardPage_duplicateAttributeError
1617 + " (" + Messages
.CustomXmlParserInputWizardPage_attributePrompt
+ " " + getName(attribute
, inputElement
) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1618 if (elementNode
!= null) {
1619 elementNode
.attributes
.get(i
).attributeNameText
.setBackground(COLOR_LIGHT_RED
);
1622 if (attribute
.inputName
.equals(CustomTraceDefinition
.TAG_TIMESTAMP
)) {
1623 timeStampFound
= true;
1624 if (attribute
.inputFormat
.length() == 0) {
1625 errors
.append(Messages
.CustomXmlParserInputWizardPage_missingTimestampInFmtError
1626 + " (" + Messages
.CustomXmlParserInputWizardPage_attributePrompt
+ " " + getName(attribute
, inputElement
) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1627 if (elementNode
!= null) {
1628 elementNode
.attributes
.get(i
).tagText
.setBackground(COLOR_LIGHT_RED
);
1632 new SimpleDateFormat(attribute
.inputFormat
);
1633 if (elementNode
!= null) {
1634 elementNode
.attributes
.get(i
).tagText
.setBackground(COLOR_TEXT_BACKGROUND
);
1636 } catch (IllegalArgumentException e
) {
1637 errors
.append(Messages
.CustomXmlParserInputWizardPage_invalidTimestampInFmtError
1638 + " (" + Messages
.CustomXmlParserInputWizardPage_attributePrompt
+ " " + getName(attribute
, inputElement
) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1639 if (elementNode
!= null) {
1640 elementNode
.attributes
.get(i
).tagText
.setBackground(COLOR_LIGHT_RED
);
1644 } else if (attribute
.inputName
.length() == 0) {
1645 errors
.append(Messages
.CustomXmlParserInputWizardPage_missingDataGroupNameError
1646 + " (" + Messages
.CustomXmlParserInputWizardPage_attributePrompt
+ " " + getName(attribute
, inputElement
) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1647 if (elementNode
!= null) {
1648 elementNode
.attributes
.get(i
).tagText
.setBackground(COLOR_LIGHT_RED
);
1651 if (elementNode
!= null) {
1652 elementNode
.attributes
.get(i
).tagText
.setBackground(COLOR_TEXT_BACKGROUND
);
1657 if (inputElement
.childElements
!= null) {
1658 for (InputElement child
: inputElement
.childElements
) {
1659 ElementNode childElementNode
= null;
1660 if (selectedElement
!= null && selectedElement
.inputElement
.equals(child
)) {
1661 childElementNode
= selectedElement
;
1663 if (childElementNode
!= null) {
1664 childElementNode
.elementNameText
.setBackground(COLOR_TEXT_BACKGROUND
);
1667 for (int i
= 0; i
< inputElement
.childElements
.size(); i
++) {
1668 InputElement child
= inputElement
.childElements
.get(i
);
1669 ElementNode childElementNode
= null;
1670 if (selectedElement
!= null && selectedElement
.inputElement
.equals(child
)) {
1671 childElementNode
= selectedElement
;
1673 if (child
.elementName
.length() == 0) {
1674 errors
.append(Messages
.CustomXmlParserInputWizardPage_missingElementNameError
1675 + " (" + Messages
.CustomXmlParserInputWizardPage_attributePrompt
+ " " + getName(child
) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1676 if (childElementNode
!= null) {
1677 childElementNode
.elementNameText
.setBackground(COLOR_LIGHT_RED
);
1680 boolean duplicate
= false;
1681 for (int j
= i
+ 1; j
< inputElement
.childElements
.size(); j
++) {
1682 InputElement otherChild
= inputElement
.childElements
.get(j
);
1683 if (otherChild
.elementName
.equals(child
.elementName
)) {
1685 ElementNode otherChildElementNode
= null;
1686 if (selectedElement
!= null && selectedElement
.inputElement
.equals(otherChild
)) {
1687 otherChildElementNode
= selectedElement
;
1689 if (otherChildElementNode
!= null) {
1690 otherChildElementNode
.elementNameText
.setBackground(COLOR_LIGHT_RED
);
1695 errors
.append(Messages
.CustomXmlParserInputWizardPage_duplicateElementNameError
1696 + " (" + Messages
.CustomXmlParserInputWizardPage_attributePrompt
+ " " + getName(child
) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1697 if (childElementNode
!= null) {
1698 childElementNode
.elementNameText
.setBackground(COLOR_LIGHT_RED
);
1703 errors
.append(validateElement(child
));
1710 * Get the trace definition.
1712 * @return The trace definition
1714 public CustomXmlTraceDefinition
getDefinition() {
1719 * Get the raw text input.
1721 * @return The raw text input.
1723 public char[] getInputText() {
1724 return inputText
.getText().toCharArray();