Added TMF statistics feature (Bug 360572)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / wizards / CustomXmlParserInputWizardPage.java
1 package org.eclipse.linuxtools.tmf.ui.wizards;
2
3 import java.io.BufferedReader;
4 import java.io.ByteArrayInputStream;
5 import java.io.IOException;
6 import java.io.InputStream;
7 import java.io.InputStreamReader;
8 import java.text.ParseException;
9 import java.text.SimpleDateFormat;
10 import java.util.ArrayList;
11 import java.util.Date;
12 import java.util.List;
13
14 import javax.xml.parsers.DocumentBuilder;
15 import javax.xml.parsers.DocumentBuilderFactory;
16 import javax.xml.parsers.ParserConfigurationException;
17
18 import org.eclipse.core.resources.IFile;
19 import org.eclipse.core.runtime.CoreException;
20 import org.eclipse.jface.viewers.ColumnLabelProvider;
21 import org.eclipse.jface.viewers.ISelection;
22 import org.eclipse.jface.viewers.ISelectionChangedListener;
23 import org.eclipse.jface.viewers.IStructuredSelection;
24 import org.eclipse.jface.viewers.ITreeContentProvider;
25 import org.eclipse.jface.viewers.SelectionChangedEvent;
26 import org.eclipse.jface.viewers.StructuredSelection;
27 import org.eclipse.jface.viewers.TreeViewer;
28 import org.eclipse.jface.viewers.Viewer;
29 import org.eclipse.jface.wizard.WizardPage;
30 import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;
31 import org.eclipse.linuxtools.tmf.ui.internal.Messages;
32 import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTrace;
33 import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition;
34 import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition.InputAttribute;
35 import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition.InputElement;
36 import org.eclipse.swt.SWT;
37 import org.eclipse.swt.browser.Browser;
38 import org.eclipse.swt.browser.TitleEvent;
39 import org.eclipse.swt.browser.TitleListener;
40 import org.eclipse.swt.custom.SashForm;
41 import org.eclipse.swt.custom.ScrolledComposite;
42 import org.eclipse.swt.custom.StyleRange;
43 import org.eclipse.swt.custom.StyledText;
44 import org.eclipse.swt.events.ModifyEvent;
45 import org.eclipse.swt.events.ModifyListener;
46 import org.eclipse.swt.events.SelectionAdapter;
47 import org.eclipse.swt.events.SelectionEvent;
48 import org.eclipse.swt.events.SelectionListener;
49 import org.eclipse.swt.graphics.Color;
50 import org.eclipse.swt.graphics.Font;
51 import org.eclipse.swt.graphics.FontData;
52 import org.eclipse.swt.graphics.Image;
53 import org.eclipse.swt.layout.FillLayout;
54 import org.eclipse.swt.layout.GridData;
55 import org.eclipse.swt.layout.GridLayout;
56 import org.eclipse.swt.widgets.Button;
57 import org.eclipse.swt.widgets.Combo;
58 import org.eclipse.swt.widgets.Composite;
59 import org.eclipse.swt.widgets.Display;
60 import org.eclipse.swt.widgets.Group;
61 import org.eclipse.swt.widgets.Label;
62 import org.eclipse.swt.widgets.Shell;
63 import org.eclipse.swt.widgets.Text;
64 import org.w3c.dom.Document;
65 import org.w3c.dom.Element;
66 import org.w3c.dom.NamedNodeMap;
67 import org.w3c.dom.Node;
68 import org.w3c.dom.NodeList;
69 import org.xml.sax.EntityResolver;
70 import org.xml.sax.ErrorHandler;
71 import org.xml.sax.InputSource;
72 import org.xml.sax.SAXException;
73 import org.xml.sax.SAXParseException;
74
75 public class CustomXmlParserInputWizardPage extends WizardPage {
76
77 private static final String DEFAULT_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
78 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$
79 private static final Image elementImage = TmfUiPlugin.getDefault().getImageFromPath("/icons/elcl16/element_icon.gif"); //$NON-NLS-1$
80 private static final Image addImage = TmfUiPlugin.getDefault().getImageFromPath("/icons/elcl16/add_button.gif"); //$NON-NLS-1$
81 private static final Image addNextImage = TmfUiPlugin.getDefault().getImageFromPath("/icons/elcl16/addnext_button.gif"); //$NON-NLS-1$
82 private static final Image addChildImage = TmfUiPlugin.getDefault().getImageFromPath("/icons/elcl16/addchild_button.gif"); //$NON-NLS-1$
83 private static final Image addManyImage = TmfUiPlugin.getDefault().getImageFromPath("/icons/elcl16/addmany_button.gif"); //$NON-NLS-1$
84 private static final Image deleteImage = TmfUiPlugin.getDefault().getImageFromPath("/icons/elcl16/delete_button.gif"); //$NON-NLS-1$
85 private static final Image moveUpImage = TmfUiPlugin.getDefault().getImageFromPath("/icons/elcl16/moveup_button.gif"); //$NON-NLS-1$
86 private static final Image moveDownImage = TmfUiPlugin.getDefault().getImageFromPath("/icons/elcl16/movedown_button.gif"); //$NON-NLS-1$
87 private static final Image helpImage = TmfUiPlugin.getDefault().getImageFromPath("/icons/elcl16/help_button.gif"); //$NON-NLS-1$
88 private static final Color COLOR_LIGHT_RED = new Color(Display.getDefault(), 255, 192, 192);
89 private static final Color COLOR_TEXT_BACKGROUND = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
90 private static final Color COLOR_WIDGET_BACKGROUND = Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
91
92 private final ISelection selection;
93 private CustomXmlTraceDefinition definition;
94 private String editDefinitionName;
95 private String defaultDescription;
96 private ElementNode selectedElement;
97 private Composite container;
98 private Text logtypeText;
99 private Text timeStampOutputFormatText;
100 private Text timeStampPreviewText;
101 private Button removeButton;
102 private Button addChildButton;
103 private Button addNextButton;
104 private Button moveUpButton;
105 private Button moveDownButton;
106 private Button feelingLuckyButton;
107 private ScrolledComposite treeScrolledComposite;
108 private ScrolledComposite elementScrolledComposite;
109 private TreeViewer treeViewer;
110 private Composite treeContainer;
111 private Composite elementContainer;
112 private Text errorText;
113 private StyledText inputText;
114 private Font fixedFont;
115 private UpdateListener updateListener;
116 private Browser helpBrowser;
117 private Element documentElement;
118
119 // variables used recursively through element traversal
120 private String timeStampValue;
121 private String timeStampFormat;
122 private boolean timeStampFound;
123 private int logEntriesCount;
124 private boolean logEntryFound;
125 private int logEntryNestedCount;
126
127 protected CustomXmlParserInputWizardPage(ISelection selection, CustomXmlTraceDefinition definition) {
128 super("CustomXmlParserWizardPage"); //$NON-NLS-1$
129 if (definition == null) {
130 setTitle(Messages.CustomXmlParserInputWizardPage_titleNew);
131 defaultDescription = Messages.CustomXmlParserInputWizardPage_descriptionNew;
132 } else {
133 setTitle(Messages.CustomXmlParserInputWizardPage_titleEdit);
134 defaultDescription = Messages.CustomXmlParserInputWizardPage_descriptionEdit;
135 }
136 setDescription(defaultDescription);
137 this.selection = selection;
138 this.definition = definition;
139 if (definition != null) {
140 this.editDefinitionName = definition.definitionName;
141 }
142 }
143
144 @Override
145 public void createControl(Composite parent) {
146 container = new Composite(parent, SWT.NULL);
147 container.setLayout(new GridLayout());
148
149 updateListener = new UpdateListener();
150
151 Composite headerComposite = new Composite(container, SWT.FILL);
152 GridLayout headerLayout = new GridLayout(5, false);
153 headerLayout.marginHeight = 0;
154 headerLayout.marginWidth = 0;
155 headerComposite.setLayout(headerLayout);
156 headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
157
158 Label logtypeLabel = new Label(headerComposite, SWT.NULL);
159 logtypeLabel.setText(Messages.CustomXmlParserInputWizardPage_logType);
160
161 logtypeText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);
162 logtypeText.setLayoutData(new GridData(120, SWT.DEFAULT));
163
164 Label timeStampFormatLabel = new Label(headerComposite, SWT.NULL);
165 timeStampFormatLabel.setText(Messages.CustomXmlParserInputWizardPage_timestampFormat);
166
167 timeStampOutputFormatText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);
168 timeStampOutputFormatText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
169 timeStampOutputFormatText.setText(DEFAULT_TIMESTAMP_FORMAT);
170
171 Button dateFormatHelpButton = new Button(headerComposite, SWT.PUSH);
172 dateFormatHelpButton.setImage(helpImage);
173 dateFormatHelpButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_dateFormatHelp);
174 dateFormatHelpButton.addSelectionListener(new SelectionAdapter() {
175 @Override
176 public void widgetSelected(SelectionEvent e) {
177 openHelpShell(SIMPLE_DATE_FORMAT_URL);
178 }
179 });
180
181 Label timeStampPreviewLabel = new Label(headerComposite, SWT.NULL);
182 timeStampPreviewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 3, 1));
183 timeStampPreviewLabel.setText(Messages.CustomXmlParserInputWizardPage_preview);
184
185 timeStampPreviewText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
186 timeStampPreviewText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
187 timeStampPreviewText.setText("*no time stamp element or attribute*"); //$NON-NLS-1$
188
189 createButtonBar();
190
191 SashForm vSash = new SashForm(container, SWT.VERTICAL);
192 vSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
193 vSash.setBackground(vSash.getDisplay().getSystemColor(SWT.COLOR_GRAY));
194
195 SashForm hSash = new SashForm(vSash, SWT.HORIZONTAL);
196 hSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
197
198 treeScrolledComposite = new ScrolledComposite(hSash, SWT.V_SCROLL | SWT.H_SCROLL);
199 treeScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
200 treeContainer = new Composite(treeScrolledComposite, SWT.NONE);
201 treeContainer.setLayout(new FillLayout());
202 treeScrolledComposite.setContent(treeContainer);
203 treeScrolledComposite.setExpandHorizontal(true);
204 treeScrolledComposite.setExpandVertical(true);
205
206 treeViewer = new TreeViewer(treeContainer, SWT.SINGLE | SWT.BORDER);
207 treeViewer.setContentProvider(new InputElementTreeNodeContentProvider());
208 treeViewer.setLabelProvider(new InputElementTreeLabelProvider());
209 treeViewer.addSelectionChangedListener(new InputElementTreeSelectionChangedListener());
210 treeContainer.layout();
211
212 treeScrolledComposite
213 .setMinSize(treeContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, treeContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
214
215 elementScrolledComposite = new ScrolledComposite(hSash, SWT.V_SCROLL);
216 elementScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
217 elementContainer = new Composite(elementScrolledComposite, SWT.NONE);
218 GridLayout gl = new GridLayout();
219 gl.marginHeight = 1;
220 gl.marginWidth = 0;
221 elementContainer.setLayout(gl);
222 elementScrolledComposite.setContent(elementContainer);
223 elementScrolledComposite.setExpandHorizontal(true);
224 elementScrolledComposite.setExpandVertical(true);
225
226 if (definition == null) {
227 definition = new CustomXmlTraceDefinition();
228 }
229 loadDefinition(definition);
230 treeViewer.expandAll();
231 elementContainer.layout();
232
233 logtypeText.addModifyListener(updateListener);
234 timeStampOutputFormatText.addModifyListener(updateListener);
235
236 elementScrolledComposite.setMinSize(elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x,
237 elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
238
239 hSash.setWeights(new int[] { 1, 2 });
240
241 if (definition.rootInputElement == null) {
242 removeButton.setEnabled(false);
243 addChildButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_addDocumentElement);
244 addNextButton.setEnabled(false);
245 moveUpButton.setEnabled(false);
246 moveDownButton.setEnabled(false);
247 } else { // root is selected
248 addNextButton.setEnabled(false);
249 }
250
251 Composite sashBottom = new Composite(vSash, SWT.NONE);
252 GridLayout sashBottomLayout = new GridLayout(2, false);
253 sashBottomLayout.marginHeight = 0;
254 sashBottomLayout.marginWidth = 0;
255 sashBottom.setLayout(sashBottomLayout);
256
257 Label previewLabel = new Label(sashBottom, SWT.NULL);
258 previewLabel.setText(Messages.CustomXmlParserInputWizardPage_previewInput);
259
260 errorText = new Text(sashBottom, SWT.SINGLE | SWT.READ_ONLY);
261 errorText.setBackground(COLOR_WIDGET_BACKGROUND);
262 errorText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
263 errorText.setVisible(false);
264
265 inputText = new StyledText(sashBottom, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
266 if (fixedFont == null) {
267 if (System.getProperty("os.name").contains("Windows")) { //$NON-NLS-1$ //$NON-NLS-2$
268 fixedFont = new Font(Display.getCurrent(), new FontData("Courier New", 10, SWT.NORMAL)); //$NON-NLS-1$
269 } else {
270 fixedFont = new Font(Display.getCurrent(), new FontData("Monospace", 10, SWT.NORMAL)); //$NON-NLS-1$
271 }
272 }
273 inputText.setFont(fixedFont);
274 GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
275 gd.heightHint = inputText.computeSize(SWT.DEFAULT, inputText.getLineHeight() * 4).y;
276 gd.widthHint = 800;
277 inputText.setLayoutData(gd);
278 inputText.setText(getSelectionText());
279 inputText.addModifyListener(new ModifyListener() {
280 @Override
281 public void modifyText(ModifyEvent e) {
282 parseXmlInput(inputText.getText());
283 }
284 });
285 inputText.addModifyListener(updateListener);
286
287 vSash.setWeights(new int[] { hSash.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, sashBottom.computeSize(SWT.DEFAULT, SWT.DEFAULT).y });
288
289 setControl(container);
290 }
291
292 private void createButtonBar() {
293 Composite buttonBar = new Composite(container, SWT.NONE);
294 GridLayout buttonBarLayout = new GridLayout(6, false);
295 buttonBarLayout.marginHeight = 0;
296 buttonBarLayout.marginWidth = 0;
297 buttonBar.setLayout(buttonBarLayout);
298
299 removeButton = new Button(buttonBar, SWT.PUSH);
300 removeButton.setImage(deleteImage);
301 removeButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_removeElement);
302 removeButton.addSelectionListener(new SelectionAdapter() {
303 @Override
304 public void widgetSelected(SelectionEvent e) {
305 if (treeViewer.getSelection().isEmpty() || selectedElement == null)
306 return;
307 removeElement();
308 InputElement inputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
309 if (inputElement == definition.rootInputElement) {
310 definition.rootInputElement = null;
311 } else {
312 inputElement.parentElement.childElements.remove(inputElement);
313 }
314 treeViewer.refresh();
315 validate();
316 updatePreviews();
317 removeButton.setEnabled(false);
318 if (definition.rootInputElement == null) {
319 addChildButton.setEnabled(true);
320 addChildButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_addDocumentEleemnt);
321 } else {
322 addChildButton.setEnabled(false);
323 }
324 addNextButton.setEnabled(false);
325 moveUpButton.setEnabled(false);
326 moveDownButton.setEnabled(false);
327 }
328 });
329
330 addChildButton = new Button(buttonBar, SWT.PUSH);
331 addChildButton.setImage(addChildImage);
332 addChildButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_addChildElement);
333 addChildButton.addSelectionListener(new SelectionAdapter() {
334 @Override
335 public void widgetSelected(SelectionEvent e) {
336 InputElement inputElement = new InputElement("", false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$
337 if (definition.rootInputElement == null) {
338 definition.rootInputElement = inputElement;
339 inputElement.elementName = getChildNameSuggestion(null);
340 } else if (treeViewer.getSelection().isEmpty()) {
341 return;
342 } else {
343 InputElement parentInputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
344 parentInputElement.addChild(inputElement);
345 inputElement.elementName = getChildNameSuggestion(parentInputElement);
346 }
347 treeViewer.refresh();
348 treeViewer.setSelection(new StructuredSelection(inputElement), true);
349 }
350 });
351
352 addNextButton = new Button(buttonBar, SWT.PUSH);
353 addNextButton.setImage(addNextImage);
354 addNextButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_addNextElement);
355 addNextButton.addSelectionListener(new SelectionAdapter() {
356 @Override
357 public void widgetSelected(SelectionEvent e) {
358 InputElement inputElement = new InputElement("", false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$ //$NON-NLS-2$
359 if (definition.rootInputElement == null) {
360 definition.rootInputElement = inputElement;
361 inputElement.elementName = getChildNameSuggestion(null);
362 } else if (treeViewer.getSelection().isEmpty()) {
363 return;
364 } else {
365 InputElement previousInputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
366 if (previousInputElement == definition.rootInputElement) {
367 return;
368 } else {
369 previousInputElement.addNext(inputElement);
370 inputElement.elementName = getChildNameSuggestion(inputElement.parentElement);
371 }
372 }
373 treeViewer.refresh();
374 treeViewer.setSelection(new StructuredSelection(inputElement), true);
375 }
376 });
377
378 feelingLuckyButton = new Button(buttonBar, SWT.PUSH);
379 feelingLuckyButton.setImage(addManyImage);
380 feelingLuckyButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_feelingLucky);
381 feelingLuckyButton.addSelectionListener(new SelectionAdapter() {
382 @Override
383 public void widgetSelected(SelectionEvent e) {
384 InputElement inputElement = null;
385 if (definition.rootInputElement == null) {
386 if (getChildNameSuggestion(null).length() != 0) {
387 inputElement = new InputElement(getChildNameSuggestion(null), false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$
388 definition.rootInputElement = inputElement;
389 feelingLucky(inputElement);
390 } else {
391 return;
392 }
393 } else if (treeViewer.getSelection().isEmpty()) {
394 return;
395 } else {
396 inputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
397 feelingLucky(inputElement);
398 }
399 treeViewer.refresh();
400 treeViewer.setSelection(new StructuredSelection(inputElement), true);
401 treeViewer.expandToLevel(inputElement, TreeViewer.ALL_LEVELS);
402 }
403 });
404
405 moveUpButton = new Button(buttonBar, SWT.PUSH);
406 moveUpButton.setImage(moveUpImage);
407 moveUpButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_moveUp);
408 moveUpButton.addSelectionListener(new SelectionAdapter() {
409 @Override
410 public void widgetSelected(SelectionEvent e) {
411 if (treeViewer.getSelection().isEmpty())
412 return;
413 InputElement inputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
414 if (inputElement == definition.rootInputElement) {
415 return;
416 } else {
417 inputElement.moveUp();
418 }
419 treeViewer.refresh();
420 validate();
421 updatePreviews();
422 }
423 });
424
425 moveDownButton = new Button(buttonBar, SWT.PUSH);
426 moveDownButton.setImage(moveDownImage);
427 moveDownButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_moveDown);
428 moveDownButton.addSelectionListener(new SelectionAdapter() {
429 @Override
430 public void widgetSelected(SelectionEvent e) {
431 if (treeViewer.getSelection().isEmpty())
432 return;
433 InputElement inputElement = (InputElement) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
434 if (inputElement == definition.rootInputElement) {
435 return;
436 } else {
437 inputElement.moveDown();
438 }
439 treeViewer.refresh();
440 validate();
441 updatePreviews();
442 }
443 });
444 }
445
446 private void feelingLucky(InputElement inputElement) {
447 while (true) {
448 String attributeName = getAttributeNameSuggestion(inputElement);
449 if (attributeName.length() == 0) {
450 break;
451 } else {
452 InputAttribute attribute = new InputAttribute(attributeName, attributeName, 0, ""); //$NON-NLS-1$
453 inputElement.addAttribute(attribute);
454 }
455 }
456 while (true) {
457 String childName = getChildNameSuggestion(inputElement);
458 if (childName.length() == 0) {
459 break;
460 } else {
461 InputElement childElement = new InputElement(childName, false, CustomXmlTraceDefinition.TAG_IGNORE, 0, "", null); //$NON-NLS-1$
462 inputElement.addChild(childElement);
463 feelingLucky(childElement);
464 }
465 }
466 }
467
468 private class InputElementTreeNodeContentProvider implements ITreeContentProvider {
469
470 @Override
471 public Object[] getElements(Object inputElement) {
472 CustomXmlTraceDefinition def = (CustomXmlTraceDefinition) inputElement;
473 if (def.rootInputElement != null) {
474 return new Object[] { def.rootInputElement };
475 } else {
476 return new Object[0];
477 }
478 }
479
480 @Override
481 public Object[] getChildren(Object parentElement) {
482 InputElement inputElement = (InputElement) parentElement;
483 if (inputElement.childElements == null)
484 return new InputElement[0];
485 return inputElement.childElements.toArray();
486 }
487
488 @Override
489 public boolean hasChildren(Object element) {
490 InputElement inputElement = (InputElement) element;
491 return (inputElement.childElements != null && inputElement.childElements.size() > 0);
492 }
493
494 @Override
495 public void dispose() {
496 }
497
498 @Override
499 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
500 }
501
502 @Override
503 public Object getParent(Object element) {
504 InputElement inputElement = (InputElement) element;
505 return inputElement.parentElement;
506 }
507 }
508
509 private class InputElementTreeLabelProvider extends ColumnLabelProvider {
510
511 @Override
512 public Image getImage(Object element) {
513 return elementImage;
514 }
515
516 @Override
517 public String getText(Object element) {
518 InputElement inputElement = (InputElement) element;
519 return (inputElement.elementName.trim().length() == 0) ? "?" : inputElement.elementName; //$NON-NLS-1$
520 }
521 }
522
523 private class InputElementTreeSelectionChangedListener implements ISelectionChangedListener {
524 @Override
525 public void selectionChanged(SelectionChangedEvent event) {
526 if (selectedElement != null) {
527 selectedElement.dispose();
528 }
529 if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {
530 IStructuredSelection selection = (IStructuredSelection) event.getSelection();
531 InputElement inputElement = (InputElement) selection.getFirstElement();
532 selectedElement = new ElementNode(elementContainer, inputElement);
533 elementContainer.layout();
534 elementScrolledComposite.setMinSize(elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x,
535 elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
536 container.layout();
537 validate();
538 updatePreviews();
539 removeButton.setEnabled(true);
540 addChildButton.setEnabled(true);
541 addChildButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_addChildElement);
542 if (definition.rootInputElement == inputElement) {
543 addNextButton.setEnabled(false);
544 } else {
545 addNextButton.setEnabled(true);
546 }
547 moveUpButton.setEnabled(true);
548 moveDownButton.setEnabled(true);
549 } else {
550 removeButton.setEnabled(false);
551 if (definition.rootInputElement == null) {
552 addChildButton.setEnabled(true);
553 addChildButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_addDocumentElement);
554 } else {
555 addChildButton.setEnabled(false);
556 }
557 addNextButton.setEnabled(false);
558 moveUpButton.setEnabled(false);
559 moveDownButton.setEnabled(false);
560 }
561 }
562 }
563
564 /*
565 * (non-Javadoc)
566 *
567 * @see org.eclipse.jface.dialogs.DialogPage#dispose()
568 */
569 @Override
570 public void dispose() {
571 if (fixedFont != null) {
572 fixedFont.dispose();
573 fixedFont = null;
574 }
575 super.dispose();
576 }
577
578 private void loadDefinition(CustomXmlTraceDefinition def) {
579 logtypeText.setText(def.definitionName);
580 timeStampOutputFormatText.setText(def.timeStampOutputFormat);
581 treeViewer.setInput(def);
582
583 if (def.rootInputElement != null) {
584 treeViewer.setSelection(new StructuredSelection(def.rootInputElement));
585 }
586 }
587
588 private String getName(InputElement inputElement) {
589 String name = (inputElement.elementName.trim().length() == 0) ? "?" : inputElement.elementName.trim(); //$NON-NLS-1$
590 if (inputElement.parentElement == null) {
591 return name;
592 }
593 return getName(inputElement.parentElement) + " : " + name; //$NON-NLS-1$
594 }
595
596 private String getName(InputAttribute inputAttribute, InputElement inputElement) {
597 String name = (inputAttribute.attributeName.trim().length() == 0) ? "?" : inputAttribute.attributeName.trim(); //$NON-NLS-1$
598 return getName(inputElement) + " : " + name; //$NON-NLS-1$
599 }
600
601 /*
602 * (non-Javadoc)
603 *
604 * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
605 */
606 @Override
607 public void setVisible(boolean visible) {
608 if (visible) {
609 validate();
610 updatePreviews();
611 }
612 super.setVisible(visible);
613 }
614
615 public List<String> getInputNames() {
616 return getInputNames(definition.rootInputElement);
617 }
618
619 public List<String> getInputNames(InputElement inputElement) {
620 List<String> inputs = new ArrayList<String>();
621 if (inputElement.inputName != null && !inputElement.inputName.equals(CustomXmlTraceDefinition.TAG_IGNORE)) {
622 String inputName = inputElement.inputName;
623 if (!inputs.contains(inputName)) {
624 inputs.add(inputName);
625 }
626 }
627 if (inputElement.attributes != null) {
628 for (InputAttribute attribute : inputElement.attributes) {
629 String inputName = attribute.inputName;
630 if (!inputs.contains(inputName)) {
631 inputs.add(inputName);
632 }
633 }
634 }
635 if (inputElement.childElements != null) {
636 for (InputElement childInputElement : inputElement.childElements) {
637 for (String inputName : getInputNames(childInputElement)) {
638 if (!inputs.contains(inputName)) {
639 inputs.add(inputName);
640 }
641 }
642 }
643 }
644 return inputs;
645 }
646
647 private void removeElement() {
648 selectedElement.dispose();
649 selectedElement = null;
650 elementContainer.layout();
651 elementScrolledComposite.setMinSize(elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x,
652 elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
653 container.layout();
654 }
655
656 private String getSelectionText() {
657 InputStream inputStream = null;
658 if (this.selection instanceof IStructuredSelection) {
659 Object selection = ((IStructuredSelection) this.selection).getFirstElement();
660 if (selection instanceof IFile) {
661 IFile file = (IFile) selection;
662 try {
663 inputStream = file.getContents();
664 } catch (CoreException e) {
665 return ""; //$NON-NLS-1$
666 }
667 }
668 }
669 if (inputStream != null) {
670 try {
671 BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
672 StringBuilder sb = new StringBuilder();
673 String line = null;
674 while ((line = reader.readLine()) != null) {
675 sb.append(line + "\n"); //$NON-NLS-1$
676 }
677 parseXmlInput(sb.toString());
678 return sb.toString();
679 } catch (IOException e) {
680 return ""; //$NON-NLS-1$
681 }
682 }
683 return ""; //$NON-NLS-1$
684 }
685
686 private void parseXmlInput(final String string) {
687 try {
688 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
689 DocumentBuilder db = dbf.newDocumentBuilder();
690
691 // The following allows xml parsing without access to the dtd
692 EntityResolver resolver = new EntityResolver() {
693 @Override
694 public InputSource resolveEntity(String publicId, String systemId) {
695 String empty = ""; //$NON-NLS-1$
696 ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
697 return new InputSource(bais);
698 }
699 };
700 db.setEntityResolver(resolver);
701
702 // The following catches xml parsing exceptions
703 db.setErrorHandler(new ErrorHandler() {
704 @Override
705 public void error(SAXParseException saxparseexception) throws SAXException {
706 }
707
708 @Override
709 public void warning(SAXParseException saxparseexception) throws SAXException {
710 }
711
712 @Override
713 public void fatalError(SAXParseException saxparseexception) throws SAXException {
714 if (string.trim().length() != 0) {
715 errorText.setText(saxparseexception.getMessage());
716 errorText.setBackground(COLOR_LIGHT_RED);
717 errorText.setVisible(true);
718 }
719 throw saxparseexception;
720 }
721 });
722
723 errorText.setVisible(false);
724 Document doc = null;
725 doc = db.parse(new ByteArrayInputStream(string.getBytes()));
726 documentElement = doc.getDocumentElement();
727 } catch (ParserConfigurationException e) {
728 e.printStackTrace();
729 documentElement = null;
730 } catch (SAXException e) {
731 documentElement = null;
732 } catch (IOException e) {
733 e.printStackTrace();
734 documentElement = null;
735 }
736 }
737
738 private void updatePreviews() {
739 updatePreviews(false);
740 }
741
742 private void updatePreviews(boolean updateAll) {
743 if (inputText == null) {
744 // early update during construction
745 return;
746 }
747 inputText.setStyleRanges(new StyleRange[] {});
748 if (selectedElement == null) {
749 return;
750 }
751
752 timeStampValue = null;
753 timeStampFormat = null;
754 logEntriesCount = 0;
755 logEntryFound = false;
756
757 selectedElement.updatePreview();
758
759 if (timeStampValue != null && timeStampFormat != null) {
760 try {
761 SimpleDateFormat dateFormat = new SimpleDateFormat(timeStampFormat);
762 Date date = dateFormat.parse(timeStampValue);
763 dateFormat = new SimpleDateFormat(timeStampOutputFormatText.getText().trim());
764 timeStampPreviewText.setText(dateFormat.format(date));
765 } catch (ParseException e) {
766 timeStampPreviewText.setText("*parse exception* [" + timeStampValue + "] <> [" + timeStampFormat + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
767 } catch (IllegalArgumentException e) {
768 timeStampPreviewText.setText("*parse exception* [Illegal Argument]"); //$NON-NLS-1$
769 }
770 } else {
771 timeStampPreviewText.setText("*no matching time stamp*"); //$NON-NLS-1$
772 }
773 }
774
775 private void openHelpShell(String url) {
776 if (helpBrowser != null && !helpBrowser.isDisposed()) {
777 helpBrowser.getShell().setActive();
778 if (!helpBrowser.getUrl().equals(url)) {
779 helpBrowser.setUrl(url);
780 }
781 return;
782 }
783 final Shell helpShell = new Shell(getShell(), SWT.SHELL_TRIM);
784 helpShell.setLayout(new FillLayout());
785 helpBrowser = new Browser(helpShell, SWT.NONE);
786 helpBrowser.addTitleListener(new TitleListener() {
787 @Override
788 public void changed(TitleEvent event) {
789 helpShell.setText(event.title);
790 }
791 });
792 helpBrowser.setBounds(0, 0, 600, 400);
793 helpShell.pack();
794 helpShell.open();
795 helpBrowser.setUrl(url);
796 }
797
798 private class UpdateListener implements ModifyListener, SelectionListener {
799
800 @Override
801 public void modifyText(ModifyEvent e) {
802 validate();
803 updatePreviews();
804 }
805
806 @Override
807 public void widgetDefaultSelected(SelectionEvent e) {
808 validate();
809 updatePreviews();
810 }
811
812 @Override
813 public void widgetSelected(SelectionEvent e) {
814 validate();
815 updatePreviews();
816 }
817
818 }
819
820 private class ElementNode {
821 final InputElement inputElement;
822 final Group group;
823 ArrayList<Attribute> attributes = new ArrayList<Attribute>();
824 ArrayList<ElementNode> childElements = new ArrayList<ElementNode>();
825 Text elementNameText;
826 Composite tagComposite;
827 Combo tagCombo;
828 Label tagLabel;
829 Text tagText;
830 Combo actionCombo;
831 Label previewLabel;
832 Text previewText;
833 Button logEntryButton;
834 Label fillerLabel;
835 Composite addAttributeComposite;
836 Button addAttributeButton;
837 Label addAttributeLabel;
838
839 public ElementNode(Composite parent, InputElement inputElement) {
840 this.inputElement = inputElement;
841
842 group = new Group(parent, SWT.NONE);
843 GridLayout gl = new GridLayout(2, false);
844 gl.marginHeight = 0;
845 group.setLayout(gl);
846 group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
847 group.setText(getName(inputElement));
848
849 Label label = new Label(group, SWT.NULL);
850 label.setText(Messages.CustomXmlParserInputWizardPage_elementName);
851 label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
852
853 elementNameText = new Text(group, SWT.BORDER | SWT.SINGLE);
854 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
855 gd.widthHint = 0;
856 elementNameText.setLayoutData(gd);
857 elementNameText.addModifyListener(new ModifyListener() {
858 @Override
859 public void modifyText(ModifyEvent e) {
860 ElementNode.this.inputElement.elementName = elementNameText.getText().trim();
861 group.setText(getName(ElementNode.this.inputElement));
862 }
863 });
864 elementNameText.setText(inputElement.elementName);
865 elementNameText.addModifyListener(updateListener);
866
867 if (inputElement.parentElement != null) {
868 previewLabel = new Label(group, SWT.NULL);
869 previewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
870 previewLabel.setText(Messages.CustomXmlParserInputWizardPage_preview);
871
872 previewText = new Text(group, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
873 gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
874 gd.widthHint = 0;
875 previewText.setLayoutData(gd);
876 previewText.setText(Messages.CustomXmlParserInputWizardPage_noMatchingElement);
877 previewText.setBackground(COLOR_WIDGET_BACKGROUND);
878
879 logEntryButton = new Button(group, SWT.CHECK);
880 logEntryButton.setText(Messages.CustomXmlParserInputWizardPage_logEntry);
881 logEntryButton.setSelection(inputElement.logEntry);
882 logEntryButton.addSelectionListener(new SelectionListener() {
883 @Override
884 public void widgetDefaultSelected(SelectionEvent e) {
885 }
886
887 @Override
888 public void widgetSelected(SelectionEvent e) {
889 InputElement parent = ElementNode.this.inputElement.parentElement;
890 while (parent != null) {
891 parent.logEntry = false;
892 parent = parent.parentElement;
893 }
894 }
895 });
896 logEntryButton.addSelectionListener(updateListener);
897
898 tagComposite = new Composite(group, SWT.FILL);
899 GridLayout tagLayout = new GridLayout(4, false);
900 tagLayout.marginWidth = 0;
901 tagLayout.marginHeight = 0;
902 tagComposite.setLayout(tagLayout);
903 tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
904
905 tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
906 tagCombo.setItems(new String[] { CustomXmlTraceDefinition.TAG_IGNORE, CustomXmlTraceDefinition.TAG_TIMESTAMP,
907 CustomXmlTraceDefinition.TAG_MESSAGE, CustomXmlTraceDefinition.TAG_OTHER });
908 tagCombo.setVisibleItemCount(tagCombo.getItemCount());
909 tagCombo.addSelectionListener(new SelectionListener() {
910 @Override
911 public void widgetDefaultSelected(SelectionEvent e) {
912 }
913
914 @Override
915 public void widgetSelected(SelectionEvent e) {
916 tagText.removeModifyListener(updateListener);
917 switch (tagCombo.getSelectionIndex()) {
918 case 0: // Ignore
919 tagLabel.setVisible(false);
920 tagText.setVisible(false);
921 actionCombo.setVisible(false);
922 break;
923 case 1: // Time Stamp
924 tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);
925 tagLabel.setVisible(true);
926 tagText.setVisible(true);
927 tagText.addModifyListener(updateListener);
928 actionCombo.setVisible(true);
929 break;
930 case 2: // Message
931 tagLabel.setVisible(false);
932 tagText.setVisible(false);
933 actionCombo.setVisible(true);
934 break;
935 case 3: // Other
936 tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);
937 tagLabel.setVisible(true);
938 if (tagText.getText().trim().length() == 0) {
939 tagText.setText(elementNameText.getText().trim());
940 }
941 tagText.setVisible(true);
942 tagText.addModifyListener(updateListener);
943 actionCombo.setVisible(true);
944 break;
945 }
946 tagComposite.layout();
947 validate();
948 updatePreviews();
949 }
950 });
951
952 tagLabel = new Label(tagComposite, SWT.NULL);
953 tagLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
954
955 tagText = new Text(tagComposite, SWT.BORDER | SWT.SINGLE);
956 gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
957 gd.widthHint = 0;
958 tagText.setLayoutData(gd);
959
960 actionCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
961 actionCombo.setItems(new String[] { Messages.CustomXmlParserInputWizardPage_set, Messages.CustomXmlParserInputWizardPage_append,
962 Messages.CustomXmlParserInputWizardPage_appendWith });
963 actionCombo.select(inputElement.inputAction);
964 actionCombo.addSelectionListener(updateListener);
965
966 if (inputElement.inputName.equals(CustomXmlTraceDefinition.TAG_IGNORE)) {
967 tagCombo.select(0);
968 tagLabel.setVisible(false);
969 tagText.setVisible(false);
970 actionCombo.setVisible(false);
971 } else if (inputElement.inputName.equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {
972 tagCombo.select(1);
973 tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);
974 tagText.setText(inputElement.inputFormat);
975 tagText.addModifyListener(updateListener);
976 } else if (inputElement.inputName.equals(CustomXmlTraceDefinition.TAG_MESSAGE)) {
977 tagCombo.select(2);
978 tagLabel.setVisible(false);
979 tagText.setVisible(false);
980 } else {
981 tagCombo.select(3);
982 tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);
983 tagText.setText(inputElement.inputName);
984 tagText.addModifyListener(updateListener);
985 }
986 }
987
988 if (inputElement.attributes != null) {
989 for (InputAttribute inputAttribute : inputElement.attributes) {
990 Attribute attribute = new Attribute(group, this, inputAttribute, attributes.size() + 1);
991 attributes.add(attribute);
992 }
993 }
994
995 createAddButton();
996 }
997
998 private void updatePreview() {
999 Element element = getPreviewElement(inputElement);
1000 if (inputElement.parentElement != null) { // no preview text for
1001 // document element
1002 previewText.setText(Messages.CustomXmlParserInputWizardPage_noMatchingElement);
1003 if (element != null) {
1004 previewText.setText(CustomXmlTrace.parseElement(element, new StringBuffer()).toString());
1005 if (logEntryButton.getSelection()) {
1006 if (logEntryFound == false) {
1007 logEntryFound = true;
1008 logEntriesCount++;
1009 } else {
1010 logEntryButton.setSelection(false); // remove nested
1011 // log entry
1012 }
1013 }
1014 if (tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_TIMESTAMP) && logEntriesCount <= 1) {
1015 String value = previewText.getText().trim();
1016 if (value.length() != 0) {
1017 if (actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_SET) {
1018 timeStampValue = value;
1019 timeStampFormat = tagText.getText().trim();
1020 } else if (actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_APPEND) {
1021 if (timeStampValue != null) {
1022 timeStampValue += value;
1023 timeStampFormat += tagText.getText().trim();
1024 } else {
1025 timeStampValue = value;
1026 timeStampFormat = tagText.getText().trim();
1027 }
1028 } else if (actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
1029 if (timeStampValue != null) {
1030 timeStampValue += " | " + value; //$NON-NLS-1$
1031 timeStampFormat += " | " + tagText.getText().trim(); //$NON-NLS-1$
1032 } else {
1033 timeStampValue = value;
1034 timeStampFormat = tagText.getText().trim();
1035 }
1036 }
1037 }
1038 }
1039 }
1040 }
1041 for (Attribute attribute : attributes) {
1042 if (element != null) {
1043 String value = element.getAttribute(attribute.attributeNameText.getText().trim());
1044 if (value.length() != 0) {
1045 attribute.previewText.setText(value);
1046 if (attribute.tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_TIMESTAMP) && logEntriesCount <= 1) {
1047 if (attribute.actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_SET) {
1048 timeStampValue = value;
1049 timeStampFormat = attribute.tagText.getText().trim();
1050 } else if (attribute.actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_APPEND) {
1051 if (timeStampValue != null) {
1052 timeStampValue += value;
1053 timeStampFormat += attribute.tagText.getText().trim();
1054 } else {
1055 timeStampValue = value;
1056 timeStampFormat = attribute.tagText.getText().trim();
1057 }
1058 } else if (attribute.actionCombo.getSelectionIndex() == CustomXmlTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
1059 if (timeStampValue != null) {
1060 timeStampValue += " | " + value; //$NON-NLS-1$
1061 timeStampFormat += " | " + attribute.tagText.getText().trim(); //$NON-NLS-1$
1062 } else {
1063 timeStampValue = value;
1064 timeStampFormat = attribute.tagText.getText().trim();
1065 }
1066 }
1067 }
1068 } else {
1069 attribute.previewText.setText(Messages.CustomXmlParserInputWizardPage_noMatchingAttribute);
1070 }
1071 } else {
1072 attribute.previewText.setText(Messages.CustomXmlParserInputWizardPage_noMatchingElement);
1073 }
1074 }
1075 for (ElementNode child : childElements) {
1076 child.updatePreview();
1077 }
1078 if (logEntryButton != null && logEntryButton.getSelection()) {
1079 logEntryFound = false;
1080 }
1081 }
1082
1083 private void createAddButton() {
1084 fillerLabel = new Label(group, SWT.NONE);
1085
1086 addAttributeComposite = new Composite(group, SWT.NONE);
1087 addAttributeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1088 GridLayout addAttributeLayout = new GridLayout(2, false);
1089 addAttributeLayout.marginHeight = 0;
1090 addAttributeLayout.marginWidth = 0;
1091 addAttributeComposite.setLayout(addAttributeLayout);
1092
1093 addAttributeButton = new Button(addAttributeComposite, SWT.PUSH);
1094 addAttributeButton.setImage(addImage);
1095 addAttributeButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_addAttribute);
1096 addAttributeButton.addSelectionListener(new SelectionAdapter() {
1097 @Override
1098 public void widgetSelected(SelectionEvent e) {
1099 removeAddButton();
1100 String attributeName = getAttributeNameSuggestion(inputElement);
1101 InputAttribute inputAttribute = new InputAttribute(attributeName, attributeName, 0, ""); //$NON-NLS-1$
1102 attributes.add(new Attribute(group, ElementNode.this, inputAttribute, attributes.size() + 1));
1103 createAddButton();
1104 elementContainer.layout();
1105 elementScrolledComposite.setMinSize(elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x,
1106 elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
1107 group.getParent().layout();
1108 validate();
1109 updatePreviews();
1110 }
1111 });
1112
1113 addAttributeLabel = new Label(addAttributeComposite, SWT.NULL);
1114 addAttributeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1115 addAttributeLabel.setText(Messages.CustomXmlParserInputWizardPage_newAttibute);
1116 }
1117
1118 private void removeAddButton() {
1119 fillerLabel.dispose();
1120 addAttributeComposite.dispose();
1121 }
1122
1123 private void removeAttribute(int attributeNumber) {
1124 if (--attributeNumber < attributes.size()) {
1125 attributes.remove(attributeNumber).dispose();
1126 for (int i = attributeNumber; i < attributes.size(); i++) {
1127 attributes.get(i).setAttributeNumber(i + 1);
1128 }
1129 elementContainer.layout();
1130 elementScrolledComposite.setMinSize(elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x,
1131 elementContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
1132 group.getParent().layout();
1133 }
1134 }
1135
1136 private void dispose() {
1137 group.dispose();
1138 }
1139
1140 private void extractInputs() {
1141 inputElement.elementName = elementNameText.getText().trim();
1142 if (inputElement.parentElement != null) {
1143 inputElement.logEntry = logEntryButton.getSelection();
1144 if (tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_OTHER)) {
1145 inputElement.inputName = tagText.getText().trim();
1146 } else {
1147 inputElement.inputName = tagCombo.getText();
1148 if (tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {
1149 inputElement.inputFormat = tagText.getText().trim();
1150 }
1151 }
1152 inputElement.inputAction = actionCombo.getSelectionIndex();
1153 }
1154 inputElement.attributes = new ArrayList<InputAttribute>(attributes.size());
1155 for (int i = 0; i < attributes.size(); i++) {
1156 Attribute attribute = attributes.get(i);
1157 InputAttribute inputAttribute = new InputAttribute();
1158 inputAttribute.attributeName = attribute.attributeNameText.getText().trim();
1159 if (attribute.tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_OTHER)) {
1160 inputAttribute.inputName = attribute.tagText.getText().trim();
1161 } else {
1162 inputAttribute.inputName = attribute.tagCombo.getText();
1163 if (attribute.tagCombo.getText().equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {
1164 inputAttribute.inputFormat = attribute.tagText.getText().trim();
1165 }
1166 }
1167 inputAttribute.inputAction = attribute.actionCombo.getSelectionIndex();
1168 inputElement.addAttribute(inputAttribute);
1169 }
1170 }
1171 }
1172
1173 private class Attribute {
1174 ElementNode element;
1175 int attributeNumber;
1176
1177 // children of parent (must be disposed)
1178 Composite labelComposite;
1179 Composite attributeComposite;
1180 Label filler;
1181 Composite tagComposite;
1182
1183 // children of labelComposite
1184 Label attributeLabel;
1185
1186 // children of attributeComposite
1187 Text attributeNameText;
1188 Text previewText;
1189
1190 // children of tagComposite
1191 Combo tagCombo;
1192 Label tagLabel;
1193 Text tagText;
1194 Combo actionCombo;
1195
1196 public Attribute(Composite parent, ElementNode element, InputAttribute inputAttribute, int attributeNumber) {
1197 this.element = element;
1198 this.attributeNumber = attributeNumber;
1199
1200 labelComposite = new Composite(parent, SWT.FILL);
1201 GridLayout labelLayout = new GridLayout(2, false);
1202 labelLayout.marginWidth = 0;
1203 labelLayout.marginHeight = 0;
1204 labelComposite.setLayout(labelLayout);
1205 labelComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1206
1207 Button deleteButton = new Button(labelComposite, SWT.PUSH);
1208 deleteButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1209 deleteButton.setImage(deleteImage);
1210 deleteButton.setToolTipText(Messages.CustomXmlParserInputWizardPage_removeAttribute);
1211 deleteButton.addSelectionListener(new SelectionAdapter() {
1212 @Override
1213 public void widgetSelected(SelectionEvent e) {
1214 Attribute.this.element.removeAttribute(Attribute.this.attributeNumber);
1215 validate();
1216 updatePreviews();
1217 }
1218 });
1219
1220 attributeLabel = new Label(labelComposite, SWT.NULL);
1221 attributeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1222 attributeLabel.setText(Messages.CustomXmlParserInputWizardPage_attibute);
1223
1224 attributeComposite = new Composite(parent, SWT.FILL);
1225 GridLayout attributeLayout = new GridLayout(4, false);
1226 attributeLayout.marginWidth = 0;
1227 attributeLayout.marginHeight = 0;
1228 attributeComposite.setLayout(attributeLayout);
1229 attributeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1230
1231 Label nameLabel = new Label(attributeComposite, SWT.NONE);
1232 nameLabel.setText(Messages.CustomXmlParserInputWizardPage_name);
1233
1234 attributeNameText = new Text(attributeComposite, SWT.BORDER | SWT.SINGLE);
1235 attributeNameText.setLayoutData(new GridData(120, SWT.DEFAULT));
1236 attributeNameText.setText(inputAttribute.attributeName);
1237 attributeNameText.addModifyListener(updateListener);
1238
1239 Label previewLabel = new Label(attributeComposite, SWT.NONE);
1240 previewLabel.setText(Messages.CustomXmlParserInputWizardPage_preview);
1241
1242 previewText = new Text(attributeComposite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
1243 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
1244 gd.widthHint = 0;
1245 previewText.setLayoutData(gd);
1246 previewText.setText(Messages.CustomXmlParserInputWizardPage_noMatch);
1247 previewText.setBackground(COLOR_WIDGET_BACKGROUND);
1248
1249 filler = new Label(parent, SWT.NULL);
1250
1251 tagComposite = new Composite(parent, SWT.FILL);
1252 GridLayout tagLayout = new GridLayout(4, false);
1253 tagLayout.marginWidth = 0;
1254 tagLayout.marginHeight = 0;
1255 tagComposite.setLayout(tagLayout);
1256 tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1257
1258 tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
1259 tagCombo.setItems(new String[] { CustomXmlTraceDefinition.TAG_TIMESTAMP, CustomXmlTraceDefinition.TAG_MESSAGE,
1260 CustomXmlTraceDefinition.TAG_OTHER });
1261 tagCombo.select(2); // Other
1262 tagCombo.addSelectionListener(new SelectionListener() {
1263 @Override
1264 public void widgetDefaultSelected(SelectionEvent e) {
1265 }
1266
1267 @Override
1268 public void widgetSelected(SelectionEvent e) {
1269 tagText.removeModifyListener(updateListener);
1270 switch (tagCombo.getSelectionIndex()) {
1271 case 0: // Time Stamp
1272 tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);
1273 tagLabel.setVisible(true);
1274 tagText.setVisible(true);
1275 tagText.addModifyListener(updateListener);
1276 break;
1277 case 1: // Message
1278 tagLabel.setVisible(false);
1279 tagText.setVisible(false);
1280 break;
1281 case 2: // Other
1282 tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);
1283 tagLabel.setVisible(true);
1284 if (tagText.getText().trim().length() == 0) {
1285 tagText.setText(attributeNameText.getText().trim());
1286 }
1287 tagText.setVisible(true);
1288 tagText.addModifyListener(updateListener);
1289 break;
1290 }
1291 tagComposite.layout();
1292 validate();
1293 updatePreviews();
1294 }
1295 });
1296
1297 tagLabel = new Label(tagComposite, SWT.NULL);
1298 tagLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1299
1300 tagText = new Text(tagComposite, SWT.BORDER | SWT.SINGLE);
1301 gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
1302 gd.widthHint = 0;
1303 tagText.setLayoutData(gd);
1304 tagText.setText(attributeNameText.getText());
1305
1306 actionCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
1307 actionCombo.setItems(new String[] { Messages.CustomXmlParserInputWizardPage_set, Messages.CustomXmlParserInputWizardPage_append,
1308 Messages.CustomXmlParserInputWizardPage_appendWith });
1309 actionCombo.select(inputAttribute.inputAction);
1310 actionCombo.addSelectionListener(updateListener);
1311
1312 if (inputAttribute.inputName.equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {
1313 tagCombo.select(0);
1314 tagLabel.setText(Messages.CustomXmlParserInputWizardPage_format);
1315 tagText.setText(inputAttribute.inputFormat);
1316 tagText.addModifyListener(updateListener);
1317 } else if (inputAttribute.inputName.equals(CustomXmlTraceDefinition.TAG_MESSAGE)) {
1318 tagCombo.select(1);
1319 tagLabel.setVisible(false);
1320 tagText.setVisible(false);
1321 } else {
1322 tagCombo.select(2);
1323 tagLabel.setText(Messages.CustomXmlParserInputWizardPage_tagName);
1324 tagText.setText(inputAttribute.inputName);
1325 tagText.addModifyListener(updateListener);
1326 }
1327 }
1328
1329 private void dispose() {
1330 labelComposite.dispose();
1331 attributeComposite.dispose();
1332 filler.dispose();
1333 tagComposite.dispose();
1334 }
1335
1336 private void setAttributeNumber(int attributeNumber) {
1337 this.attributeNumber = attributeNumber;
1338 labelComposite.layout();
1339 }
1340 }
1341
1342 private Element getPreviewElement(InputElement inputElement) {
1343 Element element = documentElement;
1344 if (element != null) {
1345 if (!documentElement.getNodeName().equals(definition.rootInputElement.elementName)) {
1346 return null;
1347 }
1348 ArrayList<String> elementNames = new ArrayList<String>();
1349 while (inputElement != null) {
1350 elementNames.add(inputElement.elementName);
1351 inputElement = inputElement.parentElement;
1352 }
1353 for (int i = elementNames.size() - 1; --i >= 0;) {
1354 NodeList childList = element.getChildNodes();
1355 element = null;
1356 for (int j = 0; j < childList.getLength(); j++) {
1357 Node child = childList.item(j);
1358 if (child instanceof Element && child.getNodeName().equals(elementNames.get(i))) {
1359 element = (Element) child;
1360 break;
1361 }
1362 }
1363 if (element == null) {
1364 break;
1365 }
1366 }
1367 if (element != null) {
1368 return element;
1369 }
1370 }
1371 return null;
1372 }
1373
1374 private String getChildNameSuggestion(InputElement inputElement) {
1375 if (inputElement == null) {
1376 if (documentElement != null) {
1377 return documentElement.getNodeName();
1378 }
1379 } else {
1380 Element element = getPreviewElement(inputElement);
1381 if (element != null) {
1382 NodeList childNodes = element.getChildNodes();
1383 for (int i = 0; i < childNodes.getLength(); i++) {
1384 Node node = childNodes.item(i);
1385 if (node instanceof Element) {
1386 boolean unused = true;
1387 if (inputElement.childElements != null) {
1388 for (InputElement child : inputElement.childElements) {
1389 if (child.elementName.equals(node.getNodeName())) {
1390 unused = false;
1391 break;
1392 }
1393 }
1394 }
1395 if (unused) {
1396 return node.getNodeName();
1397 }
1398 }
1399 }
1400 }
1401 }
1402 return ""; //$NON-NLS-1$
1403 }
1404
1405 private String getAttributeNameSuggestion(InputElement inputElement) {
1406 Element element = getPreviewElement(inputElement);
1407 if (element != null) {
1408 NamedNodeMap attributeMap = element.getAttributes();
1409 for (int i = 0; i < attributeMap.getLength(); i++) {
1410 Node node = attributeMap.item(i);
1411 boolean unused = true;
1412 if (inputElement.attributes != null) {
1413 for (InputAttribute attribute : inputElement.attributes) {
1414 if (attribute.attributeName.equals(node.getNodeName())) {
1415 unused = false;
1416 break;
1417 }
1418 }
1419 }
1420 if (unused) {
1421 return node.getNodeName();
1422 }
1423 }
1424 }
1425 return ""; //$NON-NLS-1$
1426 }
1427
1428 private void validate() {
1429 definition.definitionName = logtypeText.getText().trim();
1430 definition.timeStampOutputFormat = timeStampOutputFormatText.getText().trim();
1431
1432 if (selectedElement != null) {
1433 selectedElement.extractInputs();
1434 treeViewer.refresh();
1435 }
1436
1437 StringBuffer errors = new StringBuffer();
1438
1439 if (definition.definitionName.length() == 0) {
1440 errors.append(Messages.CustomXmlParserInputWizardPage_emptyLogTypeError);
1441 logtypeText.setBackground(COLOR_LIGHT_RED);
1442 } else {
1443 logtypeText.setBackground(COLOR_TEXT_BACKGROUND);
1444 for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {
1445 if (definition.definitionName.equals(def.definitionName)) {
1446 if (editDefinitionName == null || !editDefinitionName.equals(definition.definitionName)) {
1447 errors.append(Messages.CustomXmlParserInputWizardPage_duplicatelogTypeError);
1448 logtypeText.setBackground(COLOR_LIGHT_RED);
1449 break;
1450 }
1451 }
1452 }
1453 }
1454
1455 if (definition.rootInputElement == null) {
1456 errors.append(Messages.CustomXmlParserInputWizardPage_noDocumentError);
1457 }
1458
1459 if (definition.rootInputElement != null) {
1460 logEntryFound = false;
1461 logEntryNestedCount = 0;
1462 timeStampFound = false;
1463
1464 errors.append(validateElement(definition.rootInputElement));
1465
1466 if ((definition.rootInputElement.attributes != null && definition.rootInputElement.attributes.size() != 0)
1467 || (definition.rootInputElement.childElements != null && definition.rootInputElement.childElements.size() != 0)
1468 || errors.length() == 0) {
1469 if (!logEntryFound) {
1470 errors.append(Messages.CustomXmlParserInputWizardPage_missingLogEntryError);
1471 }
1472
1473 if (timeStampFound) {
1474 if (timeStampOutputFormatText.getText().trim().length() == 0) {
1475 errors.append(Messages.CustomXmlParserInputWizardPage_missingTimestampFmtError);
1476 timeStampOutputFormatText.setBackground(COLOR_LIGHT_RED);
1477 } else {
1478 try {
1479 new SimpleDateFormat(timeStampOutputFormatText.getText().trim());
1480 timeStampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
1481 } catch (IllegalArgumentException e) {
1482 errors.append(Messages.CustomXmlParserInputWizardPage_invalidTimestampFmtError);
1483 timeStampOutputFormatText.setBackground(COLOR_LIGHT_RED);
1484 }
1485 }
1486 } else {
1487 timeStampPreviewText.setText(Messages.CustomXmlParserInputWizardPage_notimestamporAttributeError);
1488 }
1489 }
1490 } else {
1491 timeStampPreviewText.setText(Messages.CustomXmlParserInputWizardPage_notimestamporAttributeError);
1492 }
1493
1494 if (errors.length() == 0) {
1495 setDescription(defaultDescription);
1496 setPageComplete(true);
1497 } else {
1498 setDescription(errors.toString());
1499 setPageComplete(false);
1500 }
1501 }
1502
1503 public StringBuffer validateElement(InputElement inputElement) {
1504 StringBuffer errors = new StringBuffer();
1505 ElementNode elementNode = null;
1506 if (selectedElement != null && selectedElement.inputElement.equals(inputElement))
1507 elementNode = selectedElement;
1508 if (inputElement == definition.rootInputElement) {
1509 if (inputElement.elementName.length() == 0) {
1510 errors.append(Messages.CustomXmlParserInputWizardPage_missingDocumentElementError);
1511 if (elementNode != null)
1512 elementNode.elementNameText.setBackground(COLOR_LIGHT_RED);
1513 } else {
1514 if (elementNode != null)
1515 elementNode.elementNameText.setBackground(COLOR_TEXT_BACKGROUND);
1516 }
1517 }
1518 if (inputElement != definition.rootInputElement) {
1519 if (inputElement.logEntry) {
1520 logEntryFound = true;
1521 logEntryNestedCount++;
1522 }
1523 if (inputElement.inputName.equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {
1524 timeStampFound = true;
1525 if (inputElement.inputFormat.length() == 0) {
1526 errors.append(Messages.CustomXmlParserInputWizardPage_timestampFormatPrompt
1527 + " (" + Messages.CustomXmlParserInputWizardPage_timestampElementPrompt + " " + getName(inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1528 if (elementNode != null)
1529 elementNode.tagText.setBackground(COLOR_LIGHT_RED);
1530 } else {
1531 try {
1532 new SimpleDateFormat(inputElement.inputFormat);
1533 if (elementNode != null)
1534 elementNode.tagText.setBackground(COLOR_TEXT_BACKGROUND);
1535 } catch (IllegalArgumentException e) {
1536 errors.append(Messages.CustomXmlParserInputWizardPage_invalidTimestampFmtError
1537 + " (" + Messages.CustomXmlParserInputWizardPage_timestampElementPrompt + " " + getName(inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1538 if (elementNode != null)
1539 elementNode.tagText.setBackground(COLOR_LIGHT_RED);
1540 }
1541 }
1542 } else if (inputElement.inputName.length() == 0) {
1543 errors.append(Messages.CustomXmlParserInputWizardPage_missingInputElementNameError);
1544 if (elementNode != null)
1545 elementNode.tagText.setBackground(COLOR_LIGHT_RED);
1546 } else {
1547 if (elementNode != null)
1548 elementNode.tagText.setBackground(COLOR_TEXT_BACKGROUND);
1549 }
1550 }
1551 if (inputElement.attributes != null) {
1552 if (elementNode != null) {
1553 for (Attribute attribute : elementNode.attributes) {
1554 attribute.attributeNameText.setBackground(COLOR_TEXT_BACKGROUND);
1555 }
1556 }
1557 for (int i = 0; i < inputElement.attributes.size(); i++) {
1558 InputAttribute attribute = inputElement.attributes.get(i);
1559 boolean duplicate = false;
1560 for (int j = i + 1; j < inputElement.attributes.size(); j++) {
1561 InputAttribute otherAttribute = inputElement.attributes.get(j);
1562 if (otherAttribute.attributeName.equals(attribute.attributeName)) {
1563 duplicate = true;
1564 if (elementNode != null) {
1565 elementNode.attributes.get(j).attributeNameText.setBackground(COLOR_LIGHT_RED);
1566 }
1567 }
1568 }
1569 if (attribute.attributeName.length() == 0) {
1570 errors.append(Messages.CustomXmlParserInputWizardPage_missingAttribute
1571 + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(inputElement) + ": ?). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1572 if (elementNode != null)
1573 elementNode.attributes.get(i).attributeNameText.setBackground(COLOR_LIGHT_RED);
1574 } else if (duplicate) {
1575 errors.append(Messages.CustomXmlParserInputWizardPage_duplicateAttributeError
1576 + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1577 if (elementNode != null)
1578 elementNode.attributes.get(i).attributeNameText.setBackground(COLOR_LIGHT_RED);
1579 }
1580 if (attribute.inputName.equals(CustomXmlTraceDefinition.TAG_TIMESTAMP)) {
1581 timeStampFound = true;
1582 if (attribute.inputFormat.length() == 0) {
1583 errors.append(Messages.CustomXmlParserInputWizardPage_missingTimestampInFmtError
1584 + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1585 if (elementNode != null)
1586 elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED);
1587 } else {
1588 try {
1589 new SimpleDateFormat(attribute.inputFormat);
1590 if (elementNode != null)
1591 elementNode.attributes.get(i).tagText.setBackground(COLOR_TEXT_BACKGROUND);
1592 } catch (IllegalArgumentException e) {
1593 errors.append(Messages.CustomXmlParserInputWizardPage_invalidTimestampInFmtError
1594 + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1595 if (elementNode != null)
1596 elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED);
1597 }
1598 }
1599 } else if (attribute.inputName.length() == 0) {
1600 errors.append(Messages.CustomXmlParserInputWizardPage_missingDataGroupNameError
1601 + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(attribute, inputElement) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1602 if (elementNode != null)
1603 elementNode.attributes.get(i).tagText.setBackground(COLOR_LIGHT_RED);
1604 } else {
1605 if (elementNode != null)
1606 elementNode.attributes.get(i).tagText.setBackground(COLOR_TEXT_BACKGROUND);
1607 }
1608 }
1609 }
1610 if (inputElement.childElements != null) {
1611 for (InputElement child : inputElement.childElements) {
1612 ElementNode childElementNode = null;
1613 if (selectedElement != null && selectedElement.inputElement.equals(child))
1614 childElementNode = selectedElement;
1615 if (childElementNode != null)
1616 childElementNode.elementNameText.setBackground(COLOR_TEXT_BACKGROUND);
1617 }
1618 for (int i = 0; i < inputElement.childElements.size(); i++) {
1619 InputElement child = inputElement.childElements.get(i);
1620 ElementNode childElementNode = null;
1621 if (selectedElement != null && selectedElement.inputElement.equals(child))
1622 childElementNode = selectedElement;
1623 if (child.elementName.length() == 0) {
1624 errors.append(Messages.CustomXmlParserInputWizardPage_missingElementNameError
1625 + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(child) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1626 if (childElementNode != null)
1627 childElementNode.elementNameText.setBackground(COLOR_LIGHT_RED);
1628 } else {
1629 boolean duplicate = false;
1630 for (int j = i + 1; j < inputElement.childElements.size(); j++) {
1631 InputElement otherChild = inputElement.childElements.get(j);
1632 if (otherChild.elementName.equals(child.elementName)) {
1633 duplicate = true;
1634 ElementNode otherChildElementNode = null;
1635 if (selectedElement != null && selectedElement.inputElement.equals(otherChild))
1636 otherChildElementNode = selectedElement;
1637 if (otherChildElementNode != null)
1638 otherChildElementNode.elementNameText.setBackground(COLOR_LIGHT_RED);
1639 }
1640 }
1641 if (duplicate) {
1642 errors.append(Messages.CustomXmlParserInputWizardPage_duplicateElementNameError
1643 + " (" + Messages.CustomXmlParserInputWizardPage_attributePrompt + " " + getName(child) + "). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1644 if (childElementNode != null)
1645 childElementNode.elementNameText.setBackground(COLOR_LIGHT_RED);
1646 }
1647 }
1648
1649 errors.append(validateElement(child));
1650 }
1651 }
1652 if (inputElement.logEntry) {
1653 logEntryNestedCount--;
1654 }
1655 return errors;
1656 }
1657
1658 public CustomXmlTraceDefinition getDefinition() {
1659 return definition;
1660 }
1661
1662 public char[] getInputText() {
1663 return inputText.getText().toCharArray();
1664 }
1665 }
This page took 0.068575 seconds and 5 git commands to generate.