Fix Sonar warnings in custom parser wizard package
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / wizards / CustomTxtParserInputWizardPage.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2013 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.tmf.ui.parsers.wizards;
14
15 import java.io.BufferedReader;
16 import java.io.IOException;
17 import java.io.InputStreamReader;
18 import java.text.ParseException;
19 import java.text.SimpleDateFormat;
20 import java.util.ArrayList;
21 import java.util.Arrays;
22 import java.util.Date;
23 import java.util.HashMap;
24 import java.util.Iterator;
25 import java.util.List;
26 import java.util.Map;
27 import java.util.Scanner;
28 import java.util.regex.Matcher;
29 import java.util.regex.Pattern;
30 import java.util.regex.PatternSyntaxException;
31
32 import org.eclipse.core.resources.IFile;
33 import org.eclipse.core.runtime.CoreException;
34 import org.eclipse.jface.viewers.ColumnLabelProvider;
35 import org.eclipse.jface.viewers.ISelection;
36 import org.eclipse.jface.viewers.ISelectionChangedListener;
37 import org.eclipse.jface.viewers.IStructuredSelection;
38 import org.eclipse.jface.viewers.ITreeContentProvider;
39 import org.eclipse.jface.viewers.SelectionChangedEvent;
40 import org.eclipse.jface.viewers.StructuredSelection;
41 import org.eclipse.jface.viewers.TreeViewer;
42 import org.eclipse.jface.viewers.Viewer;
43 import org.eclipse.jface.wizard.WizardPage;
44 import org.eclipse.linuxtools.internal.tmf.ui.Activator;
45 import org.eclipse.linuxtools.internal.tmf.ui.Messages;
46 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTraceDefinition;
47 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition;
48 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.Cardinality;
49 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputData;
50 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;
51 import org.eclipse.swt.SWT;
52 import org.eclipse.swt.browser.Browser;
53 import org.eclipse.swt.browser.TitleEvent;
54 import org.eclipse.swt.browser.TitleListener;
55 import org.eclipse.swt.custom.SashForm;
56 import org.eclipse.swt.custom.ScrolledComposite;
57 import org.eclipse.swt.custom.StyleRange;
58 import org.eclipse.swt.custom.StyledText;
59 import org.eclipse.swt.events.ModifyEvent;
60 import org.eclipse.swt.events.ModifyListener;
61 import org.eclipse.swt.events.SelectionAdapter;
62 import org.eclipse.swt.events.SelectionEvent;
63 import org.eclipse.swt.events.SelectionListener;
64 import org.eclipse.swt.events.VerifyEvent;
65 import org.eclipse.swt.events.VerifyListener;
66 import org.eclipse.swt.graphics.Color;
67 import org.eclipse.swt.graphics.Font;
68 import org.eclipse.swt.graphics.FontData;
69 import org.eclipse.swt.graphics.Image;
70 import org.eclipse.swt.layout.FillLayout;
71 import org.eclipse.swt.layout.GridData;
72 import org.eclipse.swt.layout.GridLayout;
73 import org.eclipse.swt.widgets.Button;
74 import org.eclipse.swt.widgets.Combo;
75 import org.eclipse.swt.widgets.Composite;
76 import org.eclipse.swt.widgets.Display;
77 import org.eclipse.swt.widgets.Group;
78 import org.eclipse.swt.widgets.Label;
79 import org.eclipse.swt.widgets.Shell;
80 import org.eclipse.swt.widgets.Text;
81
82 /**
83 * Input wizard page for custom text parsers.
84 *
85 * @author Patrick Tasse
86 */
87 public class CustomTxtParserInputWizardPage extends WizardPage {
88
89 private static final String DEFAULT_REGEX = "\\s*(.*\\S)"; //$NON-NLS-1$
90 private static final String DEFAULT_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
91 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$
92 private static final String PATTERN_URL = "http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html#sum"; //$NON-NLS-1$
93 private static final Image LINE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/line_icon.gif"); //$NON-NLS-1$
94 private static final Image ADD_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/add_button.gif"); //$NON-NLS-1$
95 private static final Image ADD_NEXT_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/addnext_button.gif"); //$NON-NLS-1$
96 private static final Image ADD_CHILD_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/addchild_button.gif"); //$NON-NLS-1$
97 private static final Image DELETE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/delete_button.gif"); //$NON-NLS-1$
98 private static final Image MOVE_UP_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/moveup_button.gif"); //$NON-NLS-1$
99 private static final Image MOVE_DOWN_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/movedown_button.gif"); //$NON-NLS-1$
100 private static final Image HELP_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/help_button.gif"); //$NON-NLS-1$
101 private static final Color COLOR_BLACK = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
102 private static final Color COLOR_LIGHT_GREEN = new Color(Display.getDefault(), 192, 255, 192);
103 private static final Color COLOR_GREEN = Display.getDefault().getSystemColor(SWT.COLOR_GREEN);
104 private static final Color COLOR_LIGHT_YELLOW = new Color(Display.getDefault(), 255, 255, 192);
105 private static final Color COLOR_YELLOW = Display.getDefault().getSystemColor(SWT.COLOR_YELLOW);
106 private static final Color COLOR_LIGHT_MAGENTA = new Color(Display.getDefault(), 255, 192, 255);
107 private static final Color COLOR_MAGENTA = Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA);
108 private static final Color COLOR_LIGHT_RED = new Color(Display.getDefault(), 255, 192, 192);
109 private static final Color COLOR_TEXT_BACKGROUND = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
110 private static final Color COLOR_WIDGET_BACKGROUND = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
111
112 private final ISelection selection;
113 private CustomTxtTraceDefinition definition;
114 private String editDefinitionName;
115 private String defaultDescription;
116 private Line selectedLine;
117 private Composite container;
118 private Text logtypeText;
119 private Text timestampOutputFormatText;
120 private Text timestampPreviewText;
121 private ScrolledComposite lineScrolledComposite;
122 private TreeViewer treeViewer;
123 private Composite lineContainer;
124 private StyledText inputText;
125 private Font fixedFont;
126 private UpdateListener updateListener;
127 private Browser helpBrowser;
128
129 // variables used recursively through line traversal
130 private String timeStampFormat;
131 private boolean timestampFound;
132
133 /**
134 * Constructor
135 *
136 * @param selection
137 * The Selection object
138 * @param definition
139 * The trace definition
140 */
141 protected CustomTxtParserInputWizardPage(ISelection selection,
142 CustomTxtTraceDefinition definition) {
143 super("CustomParserWizardPage"); //$NON-NLS-1$
144 if (definition == null) {
145 setTitle(Messages.CustomTxtParserInputWizardPage_windowTitleNew);
146 defaultDescription = Messages.CustomTxtParserInputWizardPage_descriptionNew;
147 } else {
148 setTitle(Messages.CustomTxtParserInputWizardPage_windowTitleEdit);
149 defaultDescription = Messages.CustomTxtParserInputWizardPage_desccriptionEdit;
150 }
151 setDescription(defaultDescription);
152 this.selection = selection;
153 this.definition = definition;
154 if (definition != null) {
155 this.editDefinitionName = definition.definitionName;
156 }
157 }
158
159 @Override
160 public void createControl(Composite parent) {
161 container = new Composite(parent, SWT.NULL);
162 container.setLayout(new GridLayout());
163
164 updateListener = new UpdateListener();
165
166 Composite headerComposite = new Composite(container, SWT.FILL);
167 GridLayout headerLayout = new GridLayout(5, false);
168 headerLayout.marginHeight = 0;
169 headerLayout.marginWidth = 0;
170 headerComposite.setLayout(headerLayout);
171 headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
172
173 Label logtypeLabel = new Label(headerComposite, SWT.NULL);
174 logtypeLabel.setText(Messages.CustomTxtParserInputWizardPage_logType);
175
176 logtypeText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);
177 logtypeText.setLayoutData(new GridData(120, SWT.DEFAULT));
178
179 Label timestampFormatLabel = new Label(headerComposite, SWT.NULL);
180 timestampFormatLabel.setText(Messages.CustomTxtParserInputWizardPage_timestampFormat);
181
182 timestampOutputFormatText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE);
183 timestampOutputFormatText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
184 timestampOutputFormatText.setText(DEFAULT_TIMESTAMP_FORMAT);
185
186 Button dateFormatHelpButton = new Button(headerComposite, SWT.PUSH);
187 dateFormatHelpButton.setImage(HELP_IMAGE);
188 dateFormatHelpButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_dateFormatHelp);
189 dateFormatHelpButton.addSelectionListener(new SelectionAdapter() {
190 @Override
191 public void widgetSelected(SelectionEvent e) {
192 openHelpShell(SIMPLE_DATE_FORMAT_URL);
193 }
194 });
195
196 Label timestampPreviewLabel = new Label(headerComposite, SWT.NULL);
197 timestampPreviewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 3, 1));
198 timestampPreviewLabel.setText(Messages.CustomTxtParserInputWizardPage_preview);
199
200 timestampPreviewText = new Text(headerComposite, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
201 timestampPreviewText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
202 timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingTimestamp);
203
204 Composite buttonBar = new Composite(container, SWT.NONE);
205 GridLayout buttonBarLayout = new GridLayout(5, false);
206 buttonBarLayout.marginHeight = 0;
207 buttonBarLayout.marginWidth = 0;
208 buttonBar.setLayout(buttonBarLayout);
209
210 Button removeButton = new Button(buttonBar, SWT.PUSH);
211 removeButton.setImage(DELETE_IMAGE);
212 removeButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_removeLine);
213 removeButton.addSelectionListener(new SelectionAdapter() {
214 @Override
215 public void widgetSelected(SelectionEvent e) {
216 if (treeViewer.getSelection().isEmpty() || selectedLine == null) {
217 return;
218 }
219 removeLine();
220 InputLine inputLine = (InputLine) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
221 if (inputLine.parentInput == null) {
222 definition.inputs.remove(inputLine);
223 } else {
224 inputLine.parentInput.childrenInputs.remove(inputLine);
225 }
226 treeViewer.refresh();
227 validate();
228 updatePreviews();
229 }
230 });
231 Button addNextButton = new Button(buttonBar, SWT.PUSH);
232 addNextButton.setImage(ADD_NEXT_IMAGE);
233 addNextButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_addNextLine);
234 addNextButton.addSelectionListener(new SelectionAdapter() {
235 @Override
236 public void widgetSelected(SelectionEvent e) {
237 InputLine inputLine = new InputLine(Cardinality.ZERO_OR_MORE, "", null); //$NON-NLS-1$
238 if (((List<?>) treeViewer.getInput()).size() == 0) {
239 definition.inputs.add(inputLine);
240 } else if (treeViewer.getSelection().isEmpty()) {
241 return;
242 } else {
243 InputLine previousInputLine = (InputLine) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
244 if (previousInputLine.parentInput == null) {
245 for (int i = 0; i < definition.inputs.size(); i++) {
246 if (definition.inputs.get(i).equals(previousInputLine)) {
247 definition.inputs.add(i + 1, inputLine);
248 }
249 }
250 } else {
251 previousInputLine.addNext(inputLine);
252 }
253 }
254 treeViewer.refresh();
255 treeViewer.setSelection(new StructuredSelection(inputLine), true);
256 }
257 });
258 Button addChildButton = new Button(buttonBar, SWT.PUSH);
259 addChildButton.setImage(ADD_CHILD_IMAGE);
260 addChildButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_addChildLine);
261 addChildButton.addSelectionListener(new SelectionAdapter() {
262 @Override
263 public void widgetSelected(SelectionEvent e) {
264 InputLine inputLine = new InputLine(Cardinality.ZERO_OR_MORE, "", null); //$NON-NLS-1$
265 if (((List<?>) treeViewer.getInput()).size() == 0) {
266 definition.inputs.add(inputLine);
267 } else if (treeViewer.getSelection().isEmpty()) {
268 return;
269 } else {
270 InputLine parentInputLine = (InputLine) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
271 parentInputLine.addChild(inputLine);
272 }
273 treeViewer.refresh();
274 treeViewer.setSelection(new StructuredSelection(inputLine), true);
275 }
276 });
277 Button moveUpButton = new Button(buttonBar, SWT.PUSH);
278 moveUpButton.setImage(MOVE_UP_IMAGE);
279 moveUpButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_moveUp);
280 moveUpButton.addSelectionListener(new SelectionAdapter() {
281 @Override
282 public void widgetSelected(SelectionEvent e) {
283 if (treeViewer.getSelection().isEmpty()) {
284 return;
285 }
286 InputLine inputLine = (InputLine) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
287 if (inputLine.parentInput == null) {
288 for (int i = 1; i < definition.inputs.size(); i++) {
289 if (definition.inputs.get(i).equals(inputLine)) {
290 definition.inputs.add(i - 1 , definition.inputs.remove(i));
291 break;
292 }
293 }
294 } else {
295 inputLine.moveUp();
296 }
297 treeViewer.refresh();
298 validate();
299 updatePreviews();
300 }
301 });
302 Button moveDownButton = new Button(buttonBar, SWT.PUSH);
303 moveDownButton.setImage(MOVE_DOWN_IMAGE);
304 moveDownButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_moveDown);
305 moveDownButton.addSelectionListener(new SelectionAdapter() {
306 @Override
307 public void widgetSelected(SelectionEvent e) {
308 if (treeViewer.getSelection().isEmpty()) {
309 return;
310 }
311 InputLine inputLine = (InputLine) ((IStructuredSelection) treeViewer.getSelection()).getFirstElement();
312 if (inputLine.parentInput == null) {
313 for (int i = 0; i < definition.inputs.size() - 1; i++) {
314 if (definition.inputs.get(i).equals(inputLine)) {
315 definition.inputs.add(i + 1 , definition.inputs.remove(i));
316 break;
317 }
318 }
319 } else {
320 inputLine.moveDown();
321 }
322 treeViewer.refresh();
323 validate();
324 updatePreviews();
325 }
326 });
327
328 SashForm vSash = new SashForm(container, SWT.VERTICAL);
329 vSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
330 vSash.setBackground(vSash.getDisplay().getSystemColor(SWT.COLOR_GRAY));
331
332 SashForm hSash = new SashForm(vSash, SWT.HORIZONTAL);
333 hSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
334
335 ScrolledComposite treeScrolledComposite = new ScrolledComposite(hSash, SWT.V_SCROLL | SWT.H_SCROLL);
336 GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
337 gd.heightHint = 200;
338 gd.widthHint = 200;
339 treeScrolledComposite.setLayoutData(gd);
340 Composite treeContainer = new Composite(treeScrolledComposite, SWT.NONE);
341 treeContainer.setLayout(new FillLayout());
342 treeScrolledComposite.setContent(treeContainer);
343 treeScrolledComposite.setExpandHorizontal(true);
344 treeScrolledComposite.setExpandVertical(true);
345
346 treeViewer = new TreeViewer(treeContainer, SWT.SINGLE | SWT.BORDER);
347 treeViewer.setContentProvider(new InputLineTreeNodeContentProvider());
348 treeViewer.setLabelProvider(new InputLineTreeLabelProvider());
349 treeViewer.addSelectionChangedListener(new InputLineTreeSelectionChangedListener());
350 treeContainer.layout();
351
352 treeScrolledComposite.setMinSize(treeContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, treeContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
353
354 lineScrolledComposite = new ScrolledComposite(hSash, SWT.V_SCROLL);
355 lineScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
356 lineContainer = new Composite(lineScrolledComposite, SWT.NONE);
357 GridLayout linesLayout = new GridLayout();
358 linesLayout.marginHeight = 1;
359 linesLayout.marginWidth = 0;
360 lineContainer.setLayout(linesLayout);
361 lineScrolledComposite.setContent(lineContainer);
362 lineScrolledComposite.setExpandHorizontal(true);
363 lineScrolledComposite.setExpandVertical(true);
364
365 if (definition == null) {
366 definition = new CustomTxtTraceDefinition();
367 definition.inputs.add(new InputLine(Cardinality.ZERO_OR_MORE, DEFAULT_REGEX,
368 Arrays.asList(new InputData(CustomTraceDefinition.TAG_MESSAGE, CustomTraceDefinition.ACTION_SET))));
369 }
370 loadDefinition(definition);
371 treeViewer.expandAll();
372 lineContainer.layout();
373
374 logtypeText.addModifyListener(updateListener);
375 timestampOutputFormatText.addModifyListener(updateListener);
376
377 lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
378
379 hSash.setWeights(new int[] {1, 2});
380
381 Composite sashBottom = new Composite(vSash, SWT.NONE);
382 GridLayout sashBottomLayout = new GridLayout(3, false);
383 sashBottomLayout.marginHeight = 0;
384 sashBottomLayout.marginWidth = 0;
385 sashBottom.setLayout(sashBottomLayout);
386
387 Label previewLabel = new Label(sashBottom, SWT.NULL);
388 previewLabel.setText(Messages.CustomTxtParserInputWizardPage_previewInput);
389 previewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
390
391 Button highlightAllButton = new Button(sashBottom, SWT.PUSH);
392 highlightAllButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
393 highlightAllButton.setText(Messages.CustomTxtParserInputWizardPage_highlightAll);
394 highlightAllButton.addSelectionListener(new SelectionAdapter() {
395 @Override
396 public void widgetSelected(SelectionEvent e) {
397 updatePreviews(true);
398 }
399 });
400
401 Button legendButton = new Button(sashBottom, SWT.PUSH);
402 legendButton.setImage(HELP_IMAGE);
403 legendButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_previewLegend);
404 legendButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
405 legendButton.addSelectionListener(new SelectionAdapter() {
406 @Override
407 public void widgetSelected(SelectionEvent e) {
408 openLegend();
409 }
410 });
411
412 inputText = new StyledText(sashBottom, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
413 if (fixedFont == null) {
414 if (System.getProperty("os.name").contains("Windows")) { //$NON-NLS-1$ //$NON-NLS-2$
415 fixedFont = new Font(Display.getCurrent(), new FontData("Courier New", 10, SWT.NORMAL)); //$NON-NLS-1$
416 } else {
417 fixedFont = new Font(Display.getCurrent(), new FontData("Monospace", 10, SWT.NORMAL)); //$NON-NLS-1$
418 }
419 }
420 inputText.setFont(fixedFont);
421 gd = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
422 gd.heightHint = inputText.computeSize(SWT.DEFAULT, inputText.getLineHeight() * 4).y;
423 gd.widthHint = 800;
424 inputText.setLayoutData(gd);
425 inputText.setText(getSelectionText());
426 inputText.addModifyListener(updateListener);
427
428 vSash.setWeights(new int[] {hSash.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, sashBottom.computeSize(SWT.DEFAULT, SWT.DEFAULT).y});
429
430 setControl(container);
431
432 validate();
433 updatePreviews();
434 }
435
436 private static class InputLineTreeNodeContentProvider implements ITreeContentProvider {
437
438 @Override
439 public Object[] getElements(Object inputElement) {
440 return ((List<?>) inputElement).toArray();
441 }
442
443 @Override
444 public Object[] getChildren(Object parentElement) {
445 InputLine inputLine = (InputLine) parentElement;
446 if (inputLine.childrenInputs == null) {
447 return new InputLine[0];
448 }
449 return inputLine.childrenInputs.toArray();
450 }
451
452 @Override
453 public boolean hasChildren(Object element) {
454 InputLine inputLine = (InputLine) element;
455 return (inputLine.childrenInputs != null && inputLine.childrenInputs.size() > 0);
456 }
457
458 @Override
459 public void dispose() {
460 }
461
462 @Override
463 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
464 }
465
466 @Override
467 public Object getParent(Object element) {
468 InputLine inputLine = (InputLine) element;
469 return inputLine.parentInput;
470 }
471 }
472
473 private class InputLineTreeLabelProvider extends ColumnLabelProvider {
474
475 @Override
476 public Image getImage(Object element) {
477 return LINE_IMAGE;
478 }
479
480 @Override
481 public String getText(Object element) {
482 InputLine inputLine = (InputLine) element;
483 if (inputLine.parentInput == null) {
484 return "Root Line " + getName(inputLine) + " " + inputLine.cardinality.toString() + " : " + inputLine.getRegex(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
485 }
486 return "Line " + getName(inputLine) + " " + inputLine.cardinality.toString() + " : " + inputLine.getRegex(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
487 }
488 }
489
490 private class InputLineTreeSelectionChangedListener implements ISelectionChangedListener {
491 @Override
492 public void selectionChanged(SelectionChangedEvent event) {
493 if (selectedLine != null) {
494 selectedLine.dispose();
495 }
496 if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {
497 IStructuredSelection sel = (IStructuredSelection) event.getSelection();
498 InputLine inputLine = (InputLine) sel.getFirstElement();
499 selectedLine = new Line(lineContainer, getName(inputLine), inputLine);
500 lineContainer.layout();
501 lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y - 1);
502 container.layout();
503 validate();
504 updatePreviews();
505 }
506 }
507 }
508
509 @Override
510 public void dispose() {
511 if (fixedFont != null) {
512 fixedFont.dispose();
513 fixedFont = null;
514 }
515 super.dispose();
516 }
517
518 private void loadDefinition(CustomTxtTraceDefinition def) {
519 logtypeText.setText(def.definitionName);
520 timestampOutputFormatText.setText(def.timeStampOutputFormat);
521 treeViewer.setInput(def.inputs);
522 if (def.inputs.size() > 0) {
523 InputLine inputLine = def.inputs.get(0);
524 treeViewer.setSelection(new StructuredSelection(inputLine));
525 }
526 }
527
528 private String getName(InputLine inputLine) {
529 if (inputLine.parentInput == null) {
530 return Integer.toString(definition.inputs.indexOf(inputLine)+1);
531 }
532 return getName(inputLine.parentInput) + "." + Integer.toString(inputLine.parentInput.childrenInputs.indexOf(inputLine)+1); //$NON-NLS-1$
533 }
534
535 /**
536 * Get the global list of input names.
537 *
538 * @return The list of input names
539 */
540 public List<String> getInputNames() {
541 List<String> inputs = new ArrayList<String>();
542 for (InputLine inputLine : definition.inputs) {
543 for (String inputName : getInputNames(inputLine)) {
544 if (!inputs.contains(inputName)) {
545 inputs.add(inputName);
546 }
547 }
548 }
549 return inputs;
550 }
551
552 /**
553 * Get the list of input names for the given input line.
554 *
555 * @param inputLine
556 * The input line
557 * @return The list of input names
558 */
559 public List<String> getInputNames(InputLine inputLine) {
560 List<String> inputs = new ArrayList<String>();
561 if (inputLine.columns != null) {
562 for (InputData inputData : inputLine.columns) {
563 String inputName = inputData.name;
564 if (!inputs.contains(inputName)) {
565 inputs.add(inputName);
566 }
567 }
568 }
569 if (inputLine.childrenInputs != null) {
570 for (InputLine childInputLine : inputLine.childrenInputs) {
571 for (String inputName : getInputNames(childInputLine)) {
572 if (!inputs.contains(inputName)) {
573 inputs.add(inputName);
574 }
575 }
576 }
577 }
578 return inputs;
579 }
580
581 private void removeLine() {
582 selectedLine.dispose();
583 selectedLine = null;
584 lineContainer.layout();
585 lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
586 container.layout();
587 }
588
589 private String getSelectionText() {
590 if (this.selection instanceof IStructuredSelection) {
591 Object sel = ((IStructuredSelection) this.selection).getFirstElement();
592 if (sel instanceof IFile) {
593 IFile file = (IFile)sel;
594 BufferedReader reader = null;
595 try {
596 reader = new BufferedReader(new InputStreamReader(file.getContents()));
597 StringBuilder sb = new StringBuilder();
598 String line = null;
599 while ((line = reader.readLine()) != null) {
600 sb.append(line + "\n"); //$NON-NLS-1$
601 }
602 return sb.toString();
603 } catch (CoreException e) {
604 return ""; //$NON-NLS-1$
605 } catch (IOException e) {
606 return ""; //$NON-NLS-1$
607 } finally {
608 if (reader != null) {
609 try {
610 reader.close();
611 } catch (IOException e) {
612 }
613 }
614 }
615 }
616 }
617 return ""; //$NON-NLS-1$
618 }
619
620 private void updatePreviews() {
621 updatePreviews(false);
622 }
623
624 private void updatePreviews(boolean updateAll) {
625 if (inputText == null) {
626 // early update during construction
627 return;
628 }
629 inputText.setStyleRanges(new StyleRange[] {});
630
631 Scanner scanner = new Scanner(inputText.getText());
632 scanner.useDelimiter("\n"); //$NON-NLS-1$
633 int rawPos = 0;
634 // skip starting delimiters
635 String skip = scanner.findWithinHorizon("\\A\n+", 0); //$NON-NLS-1$
636 if (skip != null) {
637 rawPos += skip.length();
638 }
639
640 timeStampFormat = null;
641 if (selectedLine != null) {
642 for (InputGroup input : selectedLine.inputs) {
643 input.previewText.setText(Messages.CustomTxtParserInputWizardPage_noMathcingLine);
644 }
645 }
646
647 Map<String, String> data = new HashMap<String, String>();
648 int rootLineMatches = 0;
649 String firstEntryTimeStamp = null;
650 String firstEntryTimeStampInputFormat = null;
651 String log = null;
652 event:
653 while (scanner.hasNext()) {
654 if (rootLineMatches > 0 && !updateAll) {
655 break;
656 }
657 if (log == null) {
658 log = scanner.next();
659 }
660 int length = log.length();
661 for (InputLine rootInputLine : definition.inputs) {
662 Pattern pattern;
663 try {
664 pattern = rootInputLine.getPattern();
665 } catch (PatternSyntaxException e) {
666 continue;
667 }
668 Matcher matcher = pattern.matcher(log);
669 if (matcher.find()) {
670 rootLineMatches++;
671 inputText.setStyleRange(new StyleRange(rawPos, length,
672 COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
673 data = new HashMap<String, String>();
674 timeStampFormat = null;
675 updatePreviewLine(rootInputLine, matcher, data, rawPos, rootLineMatches);
676 if (rootLineMatches == 1) {
677 firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
678 firstEntryTimeStampInputFormat = timeStampFormat;
679 }
680 HashMap<InputLine, Integer> countMap = new HashMap<InputLine, Integer>();
681 InputLine currentInput = null;
682 if (rootInputLine.childrenInputs != null && rootInputLine.childrenInputs.size() > 0) {
683 currentInput = rootInputLine.childrenInputs.get(0);
684 countMap.put(currentInput, 0);
685 }
686 rawPos += length + 1; // +1 for \n
687 while (scanner.hasNext()) {
688 log = scanner.next();
689 length = log.length();
690 boolean processed = false;
691 if (currentInput == null) {
692 for (InputLine input : definition.inputs) {
693 matcher = input.getPattern().matcher(log);
694 if (matcher.find()) {
695 continue event;
696 }
697 }
698 } else {
699 if (countMap.get(currentInput) >= currentInput.getMinCount()) {
700 List<InputLine> nextInputs = currentInput.getNextInputs(countMap);
701 if (nextInputs.size() == 0 || nextInputs.get(nextInputs.size() - 1).getMinCount() == 0) {
702 for (InputLine input : definition.inputs) {
703 matcher = input.getPattern().matcher(log);
704 if (matcher.find()) {
705 continue event;
706 }
707 }
708 }
709 for (InputLine input : nextInputs) {
710 matcher = input.getPattern().matcher(log);
711 if (matcher.find()) {
712 inputText.setStyleRange(new StyleRange(rawPos, length,
713 COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
714 currentInput = input;
715 updatePreviewLine(currentInput, matcher, data, rawPos, rootLineMatches);
716 if (countMap.get(currentInput) == null) {
717 countMap.put(currentInput, 1);
718 } else {
719 countMap.put(currentInput, countMap.get(currentInput) + 1);
720 }
721 Iterator<InputLine> iter = countMap.keySet().iterator();
722 while (iter.hasNext()) {
723 InputLine inputLine = iter.next();
724 if (inputLine.level > currentInput.level) {
725 iter.remove();
726 }
727 }
728 if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {
729 currentInput = currentInput.childrenInputs.get(0);
730 countMap.put(currentInput, 0);
731 } else {
732 if (countMap.get(currentInput) >= currentInput.getMaxCount()) {
733 if (currentInput.getNextInputs(countMap).size() > 0) {
734 currentInput = currentInput.getNextInputs(countMap).get(0);
735 if (countMap.get(currentInput) == null) {
736 countMap.put(currentInput, 0);
737 }
738 iter = countMap.keySet().iterator();
739 while (iter.hasNext()) {
740 InputLine inputLine = iter.next();
741 if (inputLine.level > currentInput.level) {
742 iter.remove();
743 }
744 }
745 } else {
746 currentInput = null;
747 }
748 }
749 }
750 processed = true;
751 break;
752 }
753 }
754 }
755 if (!processed && currentInput != null) {
756 matcher = currentInput.getPattern().matcher(log);
757 if (matcher.find()) {
758 inputText.setStyleRange(new StyleRange(rawPos, length,
759 COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
760 updatePreviewLine(currentInput, matcher, data, rawPos, rootLineMatches);
761 countMap.put(currentInput, countMap.get(currentInput) + 1);
762 if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {
763 currentInput = currentInput.childrenInputs.get(0);
764 countMap.put(currentInput, 0);
765 } else {
766 if (countMap.get(currentInput) >= currentInput.getMaxCount()) {
767 if (currentInput.getNextInputs(countMap).size() > 0) {
768 currentInput = currentInput.getNextInputs(countMap).get(0);
769 if (countMap.get(currentInput) == null) {
770 countMap.put(currentInput, 0);
771 }
772 Iterator<InputLine> iter = countMap.keySet().iterator();
773 while (iter.hasNext()) {
774 InputLine inputLine = iter.next();
775 if (inputLine.level > currentInput.level) {
776 iter.remove();
777 }
778 }
779 } else {
780 currentInput = null;
781 }
782 }
783 }
784 }
785 }
786 }
787 rawPos += length + 1; // +1 for \n
788 }
789
790 break;
791 }
792 }
793 rawPos += length + 1; // +1 for \n
794 log = null;
795 }
796 scanner.close();
797 if (rootLineMatches == 1) {
798 firstEntryTimeStamp = data.get(CustomTraceDefinition.TAG_TIMESTAMP);
799 firstEntryTimeStampInputFormat = timeStampFormat;
800 }
801 if (firstEntryTimeStamp == null) {
802 timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noTimestampGroup);
803 if (selectedLine != null) {
804 for (InputGroup group : selectedLine.inputs) {
805 if (group.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
806 timestampPreviewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingTimestamp);
807 break;
808 }
809 }
810 }
811 } else {
812 try {
813 SimpleDateFormat dateFormat = new SimpleDateFormat(firstEntryTimeStampInputFormat);
814 Date date = dateFormat.parse(firstEntryTimeStamp);
815 dateFormat = new SimpleDateFormat(timestampOutputFormatText.getText().trim());
816 timestampPreviewText.setText(dateFormat.format(date));
817 } catch (ParseException e) {
818 timestampPreviewText.setText("*parse exception* [" + firstEntryTimeStamp + "] <> [" + firstEntryTimeStampInputFormat + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
819 } catch (IllegalArgumentException e) {
820 timestampPreviewText.setText("*parse exception* [Illegal Argument]"); //$NON-NLS-1$
821 }
822
823 }
824 }
825
826 private void updatePreviewLine(InputLine line, Matcher matcher, Map<String, String> data, int rawPos, int rootLineMatches) {
827 for (int i = 0; i < line.columns.size(); i++) {
828 InputData input = line.columns.get(i);
829 if (i < matcher.groupCount() && matcher.group(i+1) != null) {
830 if (line.parentInput == null) {
831 inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
832 COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
833 } else {
834 inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
835 COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
836 }
837 String value = matcher.group(i+1).trim();
838 if (selectedLine != null && selectedLine.inputLine.equals(line) && rootLineMatches == 1 &&
839 selectedLine.inputs.get(i).previewText.getText().equals(Messages.CustomTxtParserInputWizardPage_noMatchingLine)) {
840 selectedLine.inputs.get(i).previewText.setText(value);
841 }
842 if (value.length() == 0) {
843 continue;
844 }
845 if (input.action == CustomTraceDefinition.ACTION_SET) {
846 data.put(input.name, value);
847 if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
848 timeStampFormat = input.format;
849 }
850 } else if (input.action == CustomTraceDefinition.ACTION_APPEND) {
851 String s = data.get(input.name);
852 if (s != null) {
853 data.put(input.name, s + value);
854 } else {
855 data.put(input.name, value);
856 }
857 if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
858 if (timeStampFormat != null) {
859 timeStampFormat += input.format;
860 } else {
861 timeStampFormat = input.format;
862 }
863 }
864 } else if (input.action == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
865 String s = data.get(input.name);
866 if (s != null) {
867 data.put(input.name, s + " | " + value); //$NON-NLS-1$
868 } else {
869 data.put(input.name, value);
870 }
871 if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
872 if (timeStampFormat != null) {
873 timeStampFormat += " | " + input.format; //$NON-NLS-1$
874 } else {
875 timeStampFormat = input.format;
876 }
877 }
878 }
879 } else {
880 if (selectedLine != null && selectedLine.inputLine.equals(line) && rootLineMatches == 1) {
881 if (selectedLine.inputs.get(i).previewText.getText().equals(Messages.CustomTxtParserInputWizardPage_noMatchingLine)) {
882 selectedLine.inputs.get(i).previewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingGroup);
883 }
884 }
885 }
886 }
887 // highlight the matching groups that have no corresponponding input
888 for (int i = line.columns.size(); i < matcher.groupCount(); i++) {
889 if (matcher.group(i+1) != null) {
890 if (line.parentInput == null) {
891 inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
892 COLOR_BLACK, COLOR_MAGENTA));
893 } else {
894 inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
895 COLOR_BLACK, COLOR_LIGHT_MAGENTA));
896 }
897 }
898 }
899 }
900
901 private void openHelpShell(String url) {
902 if (helpBrowser != null && !helpBrowser.isDisposed()) {
903 helpBrowser.getShell().setActive();
904 if (!helpBrowser.getUrl().equals(url)) {
905 helpBrowser.setUrl(url);
906 }
907 return;
908 }
909 final Shell helpShell = new Shell(getShell(), SWT.SHELL_TRIM);
910 helpShell.setLayout(new FillLayout());
911 helpBrowser = new Browser(helpShell, SWT.NONE);
912 helpBrowser.addTitleListener(new TitleListener() {
913 @Override
914 public void changed(TitleEvent event) {
915 helpShell.setText(event.title);
916 }
917 });
918 helpBrowser.setBounds(0, 0, 600, 400);
919 helpShell.pack();
920 helpShell.open();
921 helpBrowser.setUrl(url);
922 }
923
924 private void openLegend() {
925 final String cg = Messages.CustomTxtParserInputWizardPage_capturedGroup;
926 final String ucg = Messages.CustomTxtParserInputWizardPage_unidentifiedCaptureGroup;
927 final String ut = Messages.CustomTxtParserInputWizardPage_uncapturedText;
928 int line1start = 0;
929 String line1 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine;
930 int line2start = line1start + line1.length();
931 String line2 = Messages.CustomTxtParserInputWizardPage_matchingLineRoot + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
932 int line3start = line2start + line2.length();
933 String line3 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
934 int line4start = line3start + line3.length();
935 String line4 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
936 int line5start = line4start + line4.length();
937 String line5 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine;
938 int line6start = line5start + line5.length();
939 String line6 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
940
941 final Shell legendShell = new Shell(getShell(), SWT.DIALOG_TRIM);
942 legendShell.setLayout(new FillLayout());
943 StyledText legendText = new StyledText(legendShell, SWT.MULTI);
944 legendText.setFont(fixedFont);
945 legendText.setText(line1 + line2 + line3 + line4 + line5 + line6);
946 legendText.setStyleRange(new StyleRange(line2start, line2.length(), COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
947 legendText.setStyleRange(new StyleRange(line3start, line3.length(), COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
948 legendText.setStyleRange(new StyleRange(line4start, line4.length(), COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
949 legendText.setStyleRange(new StyleRange(line6start, line6.length(), COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
950 legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
951 legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_MAGENTA));
952 legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
953 legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
954 legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
955 legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
956 legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
957 legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_MAGENTA));
958 legendShell.setText(Messages.CustomTxtParserInputWizardPage_previewLegend);
959 legendShell.pack();
960 legendShell.open();
961 }
962
963 private class UpdateListener implements ModifyListener, SelectionListener {
964
965 @Override
966 public void modifyText(ModifyEvent e) {
967 validate();
968 updatePreviews();
969 }
970
971 @Override
972 public void widgetDefaultSelected(SelectionEvent e) {
973 validate();
974 updatePreviews();
975 }
976
977 @Override
978 public void widgetSelected(SelectionEvent e) {
979 validate();
980 updatePreviews();
981 }
982
983 }
984
985 private class Line {
986 private static final String INFINITY_STRING = "\u221E"; //$NON-NLS-1$
987 private InputLine inputLine;
988 private Group group;
989 private Composite labelComposite;
990 private Text regexText;
991 private Composite cardinalityContainer;
992 private Combo cardinalityCombo;
993 private Label cardinalityMinLabel;
994 private Text cardinalityMinText;
995 private Label cardinalityMaxLabel;
996 private Text cardinalityMaxText;
997 private Button infiniteButton;
998 private List<InputGroup> inputs = new ArrayList<InputGroup>();
999 private Button addGroupButton;
1000 private Label addGroupLabel;
1001
1002 public Line(Composite parent, String name, InputLine inputLine) {
1003 this.inputLine = inputLine;
1004
1005 group = new Group(parent, SWT.NONE);
1006 group.setText(name);
1007 group.setLayout(new GridLayout(2, false));
1008 group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1009
1010 labelComposite = new Composite(group, SWT.FILL);
1011 GridLayout labelLayout = new GridLayout(1, false);
1012 labelLayout.marginWidth = 0;
1013 labelLayout.marginHeight = 0;
1014 labelComposite.setLayout(labelLayout);
1015 labelComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1016
1017 Label label = new Label(labelComposite, SWT.NULL);
1018 label.setText(Messages.CustomTxtParserInputWizardPage_regularExpression);
1019
1020 Composite regexContainer = new Composite(group, SWT.NONE);
1021 GridLayout regexLayout = new GridLayout(2, false);
1022 regexLayout.marginHeight = 0;
1023 regexLayout.marginWidth = 0;
1024 regexContainer.setLayout(regexLayout);
1025 regexContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1026
1027 regexText = new Text(regexContainer, SWT.BORDER | SWT.SINGLE);
1028 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
1029 gd.widthHint = 0;
1030 regexText.setLayoutData(gd);
1031 regexText.setText(inputLine.getRegex());
1032 regexText.addModifyListener(updateListener);
1033
1034 Button regexHelpButton = new Button(regexContainer, SWT.PUSH);
1035 regexHelpButton.setImage(HELP_IMAGE);
1036 regexHelpButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_regularExpressionHelp);
1037 regexHelpButton.addSelectionListener(new SelectionAdapter() {
1038 @Override
1039 public void widgetSelected(SelectionEvent e) {
1040 openHelpShell(PATTERN_URL);
1041 }
1042 });
1043
1044 label = new Label(group, SWT.NONE);
1045 label.setText(Messages.CustomTxtParserInputWizardPage_cardinality);
1046 label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1047
1048 cardinalityContainer = new Composite(group, SWT.NONE);
1049 GridLayout cardinalityLayout = new GridLayout(6, false);
1050 cardinalityLayout.marginHeight = 0;
1051 cardinalityLayout.marginWidth = 0;
1052 cardinalityContainer.setLayout(cardinalityLayout);
1053 cardinalityContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1054
1055 cardinalityCombo = new Combo(cardinalityContainer, SWT.DROP_DOWN | SWT.READ_ONLY);
1056 cardinalityCombo.setItems(new String[] {
1057 Cardinality.ZERO_OR_MORE.toString(),
1058 Cardinality.ONE_OR_MORE.toString(),
1059 Cardinality.ZERO_OR_ONE.toString(),
1060 Cardinality.ONE.toString(),
1061 "(?,?)"}); //$NON-NLS-1$
1062 cardinalityCombo.addSelectionListener(new SelectionListener() {
1063 @Override
1064 public void widgetDefaultSelected(SelectionEvent e) {}
1065
1066 @Override
1067 public void widgetSelected(SelectionEvent e) {
1068 switch (cardinalityCombo.getSelectionIndex()) {
1069 case 4: // (?,?)
1070 cardinalityMinLabel.setVisible(true);
1071 cardinalityMinText.setVisible(true);
1072 cardinalityMaxLabel.setVisible(true);
1073 cardinalityMaxText.setVisible(true);
1074 infiniteButton.setVisible(true);
1075 break;
1076 default:
1077 cardinalityMinLabel.setVisible(false);
1078 cardinalityMinText.setVisible(false);
1079 cardinalityMaxLabel.setVisible(false);
1080 cardinalityMaxText.setVisible(false);
1081 infiniteButton.setVisible(false);
1082 break;
1083 }
1084 cardinalityContainer.layout();
1085 validate();
1086 updatePreviews();
1087 }
1088 });
1089
1090 cardinalityMinLabel = new Label(cardinalityContainer, SWT.NONE);
1091 cardinalityMinLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1092 cardinalityMinLabel.setText(Messages.CustomTxtParserInputWizardPage_min);
1093 cardinalityMinLabel.setVisible(false);
1094
1095 cardinalityMinText = new Text(cardinalityContainer, SWT.BORDER | SWT.SINGLE);
1096 gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
1097 gd.widthHint = 20;
1098 cardinalityMinText.setLayoutData(gd);
1099 cardinalityMinText.setVisible(false);
1100
1101 cardinalityMaxLabel = new Label(cardinalityContainer, SWT.NONE);
1102 cardinalityMaxLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1103 cardinalityMaxLabel.setText(Messages.CustomTxtParserInputWizardPage_max);
1104 cardinalityMaxLabel.setVisible(false);
1105
1106 cardinalityMaxText = new Text(cardinalityContainer, SWT.BORDER | SWT.SINGLE);
1107 gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
1108 gd.widthHint = 20;
1109 cardinalityMaxText.setLayoutData(gd);
1110 cardinalityMaxText.setVisible(false);
1111
1112 infiniteButton = new Button(cardinalityContainer, SWT.PUSH);
1113 infiniteButton.setText(INFINITY_STRING);
1114 infiniteButton.setVisible(false);
1115 infiniteButton.addSelectionListener(new SelectionAdapter(){
1116 @Override
1117 public void widgetSelected(SelectionEvent e) {
1118 cardinalityMaxText.setText(INFINITY_STRING);
1119 }});
1120
1121 if (inputLine.cardinality.equals(Cardinality.ZERO_OR_MORE)) {
1122 cardinalityCombo.select(0);
1123 } else if (inputLine.cardinality.equals(Cardinality.ONE_OR_MORE)) {
1124 cardinalityCombo.select(1);
1125 } else if (inputLine.cardinality.equals(Cardinality.ZERO_OR_ONE)) {
1126 cardinalityCombo.select(2);
1127 } else if (inputLine.cardinality.equals(Cardinality.ONE)) {
1128 cardinalityCombo.select(3);
1129 } else {
1130 cardinalityCombo.select(4);
1131 cardinalityMinLabel.setVisible(true);
1132 cardinalityMinText.setVisible(true);
1133 if (inputLine.getMinCount() >= 0) {
1134 cardinalityMinText.setText(Integer.toString(inputLine.getMinCount()));
1135 }
1136 cardinalityMaxLabel.setVisible(true);
1137 cardinalityMaxText.setVisible(true);
1138 if (inputLine.getMaxCount() == Cardinality.INF) {
1139 cardinalityMaxText.setText(INFINITY_STRING);
1140 } else if (inputLine.getMaxCount() >= 0) {
1141 cardinalityMaxText.setText(Integer.toString(inputLine.getMaxCount()));
1142 }
1143 infiniteButton.setVisible(true);
1144 }
1145
1146 VerifyListener digitsListener = new VerifyListener() {
1147 @Override
1148 public void verifyText(VerifyEvent e) {
1149 if (e.text.equals(INFINITY_STRING)) {
1150 e.doit = e.widget == cardinalityMaxText && e.start == 0 && e.end == ((Text) e.widget).getText().length();
1151 } else {
1152 if (((Text) e.widget).getText().equals(INFINITY_STRING)) {
1153 e.doit = e.start == 0 && e.end == ((Text) e.widget).getText().length();
1154 }
1155 for (int i = 0; i < e.text.length(); i++) {
1156 if (!Character.isDigit(e.text.charAt(i))) {
1157 e.doit = false;
1158 break;
1159 }
1160 }
1161 }
1162 }};
1163
1164 cardinalityMinText.addModifyListener(updateListener);
1165 cardinalityMaxText.addModifyListener(updateListener);
1166 cardinalityMinText.addVerifyListener(digitsListener);
1167 cardinalityMaxText.addVerifyListener(digitsListener);
1168
1169 if (inputLine.columns != null) {
1170 for (InputData inputData : inputLine.columns) {
1171 InputGroup inputGroup = new InputGroup(group, this, inputs.size()+1);
1172 if (inputData.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
1173 inputGroup.tagCombo.select(0);
1174 inputGroup.tagText.setText(inputData.format);
1175 inputGroup.tagLabel.setText(Messages.CustomTxtParserInputWizardPage_format);
1176 inputGroup.tagLabel.setVisible(true);
1177 inputGroup.tagText.setVisible(true);
1178 inputGroup.tagText.addModifyListener(updateListener);
1179 } else if (inputData.name.equals(CustomTraceDefinition.TAG_MESSAGE)) {
1180 inputGroup.tagCombo.select(1);
1181 } else {
1182 inputGroup.tagCombo.select(2);
1183 inputGroup.tagText.setText(inputData.name);
1184 inputGroup.tagLabel.setText(Messages.CustomTxtParserInputWizardPage_name);
1185 inputGroup.tagLabel.setVisible(true);
1186 inputGroup.tagText.setVisible(true);
1187 inputGroup.tagText.addModifyListener(updateListener);
1188 }
1189 inputGroup.actionCombo.select(inputData.action);
1190 inputs.add(inputGroup);
1191 }
1192 }
1193
1194 createAddGroupButton();
1195 }
1196
1197 private void createAddGroupButton() {
1198 addGroupButton = new Button(group, SWT.PUSH);
1199 addGroupButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1200 addGroupButton.setImage(ADD_IMAGE);
1201 addGroupButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_addGroup);
1202 addGroupButton.addSelectionListener(new SelectionAdapter() {
1203 @Override
1204 public void widgetSelected(SelectionEvent e) {
1205 removeAddGroupButton();
1206 inputs.add(new InputGroup(group, Line.this, inputs.size()+1));
1207 createAddGroupButton();
1208 lineContainer.layout();
1209 lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
1210 group.getParent().layout();
1211 validate();
1212 updatePreviews();
1213 }
1214 });
1215
1216 addGroupLabel = new Label(group, SWT.NULL);
1217 addGroupLabel.setText(Messages.CustomTxtParserInputWizardPage_newGroup);
1218 }
1219
1220 private void removeAddGroupButton() {
1221 addGroupButton.dispose();
1222 addGroupLabel.dispose();
1223 }
1224
1225 private void removeInput(int inputNumber) {
1226 int nb = inputNumber;
1227 if (--nb < inputs.size()) {
1228 inputs.remove(nb).dispose();
1229 for (int i = nb; i < inputs.size(); i++) {
1230 inputs.get(i).setInputNumber(i+1);
1231 }
1232 lineContainer.layout();
1233 lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
1234 group.getParent().layout();
1235 }
1236 }
1237
1238 private void dispose() {
1239 group.dispose();
1240 }
1241
1242 private void extractInputs() {
1243 inputLine.setRegex(selectedLine.regexText.getText());
1244 switch (cardinalityCombo.getSelectionIndex()) {
1245 case 0:
1246 inputLine.cardinality = Cardinality.ZERO_OR_MORE;
1247 break;
1248 case 1:
1249 inputLine.cardinality = Cardinality.ONE_OR_MORE;
1250 break;
1251 case 2:
1252 inputLine.cardinality = Cardinality.ZERO_OR_ONE;
1253 break;
1254 case 3:
1255 inputLine.cardinality = Cardinality.ONE;
1256 break;
1257 case 4: //(?,?)
1258 int min, max;
1259 try {
1260 min = Integer.parseInt(cardinalityMinText.getText());
1261 } catch (NumberFormatException e) {
1262 min = -1;
1263 }
1264 try {
1265 if (cardinalityMaxText.getText().equals(INFINITY_STRING)) {
1266 max = Cardinality.INF;
1267 } else {
1268 max = Integer.parseInt(cardinalityMaxText.getText());
1269 }
1270 } catch (NumberFormatException e) {
1271 max = -1;
1272 }
1273 inputLine.cardinality = new Cardinality(min, max);
1274 break;
1275 default:
1276 inputLine.cardinality = Cardinality.ZERO_OR_MORE;
1277 break;
1278 }
1279 inputLine.columns = new ArrayList<InputData>(inputs.size());
1280 for (int i = 0; i < inputs.size(); i++) {
1281 InputGroup grp = inputs.get(i);
1282 InputData inputData = new InputData();
1283 if (grp.tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {
1284 inputData.name = grp.tagText.getText().trim();
1285 } else {
1286 inputData.name = grp.tagCombo.getText();
1287 if (grp.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
1288 inputData.format = grp.tagText.getText().trim();
1289 }
1290 }
1291 inputData.action = grp.actionCombo.getSelectionIndex();
1292 inputLine.columns.add(inputData);
1293 }
1294 }
1295 }
1296
1297 private class InputGroup {
1298 private Line line;
1299 private int inputNumber;
1300
1301 // children of parent (must be disposed)
1302 private Composite labelComposite;
1303 private Composite tagComposite;
1304 private Label previewLabel;
1305 private Text previewText;
1306
1307 // children of labelComposite
1308 private Label inputLabel;
1309
1310 // children of tagComposite
1311 private Combo tagCombo;
1312 private Label tagLabel;
1313 private Text tagText;
1314 private Combo actionCombo;
1315
1316 public InputGroup(Composite parent, Line line, int inputNumber) {
1317 this.line = line;
1318 this.inputNumber = inputNumber;
1319
1320 labelComposite = new Composite(parent, SWT.FILL);
1321 GridLayout labelLayout = new GridLayout(2, false);
1322 labelLayout.marginWidth = 0;
1323 labelLayout.marginHeight = 0;
1324 labelComposite.setLayout(labelLayout);
1325 labelComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1326
1327 Button deleteButton = new Button(labelComposite, SWT.PUSH);
1328 deleteButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1329 deleteButton.setImage(DELETE_IMAGE);
1330 deleteButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_removeGroup);
1331 deleteButton.addSelectionListener(new SelectionAdapter() {
1332 @Override
1333 public void widgetSelected(SelectionEvent e) {
1334 InputGroup.this.line.removeInput(InputGroup.this.inputNumber);
1335 validate();
1336 updatePreviews();
1337 }
1338 });
1339
1340 inputLabel = new Label(labelComposite, SWT.NULL);
1341 inputLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1342 inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$
1343
1344 tagComposite = new Composite(parent, SWT.FILL);
1345 GridLayout tagLayout = new GridLayout(4, false);
1346 tagLayout.marginWidth = 0;
1347 tagLayout.marginHeight = 0;
1348 tagComposite.setLayout(tagLayout);
1349 tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1350
1351 tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
1352 tagCombo.setItems(new String[] {CustomTraceDefinition.TAG_TIMESTAMP,
1353 CustomTraceDefinition.TAG_MESSAGE,
1354 CustomTraceDefinition.TAG_OTHER});
1355 tagCombo.select(1);
1356 tagCombo.addSelectionListener(new SelectionListener(){
1357 @Override
1358 public void widgetDefaultSelected(SelectionEvent e) {}
1359 @Override
1360 public void widgetSelected(SelectionEvent e) {
1361 tagText.removeModifyListener(updateListener);
1362 switch (tagCombo.getSelectionIndex()) {
1363 case 0: //Time Stamp
1364 tagLabel.setText(Messages.CustomTxtParserInputWizardPage_format);
1365 tagLabel.setVisible(true);
1366 tagText.setVisible(true);
1367 tagText.addModifyListener(updateListener);
1368 break;
1369 case 1: //Message
1370 tagLabel.setVisible(false);
1371 tagText.setVisible(false);
1372 break;
1373 case 2: //Other
1374 tagLabel.setText(Messages.CustomTxtParserInputWizardPage_name);
1375 tagLabel.setVisible(true);
1376 tagText.setVisible(true);
1377 tagText.addModifyListener(updateListener);
1378 break;
1379 case 3: //Continue
1380 tagLabel.setVisible(false);
1381 tagText.setVisible(false);
1382 break;
1383 default:
1384 break;
1385 }
1386 tagComposite.layout();
1387 validate();
1388 updatePreviews();
1389 }});
1390
1391 tagLabel = new Label(tagComposite, SWT.NULL);
1392 tagLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1393 tagLabel.setVisible(false);
1394
1395 tagText = new Text(tagComposite, SWT.BORDER | SWT.SINGLE);
1396 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
1397 gd.widthHint = 0;
1398 tagText.setLayoutData(gd);
1399 tagText.setVisible(false);
1400
1401 actionCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
1402 actionCombo.setItems(new String[] {Messages.CustomTxtParserInputWizardPage_set, Messages.CustomTxtParserInputWizardPage_append, Messages.CustomTxtParserInputWizardPage_appendWith});
1403 actionCombo.select(0);
1404 actionCombo.addSelectionListener(updateListener);
1405
1406 previewLabel = new Label(parent, SWT.NULL);
1407 previewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1408 previewLabel.setText(Messages.CustomTxtParserInputWizardPage_preview);
1409
1410 previewText = new Text(parent, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
1411 gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
1412 gd.widthHint = 0;
1413 previewText.setLayoutData(gd);
1414 previewText.setText(Messages.CustomTxtParserInputWizardPage_noMatch);
1415 previewText.setBackground(COLOR_WIDGET_BACKGROUND);
1416 }
1417
1418 private void dispose() {
1419 labelComposite.dispose();
1420 tagComposite.dispose();
1421 previewLabel.dispose();
1422 previewText.dispose();
1423 }
1424
1425 private void setInputNumber(int inputNumber) {
1426 this.inputNumber = inputNumber;
1427 inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$
1428 labelComposite.layout();
1429 }
1430 }
1431
1432 private void validate() {
1433
1434 definition.definitionName = logtypeText.getText().trim();
1435 definition.timeStampOutputFormat = timestampOutputFormatText.getText().trim();
1436
1437 if (selectedLine != null) {
1438 selectedLine.extractInputs();
1439 treeViewer.refresh();
1440 }
1441
1442 StringBuffer errors = new StringBuffer();
1443
1444 if (definition.definitionName.length() == 0) {
1445 errors.append("Enter a name for the new log type. "); //$NON-NLS-1$
1446 logtypeText.setBackground(COLOR_LIGHT_RED);
1447 } else {
1448 logtypeText.setBackground(COLOR_TEXT_BACKGROUND);
1449 for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
1450 if (definition.definitionName.equals(def.definitionName) &&
1451 (editDefinitionName == null || !editDefinitionName.equals(definition.definitionName))) {
1452 errors.append("The log type name already exists. "); //$NON-NLS-1$
1453 logtypeText.setBackground(COLOR_LIGHT_RED);
1454 break;
1455 }
1456 }
1457 }
1458
1459 timestampFound = false;
1460 for (int i = 0; i < definition.inputs.size(); i++) {
1461
1462 InputLine inputLine = definition.inputs.get(i);
1463 String name = Integer.toString(i+1);
1464 errors.append(validateLine(inputLine, name));
1465 }
1466 if (timestampFound) {
1467 if (definition.timeStampOutputFormat.length() == 0) {
1468 errors.append("Enter the output format for the Time Stamp field. "); //$NON-NLS-1$
1469 timestampOutputFormatText.setBackground(COLOR_LIGHT_RED);
1470 } else {
1471 try {
1472 new SimpleDateFormat(definition.timeStampOutputFormat);
1473 timestampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
1474 } catch (IllegalArgumentException e) {
1475 errors.append("Enter a valid output format for the Time Stamp field. "); //$NON-NLS-1$
1476 timestampOutputFormatText.setBackground(COLOR_LIGHT_RED);
1477 }
1478 }
1479
1480 } else {
1481 timestampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
1482 }
1483
1484 if (errors.length() == 0) {
1485 setDescription(defaultDescription);
1486 setPageComplete(true);
1487 } else {
1488 setDescription(errors.toString());
1489 setPageComplete(false);
1490 }
1491 }
1492
1493 /**
1494 * Validate an input line.
1495 *
1496 * @param inputLine
1497 * The line to clean up
1498 * @param name
1499 * The name of the line
1500 * @return The cleaned up line
1501 */
1502 public StringBuffer validateLine(InputLine inputLine, String name) {
1503 StringBuffer errors = new StringBuffer();
1504 Line line = null;
1505 if (selectedLine != null && selectedLine.inputLine.equals(inputLine)) {
1506 line = selectedLine;
1507 }
1508 try {
1509 Pattern.compile(inputLine.getRegex());
1510 if (line != null) {
1511 line.regexText.setBackground(COLOR_TEXT_BACKGROUND);
1512 }
1513 } catch (PatternSyntaxException e) {
1514 errors.append("Enter a valid regular expression (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1515 if (line != null) {
1516 line.regexText.setBackground(COLOR_LIGHT_RED);
1517 }
1518 }
1519 if (inputLine.getMinCount() == -1) {
1520 errors.append("Enter a minimum value for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1521 if (line != null) {
1522 line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);
1523 }
1524 } else {
1525 if (line != null) {
1526 line.cardinalityMinText.setBackground(COLOR_TEXT_BACKGROUND);
1527 }
1528 }
1529 if (inputLine.getMaxCount() == -1) {
1530 errors.append("Enter a maximum value for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1531 if (line != null) {
1532 line.cardinalityMaxText.setBackground(COLOR_LIGHT_RED);
1533 }
1534 } else if (inputLine.getMinCount() > inputLine.getMaxCount()) {
1535 errors.append("Enter correct (min <= max) values for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1536 if (line != null) {
1537 line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);
1538 }
1539 if (line != null) {
1540 line.cardinalityMaxText.setBackground(COLOR_LIGHT_RED);
1541 }
1542 } else {
1543 if (line != null) {
1544 line.cardinalityMaxText.setBackground(COLOR_TEXT_BACKGROUND);
1545 }
1546 }
1547 for (int i = 0; inputLine.columns != null && i < inputLine.columns.size(); i++) {
1548 InputData inputData = inputLine.columns.get(i);
1549 InputGroup group = null;
1550 if (line != null) {
1551 group = line.inputs.get(i);
1552 }
1553 if (inputData.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
1554 timestampFound = true;
1555 if (inputData.format.length() == 0) {
1556 errors.append("Enter the input format for the Time Stamp (Line "+name+" Group "+(i+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1557 if (group != null) {
1558 group.tagText.setBackground(COLOR_LIGHT_RED);
1559 }
1560 } else {
1561 try {
1562 new SimpleDateFormat(inputData.format);
1563 if (group != null) {
1564 group.tagText.setBackground(COLOR_TEXT_BACKGROUND);
1565 }
1566 } catch (IllegalArgumentException e) {
1567 errors.append("Enter a valid input format for the Time Stamp (Line "+name+" Group "+(i+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1568 if (group != null) {
1569 group.tagText.setBackground(COLOR_LIGHT_RED);
1570 }
1571 }
1572 }
1573 } else if (inputData.name.length() == 0) {
1574 errors.append("Enter a name for the data group (Line "+name+" Group "+(i+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1575 if (group != null) {
1576 group.tagText.setBackground(COLOR_LIGHT_RED);
1577 }
1578 } else {
1579 if (group != null) {
1580 group.tagText.setBackground(COLOR_TEXT_BACKGROUND);
1581 }
1582 }
1583 }
1584 for (int i = 0; inputLine.childrenInputs != null && i < inputLine.childrenInputs.size(); i++) {
1585 errors.append(validateLine(inputLine.childrenInputs.get(i), name+"."+(i+1))); //$NON-NLS-1$
1586 }
1587 return errors;
1588 }
1589
1590 /**
1591 * Get the trace definition.
1592 *
1593 * @return The trace definition
1594 */
1595 public CustomTxtTraceDefinition getDefinition() {
1596 return definition;
1597 }
1598
1599 /**
1600 * Get the raw text of the input.
1601 *
1602 * @return The raw input text
1603 */
1604 public char[] getInputText() {
1605 return inputText.getText().toCharArray();
1606 }
1607 }
This page took 0.087343 seconds and 6 git commands to generate.