tmf: Switch tmf.ui to Java 7 + fix warnings
[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<>();
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<>();
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 try (Scanner scanner = new Scanner(inputText.getText());) {
632 scanner.useDelimiter("\n"); //$NON-NLS-1$
633
634 int rawPos = 0;
635 // skip starting delimiters
636 String skip = scanner.findWithinHorizon("\\A\n+", 0); //$NON-NLS-1$
637 if (skip != null) {
638 rawPos += skip.length();
639 }
640
641 timeStampFormat = null;
642 if (selectedLine != null) {
643 for (InputGroup input : selectedLine.inputs) {
644 input.previewText.setText(Messages.CustomTxtParserInputWizardPage_noMathcingLine);
645 }
646 }
647
648 Map<String, String> data = new HashMap<>();
649 int rootLineMatches = 0;
650 String firstEntryTimeStamp = null;
651 String firstEntryTimeStampInputFormat = null;
652 String log = null;
653 event: 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<>();
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<>();
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
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
827 private void updatePreviewLine(InputLine line, Matcher matcher, Map<String, String> data, int rawPos, int rootLineMatches) {
828 for (int i = 0; i < line.columns.size(); i++) {
829 InputData input = line.columns.get(i);
830 if (i < matcher.groupCount() && matcher.group(i+1) != null) {
831 if (line.parentInput == null) {
832 inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
833 COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
834 } else {
835 inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
836 COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
837 }
838 String value = matcher.group(i+1).trim();
839 if (selectedLine != null && selectedLine.inputLine.equals(line) && rootLineMatches == 1 &&
840 selectedLine.inputs.get(i).previewText.getText().equals(Messages.CustomTxtParserInputWizardPage_noMatchingLine)) {
841 selectedLine.inputs.get(i).previewText.setText(value);
842 }
843 if (value.length() == 0) {
844 continue;
845 }
846 if (input.action == CustomTraceDefinition.ACTION_SET) {
847 data.put(input.name, value);
848 if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
849 timeStampFormat = input.format;
850 }
851 } else if (input.action == CustomTraceDefinition.ACTION_APPEND) {
852 String s = data.get(input.name);
853 if (s != null) {
854 data.put(input.name, s + value);
855 } else {
856 data.put(input.name, value);
857 }
858 if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
859 if (timeStampFormat != null) {
860 timeStampFormat += input.format;
861 } else {
862 timeStampFormat = input.format;
863 }
864 }
865 } else if (input.action == CustomTraceDefinition.ACTION_APPEND_WITH_SEPARATOR) {
866 String s = data.get(input.name);
867 if (s != null) {
868 data.put(input.name, s + " | " + value); //$NON-NLS-1$
869 } else {
870 data.put(input.name, value);
871 }
872 if (input.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
873 if (timeStampFormat != null) {
874 timeStampFormat += " | " + input.format; //$NON-NLS-1$
875 } else {
876 timeStampFormat = input.format;
877 }
878 }
879 }
880 } else {
881 if (selectedLine != null && selectedLine.inputLine.equals(line) && rootLineMatches == 1) {
882 if (selectedLine.inputs.get(i).previewText.getText().equals(Messages.CustomTxtParserInputWizardPage_noMatchingLine)) {
883 selectedLine.inputs.get(i).previewText.setText(Messages.CustomTxtParserInputWizardPage_noMatchingGroup);
884 }
885 }
886 }
887 }
888 // highlight the matching groups that have no corresponponding input
889 for (int i = line.columns.size(); i < matcher.groupCount(); i++) {
890 if (matcher.group(i+1) != null) {
891 if (line.parentInput == null) {
892 inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
893 COLOR_BLACK, COLOR_MAGENTA));
894 } else {
895 inputText.setStyleRange(new StyleRange(rawPos + matcher.start(i+1), matcher.end(i+1) - matcher.start(i+1),
896 COLOR_BLACK, COLOR_LIGHT_MAGENTA));
897 }
898 }
899 }
900 }
901
902 private void openHelpShell(String url) {
903 if (helpBrowser != null && !helpBrowser.isDisposed()) {
904 helpBrowser.getShell().setActive();
905 if (!helpBrowser.getUrl().equals(url)) {
906 helpBrowser.setUrl(url);
907 }
908 return;
909 }
910 final Shell helpShell = new Shell(getShell(), SWT.SHELL_TRIM);
911 helpShell.setLayout(new FillLayout());
912 helpBrowser = new Browser(helpShell, SWT.NONE);
913 helpBrowser.addTitleListener(new TitleListener() {
914 @Override
915 public void changed(TitleEvent event) {
916 helpShell.setText(event.title);
917 }
918 });
919 helpBrowser.setBounds(0, 0, 600, 400);
920 helpShell.pack();
921 helpShell.open();
922 helpBrowser.setUrl(url);
923 }
924
925 private void openLegend() {
926 final String cg = Messages.CustomTxtParserInputWizardPage_capturedGroup;
927 final String ucg = Messages.CustomTxtParserInputWizardPage_unidentifiedCaptureGroup;
928 final String ut = Messages.CustomTxtParserInputWizardPage_uncapturedText;
929 int line1start = 0;
930 String line1 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine;
931 int line2start = line1start + line1.length();
932 String line2 = Messages.CustomTxtParserInputWizardPage_matchingLineRoot + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
933 int line3start = line2start + line2.length();
934 String line3 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
935 int line4start = line3start + line3.length();
936 String line4 = Messages.CustomTxtParserInputWizardPage_matchingOtherLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
937 int line5start = line4start + line4.length();
938 String line5 = Messages.CustomTxtParserInputWizardPage_nonMatchingLine;
939 int line6start = line5start + line5.length();
940 String line6 = Messages.CustomTxtParserInputWizardPage_matchingRootLine + cg + ' ' + ucg + ' ' + ut + " \n"; //$NON-NLS-1$
941
942 final Shell legendShell = new Shell(getShell(), SWT.DIALOG_TRIM);
943 legendShell.setLayout(new FillLayout());
944 StyledText legendText = new StyledText(legendShell, SWT.MULTI);
945 legendText.setFont(fixedFont);
946 legendText.setText(line1 + line2 + line3 + line4 + line5 + line6);
947 legendText.setStyleRange(new StyleRange(line2start, line2.length(), COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
948 legendText.setStyleRange(new StyleRange(line3start, line3.length(), COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
949 legendText.setStyleRange(new StyleRange(line4start, line4.length(), COLOR_BLACK, COLOR_LIGHT_YELLOW, SWT.ITALIC));
950 legendText.setStyleRange(new StyleRange(line6start, line6.length(), COLOR_BLACK, COLOR_YELLOW, SWT.ITALIC));
951 legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
952 legendText.setStyleRange(new StyleRange(line2start + line2.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_MAGENTA));
953 legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
954 legendText.setStyleRange(new StyleRange(line3start + line3.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
955 legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_LIGHT_GREEN, SWT.BOLD));
956 legendText.setStyleRange(new StyleRange(line4start + line4.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_LIGHT_MAGENTA));
957 legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(cg), cg.length(), COLOR_BLACK, COLOR_GREEN, SWT.BOLD));
958 legendText.setStyleRange(new StyleRange(line6start + line6.indexOf(ucg), ucg.length(), COLOR_BLACK, COLOR_MAGENTA));
959 legendShell.setText(Messages.CustomTxtParserInputWizardPage_previewLegend);
960 legendShell.pack();
961 legendShell.open();
962 }
963
964 private class UpdateListener implements ModifyListener, SelectionListener {
965
966 @Override
967 public void modifyText(ModifyEvent e) {
968 validate();
969 updatePreviews();
970 }
971
972 @Override
973 public void widgetDefaultSelected(SelectionEvent e) {
974 validate();
975 updatePreviews();
976 }
977
978 @Override
979 public void widgetSelected(SelectionEvent e) {
980 validate();
981 updatePreviews();
982 }
983
984 }
985
986 private class Line {
987 private static final String INFINITY_STRING = "\u221E"; //$NON-NLS-1$
988 private InputLine inputLine;
989 private Group group;
990 private Composite labelComposite;
991 private Text regexText;
992 private Composite cardinalityContainer;
993 private Combo cardinalityCombo;
994 private Label cardinalityMinLabel;
995 private Text cardinalityMinText;
996 private Label cardinalityMaxLabel;
997 private Text cardinalityMaxText;
998 private Button infiniteButton;
999 private List<InputGroup> inputs = new ArrayList<>();
1000 private Button addGroupButton;
1001 private Label addGroupLabel;
1002
1003 public Line(Composite parent, String name, InputLine inputLine) {
1004 this.inputLine = inputLine;
1005
1006 group = new Group(parent, SWT.NONE);
1007 group.setText(name);
1008 group.setLayout(new GridLayout(2, false));
1009 group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1010
1011 labelComposite = new Composite(group, SWT.FILL);
1012 GridLayout labelLayout = new GridLayout(1, false);
1013 labelLayout.marginWidth = 0;
1014 labelLayout.marginHeight = 0;
1015 labelComposite.setLayout(labelLayout);
1016 labelComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1017
1018 Label label = new Label(labelComposite, SWT.NULL);
1019 label.setText(Messages.CustomTxtParserInputWizardPage_regularExpression);
1020
1021 Composite regexContainer = new Composite(group, SWT.NONE);
1022 GridLayout regexLayout = new GridLayout(2, false);
1023 regexLayout.marginHeight = 0;
1024 regexLayout.marginWidth = 0;
1025 regexContainer.setLayout(regexLayout);
1026 regexContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1027
1028 regexText = new Text(regexContainer, SWT.BORDER | SWT.SINGLE);
1029 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
1030 gd.widthHint = 0;
1031 regexText.setLayoutData(gd);
1032 regexText.setText(inputLine.getRegex());
1033 regexText.addModifyListener(updateListener);
1034
1035 Button regexHelpButton = new Button(regexContainer, SWT.PUSH);
1036 regexHelpButton.setImage(HELP_IMAGE);
1037 regexHelpButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_regularExpressionHelp);
1038 regexHelpButton.addSelectionListener(new SelectionAdapter() {
1039 @Override
1040 public void widgetSelected(SelectionEvent e) {
1041 openHelpShell(PATTERN_URL);
1042 }
1043 });
1044
1045 label = new Label(group, SWT.NONE);
1046 label.setText(Messages.CustomTxtParserInputWizardPage_cardinality);
1047 label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1048
1049 cardinalityContainer = new Composite(group, SWT.NONE);
1050 GridLayout cardinalityLayout = new GridLayout(6, false);
1051 cardinalityLayout.marginHeight = 0;
1052 cardinalityLayout.marginWidth = 0;
1053 cardinalityContainer.setLayout(cardinalityLayout);
1054 cardinalityContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1055
1056 cardinalityCombo = new Combo(cardinalityContainer, SWT.DROP_DOWN | SWT.READ_ONLY);
1057 cardinalityCombo.setItems(new String[] {
1058 Cardinality.ZERO_OR_MORE.toString(),
1059 Cardinality.ONE_OR_MORE.toString(),
1060 Cardinality.ZERO_OR_ONE.toString(),
1061 Cardinality.ONE.toString(),
1062 "(?,?)"}); //$NON-NLS-1$
1063 cardinalityCombo.addSelectionListener(new SelectionListener() {
1064 @Override
1065 public void widgetDefaultSelected(SelectionEvent e) {}
1066
1067 @Override
1068 public void widgetSelected(SelectionEvent e) {
1069 switch (cardinalityCombo.getSelectionIndex()) {
1070 case 4: // (?,?)
1071 cardinalityMinLabel.setVisible(true);
1072 cardinalityMinText.setVisible(true);
1073 cardinalityMaxLabel.setVisible(true);
1074 cardinalityMaxText.setVisible(true);
1075 infiniteButton.setVisible(true);
1076 break;
1077 default:
1078 cardinalityMinLabel.setVisible(false);
1079 cardinalityMinText.setVisible(false);
1080 cardinalityMaxLabel.setVisible(false);
1081 cardinalityMaxText.setVisible(false);
1082 infiniteButton.setVisible(false);
1083 break;
1084 }
1085 cardinalityContainer.layout();
1086 validate();
1087 updatePreviews();
1088 }
1089 });
1090
1091 cardinalityMinLabel = new Label(cardinalityContainer, SWT.NONE);
1092 cardinalityMinLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1093 cardinalityMinLabel.setText(Messages.CustomTxtParserInputWizardPage_min);
1094 cardinalityMinLabel.setVisible(false);
1095
1096 cardinalityMinText = new Text(cardinalityContainer, SWT.BORDER | SWT.SINGLE);
1097 gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
1098 gd.widthHint = 20;
1099 cardinalityMinText.setLayoutData(gd);
1100 cardinalityMinText.setVisible(false);
1101
1102 cardinalityMaxLabel = new Label(cardinalityContainer, SWT.NONE);
1103 cardinalityMaxLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1104 cardinalityMaxLabel.setText(Messages.CustomTxtParserInputWizardPage_max);
1105 cardinalityMaxLabel.setVisible(false);
1106
1107 cardinalityMaxText = new Text(cardinalityContainer, SWT.BORDER | SWT.SINGLE);
1108 gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
1109 gd.widthHint = 20;
1110 cardinalityMaxText.setLayoutData(gd);
1111 cardinalityMaxText.setVisible(false);
1112
1113 infiniteButton = new Button(cardinalityContainer, SWT.PUSH);
1114 infiniteButton.setText(INFINITY_STRING);
1115 infiniteButton.setVisible(false);
1116 infiniteButton.addSelectionListener(new SelectionAdapter(){
1117 @Override
1118 public void widgetSelected(SelectionEvent e) {
1119 cardinalityMaxText.setText(INFINITY_STRING);
1120 }});
1121
1122 if (inputLine.cardinality.equals(Cardinality.ZERO_OR_MORE)) {
1123 cardinalityCombo.select(0);
1124 } else if (inputLine.cardinality.equals(Cardinality.ONE_OR_MORE)) {
1125 cardinalityCombo.select(1);
1126 } else if (inputLine.cardinality.equals(Cardinality.ZERO_OR_ONE)) {
1127 cardinalityCombo.select(2);
1128 } else if (inputLine.cardinality.equals(Cardinality.ONE)) {
1129 cardinalityCombo.select(3);
1130 } else {
1131 cardinalityCombo.select(4);
1132 cardinalityMinLabel.setVisible(true);
1133 cardinalityMinText.setVisible(true);
1134 if (inputLine.getMinCount() >= 0) {
1135 cardinalityMinText.setText(Integer.toString(inputLine.getMinCount()));
1136 }
1137 cardinalityMaxLabel.setVisible(true);
1138 cardinalityMaxText.setVisible(true);
1139 if (inputLine.getMaxCount() == Cardinality.INF) {
1140 cardinalityMaxText.setText(INFINITY_STRING);
1141 } else if (inputLine.getMaxCount() >= 0) {
1142 cardinalityMaxText.setText(Integer.toString(inputLine.getMaxCount()));
1143 }
1144 infiniteButton.setVisible(true);
1145 }
1146
1147 VerifyListener digitsListener = new VerifyListener() {
1148 @Override
1149 public void verifyText(VerifyEvent e) {
1150 if (e.text.equals(INFINITY_STRING)) {
1151 e.doit = e.widget == cardinalityMaxText && e.start == 0 && e.end == ((Text) e.widget).getText().length();
1152 } else {
1153 if (((Text) e.widget).getText().equals(INFINITY_STRING)) {
1154 e.doit = e.start == 0 && e.end == ((Text) e.widget).getText().length();
1155 }
1156 for (int i = 0; i < e.text.length(); i++) {
1157 if (!Character.isDigit(e.text.charAt(i))) {
1158 e.doit = false;
1159 break;
1160 }
1161 }
1162 }
1163 }};
1164
1165 cardinalityMinText.addModifyListener(updateListener);
1166 cardinalityMaxText.addModifyListener(updateListener);
1167 cardinalityMinText.addVerifyListener(digitsListener);
1168 cardinalityMaxText.addVerifyListener(digitsListener);
1169
1170 if (inputLine.columns != null) {
1171 for (InputData inputData : inputLine.columns) {
1172 InputGroup inputGroup = new InputGroup(group, this, inputs.size()+1);
1173 if (inputData.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
1174 inputGroup.tagCombo.select(0);
1175 inputGroup.tagText.setText(inputData.format);
1176 inputGroup.tagLabel.setText(Messages.CustomTxtParserInputWizardPage_format);
1177 inputGroup.tagLabel.setVisible(true);
1178 inputGroup.tagText.setVisible(true);
1179 inputGroup.tagText.addModifyListener(updateListener);
1180 } else if (inputData.name.equals(CustomTraceDefinition.TAG_MESSAGE)) {
1181 inputGroup.tagCombo.select(1);
1182 } else {
1183 inputGroup.tagCombo.select(2);
1184 inputGroup.tagText.setText(inputData.name);
1185 inputGroup.tagLabel.setText(Messages.CustomTxtParserInputWizardPage_name);
1186 inputGroup.tagLabel.setVisible(true);
1187 inputGroup.tagText.setVisible(true);
1188 inputGroup.tagText.addModifyListener(updateListener);
1189 }
1190 inputGroup.actionCombo.select(inputData.action);
1191 inputs.add(inputGroup);
1192 }
1193 }
1194
1195 createAddGroupButton();
1196 }
1197
1198 private void createAddGroupButton() {
1199 addGroupButton = new Button(group, SWT.PUSH);
1200 addGroupButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1201 addGroupButton.setImage(ADD_IMAGE);
1202 addGroupButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_addGroup);
1203 addGroupButton.addSelectionListener(new SelectionAdapter() {
1204 @Override
1205 public void widgetSelected(SelectionEvent e) {
1206 removeAddGroupButton();
1207 inputs.add(new InputGroup(group, Line.this, inputs.size()+1));
1208 createAddGroupButton();
1209 lineContainer.layout();
1210 lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
1211 group.getParent().layout();
1212 validate();
1213 updatePreviews();
1214 }
1215 });
1216
1217 addGroupLabel = new Label(group, SWT.NULL);
1218 addGroupLabel.setText(Messages.CustomTxtParserInputWizardPage_newGroup);
1219 }
1220
1221 private void removeAddGroupButton() {
1222 addGroupButton.dispose();
1223 addGroupLabel.dispose();
1224 }
1225
1226 private void removeInput(int inputNumber) {
1227 int nb = inputNumber;
1228 if (--nb < inputs.size()) {
1229 inputs.remove(nb).dispose();
1230 for (int i = nb; i < inputs.size(); i++) {
1231 inputs.get(i).setInputNumber(i+1);
1232 }
1233 lineContainer.layout();
1234 lineScrolledComposite.setMinSize(lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, lineContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-1);
1235 group.getParent().layout();
1236 }
1237 }
1238
1239 private void dispose() {
1240 group.dispose();
1241 }
1242
1243 private void extractInputs() {
1244 inputLine.setRegex(selectedLine.regexText.getText());
1245 switch (cardinalityCombo.getSelectionIndex()) {
1246 case 0:
1247 inputLine.cardinality = Cardinality.ZERO_OR_MORE;
1248 break;
1249 case 1:
1250 inputLine.cardinality = Cardinality.ONE_OR_MORE;
1251 break;
1252 case 2:
1253 inputLine.cardinality = Cardinality.ZERO_OR_ONE;
1254 break;
1255 case 3:
1256 inputLine.cardinality = Cardinality.ONE;
1257 break;
1258 case 4: //(?,?)
1259 int min, max;
1260 try {
1261 min = Integer.parseInt(cardinalityMinText.getText());
1262 } catch (NumberFormatException e) {
1263 min = -1;
1264 }
1265 try {
1266 if (cardinalityMaxText.getText().equals(INFINITY_STRING)) {
1267 max = Cardinality.INF;
1268 } else {
1269 max = Integer.parseInt(cardinalityMaxText.getText());
1270 }
1271 } catch (NumberFormatException e) {
1272 max = -1;
1273 }
1274 inputLine.cardinality = new Cardinality(min, max);
1275 break;
1276 default:
1277 inputLine.cardinality = Cardinality.ZERO_OR_MORE;
1278 break;
1279 }
1280 inputLine.columns = new ArrayList<>(inputs.size());
1281 for (int i = 0; i < inputs.size(); i++) {
1282 InputGroup grp = inputs.get(i);
1283 InputData inputData = new InputData();
1284 if (grp.tagCombo.getText().equals(CustomTraceDefinition.TAG_OTHER)) {
1285 inputData.name = grp.tagText.getText().trim();
1286 } else {
1287 inputData.name = grp.tagCombo.getText();
1288 if (grp.tagCombo.getText().equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
1289 inputData.format = grp.tagText.getText().trim();
1290 }
1291 }
1292 inputData.action = grp.actionCombo.getSelectionIndex();
1293 inputLine.columns.add(inputData);
1294 }
1295 }
1296 }
1297
1298 private class InputGroup {
1299 private Line line;
1300 private int inputNumber;
1301
1302 // children of parent (must be disposed)
1303 private Composite labelComposite;
1304 private Composite tagComposite;
1305 private Label previewLabel;
1306 private Text previewText;
1307
1308 // children of labelComposite
1309 private Label inputLabel;
1310
1311 // children of tagComposite
1312 private Combo tagCombo;
1313 private Label tagLabel;
1314 private Text tagText;
1315 private Combo actionCombo;
1316
1317 public InputGroup(Composite parent, Line line, int inputNumber) {
1318 this.line = line;
1319 this.inputNumber = inputNumber;
1320
1321 labelComposite = new Composite(parent, SWT.FILL);
1322 GridLayout labelLayout = new GridLayout(2, false);
1323 labelLayout.marginWidth = 0;
1324 labelLayout.marginHeight = 0;
1325 labelComposite.setLayout(labelLayout);
1326 labelComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1327
1328 Button deleteButton = new Button(labelComposite, SWT.PUSH);
1329 deleteButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1330 deleteButton.setImage(DELETE_IMAGE);
1331 deleteButton.setToolTipText(Messages.CustomTxtParserInputWizardPage_removeGroup);
1332 deleteButton.addSelectionListener(new SelectionAdapter() {
1333 @Override
1334 public void widgetSelected(SelectionEvent e) {
1335 InputGroup.this.line.removeInput(InputGroup.this.inputNumber);
1336 validate();
1337 updatePreviews();
1338 }
1339 });
1340
1341 inputLabel = new Label(labelComposite, SWT.NULL);
1342 inputLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1343 inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$
1344
1345 tagComposite = new Composite(parent, SWT.FILL);
1346 GridLayout tagLayout = new GridLayout(4, false);
1347 tagLayout.marginWidth = 0;
1348 tagLayout.marginHeight = 0;
1349 tagComposite.setLayout(tagLayout);
1350 tagComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
1351
1352 tagCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
1353 tagCombo.setItems(new String[] {CustomTraceDefinition.TAG_TIMESTAMP,
1354 CustomTraceDefinition.TAG_MESSAGE,
1355 CustomTraceDefinition.TAG_OTHER});
1356 tagCombo.select(1);
1357 tagCombo.addSelectionListener(new SelectionListener(){
1358 @Override
1359 public void widgetDefaultSelected(SelectionEvent e) {}
1360 @Override
1361 public void widgetSelected(SelectionEvent e) {
1362 tagText.removeModifyListener(updateListener);
1363 switch (tagCombo.getSelectionIndex()) {
1364 case 0: //Time Stamp
1365 tagLabel.setText(Messages.CustomTxtParserInputWizardPage_format);
1366 tagLabel.setVisible(true);
1367 tagText.setVisible(true);
1368 tagText.addModifyListener(updateListener);
1369 break;
1370 case 1: //Message
1371 tagLabel.setVisible(false);
1372 tagText.setVisible(false);
1373 break;
1374 case 2: //Other
1375 tagLabel.setText(Messages.CustomTxtParserInputWizardPage_name);
1376 tagLabel.setVisible(true);
1377 tagText.setVisible(true);
1378 tagText.addModifyListener(updateListener);
1379 break;
1380 case 3: //Continue
1381 tagLabel.setVisible(false);
1382 tagText.setVisible(false);
1383 break;
1384 default:
1385 break;
1386 }
1387 tagComposite.layout();
1388 validate();
1389 updatePreviews();
1390 }});
1391
1392 tagLabel = new Label(tagComposite, SWT.NULL);
1393 tagLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1394 tagLabel.setVisible(false);
1395
1396 tagText = new Text(tagComposite, SWT.BORDER | SWT.SINGLE);
1397 GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
1398 gd.widthHint = 0;
1399 tagText.setLayoutData(gd);
1400 tagText.setVisible(false);
1401
1402 actionCombo = new Combo(tagComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
1403 actionCombo.setItems(new String[] {Messages.CustomTxtParserInputWizardPage_set, Messages.CustomTxtParserInputWizardPage_append, Messages.CustomTxtParserInputWizardPage_appendWith});
1404 actionCombo.select(0);
1405 actionCombo.addSelectionListener(updateListener);
1406
1407 previewLabel = new Label(parent, SWT.NULL);
1408 previewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
1409 previewLabel.setText(Messages.CustomTxtParserInputWizardPage_preview);
1410
1411 previewText = new Text(parent, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
1412 gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
1413 gd.widthHint = 0;
1414 previewText.setLayoutData(gd);
1415 previewText.setText(Messages.CustomTxtParserInputWizardPage_noMatch);
1416 previewText.setBackground(COLOR_WIDGET_BACKGROUND);
1417 }
1418
1419 private void dispose() {
1420 labelComposite.dispose();
1421 tagComposite.dispose();
1422 previewLabel.dispose();
1423 previewText.dispose();
1424 }
1425
1426 private void setInputNumber(int inputNumber) {
1427 this.inputNumber = inputNumber;
1428 inputLabel.setText(Messages.CustomTxtParserInputWizardPage_group + inputNumber + ":"); //$NON-NLS-1$
1429 labelComposite.layout();
1430 }
1431 }
1432
1433 private void validate() {
1434
1435 definition.definitionName = logtypeText.getText().trim();
1436 definition.timeStampOutputFormat = timestampOutputFormatText.getText().trim();
1437
1438 if (selectedLine != null) {
1439 selectedLine.extractInputs();
1440 treeViewer.refresh();
1441 }
1442
1443 StringBuffer errors = new StringBuffer();
1444
1445 if (definition.definitionName.length() == 0) {
1446 errors.append("Enter a name for the new log type. "); //$NON-NLS-1$
1447 logtypeText.setBackground(COLOR_LIGHT_RED);
1448 } else {
1449 logtypeText.setBackground(COLOR_TEXT_BACKGROUND);
1450 for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {
1451 if (definition.definitionName.equals(def.definitionName) &&
1452 (editDefinitionName == null || !editDefinitionName.equals(definition.definitionName))) {
1453 errors.append("The log type name already exists. "); //$NON-NLS-1$
1454 logtypeText.setBackground(COLOR_LIGHT_RED);
1455 break;
1456 }
1457 }
1458 }
1459
1460 timestampFound = false;
1461 for (int i = 0; i < definition.inputs.size(); i++) {
1462
1463 InputLine inputLine = definition.inputs.get(i);
1464 String name = Integer.toString(i+1);
1465 errors.append(validateLine(inputLine, name));
1466 }
1467 if (timestampFound) {
1468 if (definition.timeStampOutputFormat.length() == 0) {
1469 errors.append("Enter the output format for the Time Stamp field. "); //$NON-NLS-1$
1470 timestampOutputFormatText.setBackground(COLOR_LIGHT_RED);
1471 } else {
1472 try {
1473 new SimpleDateFormat(definition.timeStampOutputFormat);
1474 timestampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
1475 } catch (IllegalArgumentException e) {
1476 errors.append("Enter a valid output format for the Time Stamp field. "); //$NON-NLS-1$
1477 timestampOutputFormatText.setBackground(COLOR_LIGHT_RED);
1478 }
1479 }
1480
1481 } else {
1482 timestampOutputFormatText.setBackground(COLOR_TEXT_BACKGROUND);
1483 }
1484
1485 if (errors.length() == 0) {
1486 setDescription(defaultDescription);
1487 setPageComplete(true);
1488 } else {
1489 setDescription(errors.toString());
1490 setPageComplete(false);
1491 }
1492 }
1493
1494 /**
1495 * Validate an input line.
1496 *
1497 * @param inputLine
1498 * The line to clean up
1499 * @param name
1500 * The name of the line
1501 * @return The cleaned up line
1502 */
1503 public StringBuffer validateLine(InputLine inputLine, String name) {
1504 StringBuffer errors = new StringBuffer();
1505 Line line = null;
1506 if (selectedLine != null && selectedLine.inputLine.equals(inputLine)) {
1507 line = selectedLine;
1508 }
1509 try {
1510 Pattern.compile(inputLine.getRegex());
1511 if (line != null) {
1512 line.regexText.setBackground(COLOR_TEXT_BACKGROUND);
1513 }
1514 } catch (PatternSyntaxException e) {
1515 errors.append("Enter a valid regular expression (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1516 if (line != null) {
1517 line.regexText.setBackground(COLOR_LIGHT_RED);
1518 }
1519 }
1520 if (inputLine.getMinCount() == -1) {
1521 errors.append("Enter a minimum value for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1522 if (line != null) {
1523 line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);
1524 }
1525 } else {
1526 if (line != null) {
1527 line.cardinalityMinText.setBackground(COLOR_TEXT_BACKGROUND);
1528 }
1529 }
1530 if (inputLine.getMaxCount() == -1) {
1531 errors.append("Enter a maximum value for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1532 if (line != null) {
1533 line.cardinalityMaxText.setBackground(COLOR_LIGHT_RED);
1534 }
1535 } else if (inputLine.getMinCount() > inputLine.getMaxCount()) {
1536 errors.append("Enter correct (min <= max) values for cardinality (Line "+name+"). "); //$NON-NLS-1$ //$NON-NLS-2$
1537 if (line != null) {
1538 line.cardinalityMinText.setBackground(COLOR_LIGHT_RED);
1539 }
1540 if (line != null) {
1541 line.cardinalityMaxText.setBackground(COLOR_LIGHT_RED);
1542 }
1543 } else {
1544 if (line != null) {
1545 line.cardinalityMaxText.setBackground(COLOR_TEXT_BACKGROUND);
1546 }
1547 }
1548 for (int i = 0; inputLine.columns != null && i < inputLine.columns.size(); i++) {
1549 InputData inputData = inputLine.columns.get(i);
1550 InputGroup group = null;
1551 if (line != null) {
1552 group = line.inputs.get(i);
1553 }
1554 if (inputData.name.equals(CustomTraceDefinition.TAG_TIMESTAMP)) {
1555 timestampFound = true;
1556 if (inputData.format.length() == 0) {
1557 errors.append("Enter the input format for the Time Stamp (Line "+name+" Group "+(i+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1558 if (group != null) {
1559 group.tagText.setBackground(COLOR_LIGHT_RED);
1560 }
1561 } else {
1562 try {
1563 new SimpleDateFormat(inputData.format);
1564 if (group != null) {
1565 group.tagText.setBackground(COLOR_TEXT_BACKGROUND);
1566 }
1567 } catch (IllegalArgumentException e) {
1568 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$
1569 if (group != null) {
1570 group.tagText.setBackground(COLOR_LIGHT_RED);
1571 }
1572 }
1573 }
1574 } else if (inputData.name.length() == 0) {
1575 errors.append("Enter a name for the data group (Line "+name+" Group "+(i+1)+"). "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1576 if (group != null) {
1577 group.tagText.setBackground(COLOR_LIGHT_RED);
1578 }
1579 } else {
1580 if (group != null) {
1581 group.tagText.setBackground(COLOR_TEXT_BACKGROUND);
1582 }
1583 }
1584 }
1585 for (int i = 0; inputLine.childrenInputs != null && i < inputLine.childrenInputs.size(); i++) {
1586 errors.append(validateLine(inputLine.childrenInputs.get(i), name+"."+(i+1))); //$NON-NLS-1$
1587 }
1588 return errors;
1589 }
1590
1591 /**
1592 * Get the trace definition.
1593 *
1594 * @return The trace definition
1595 */
1596 public CustomTxtTraceDefinition getDefinition() {
1597 return definition;
1598 }
1599
1600 /**
1601 * Get the raw text of the input.
1602 *
1603 * @return The raw input text
1604 */
1605 public char[] getInputText() {
1606 return inputText.getText().toCharArray();
1607 }
1608 }
This page took 0.097828 seconds and 5 git commands to generate.