1 /*******************************************************************************
2 * Copyright (c) 2010, 2013 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.filter
;
15 import java
.util
.ArrayList
;
16 import java
.util
.LinkedHashMap
;
18 import java
.util
.Map
.Entry
;
20 import org
.eclipse
.core
.runtime
.CoreException
;
21 import org
.eclipse
.core
.runtime
.IConfigurationElement
;
22 import org
.eclipse
.jface
.action
.Action
;
23 import org
.eclipse
.jface
.action
.IMenuListener
;
24 import org
.eclipse
.jface
.action
.IMenuManager
;
25 import org
.eclipse
.jface
.action
.MenuManager
;
26 import org
.eclipse
.jface
.action
.Separator
;
27 import org
.eclipse
.jface
.viewers
.ISelection
;
28 import org
.eclipse
.jface
.viewers
.ISelectionChangedListener
;
29 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
30 import org
.eclipse
.jface
.viewers
.SelectionChangedEvent
;
31 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
32 import org
.eclipse
.jface
.viewers
.TreeViewer
;
33 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Messages
;
34 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomTraceDefinition
.OutputColumn
;
35 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomTxtEvent
;
36 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomTxtTraceDefinition
;
37 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomXmlEvent
;
38 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.parsers
.custom
.CustomXmlTraceDefinition
;
39 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
40 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEventType
;
41 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.ITmfFilterTreeNode
;
42 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterAndNode
;
43 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterCompareNode
;
44 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterCompareNode
.Type
;
45 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterContainsNode
;
46 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterEqualsNode
;
47 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterEventTypeNode
;
48 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterMatchesNode
;
49 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterNode
;
50 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterOrNode
;
51 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterRootNode
;
52 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterTreeNode
;
53 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfTraceType
;
54 import org
.eclipse
.swt
.SWT
;
55 import org
.eclipse
.swt
.custom
.SashForm
;
56 import org
.eclipse
.swt
.events
.FocusEvent
;
57 import org
.eclipse
.swt
.events
.FocusListener
;
58 import org
.eclipse
.swt
.events
.ModifyEvent
;
59 import org
.eclipse
.swt
.events
.ModifyListener
;
60 import org
.eclipse
.swt
.events
.PaintEvent
;
61 import org
.eclipse
.swt
.events
.PaintListener
;
62 import org
.eclipse
.swt
.events
.SelectionAdapter
;
63 import org
.eclipse
.swt
.events
.SelectionEvent
;
64 import org
.eclipse
.swt
.layout
.FillLayout
;
65 import org
.eclipse
.swt
.layout
.GridData
;
66 import org
.eclipse
.swt
.layout
.GridLayout
;
67 import org
.eclipse
.swt
.widgets
.Button
;
68 import org
.eclipse
.swt
.widgets
.Combo
;
69 import org
.eclipse
.swt
.widgets
.Composite
;
70 import org
.eclipse
.swt
.widgets
.Control
;
71 import org
.eclipse
.swt
.widgets
.Display
;
72 import org
.eclipse
.swt
.widgets
.Label
;
73 import org
.eclipse
.swt
.widgets
.Menu
;
74 import org
.eclipse
.swt
.widgets
.Text
;
75 import org
.eclipse
.swt
.widgets
.TreeItem
;
77 class FilterViewer
extends Composite
{
79 private static final String CUSTOM_TXT_CATEGORY
= "Custom Text"; //$NON-NLS-1$
80 private static final String CUSTOM_XML_CATEGORY
= "Custom XML"; //$NON-NLS-1$
82 private TreeViewer fViewer
;
83 private Composite fComposite
;
85 public FilterViewer(Composite parent
, int style
) {
88 setLayout(new FillLayout());
89 GridData gd
= new GridData(SWT
.FILL
, SWT
.FILL
, true, true);
92 final SashForm sash
= new SashForm(this, SWT
.HORIZONTAL
);
94 // Create the tree viewer to display the filter tree
95 fViewer
= new TreeViewer(sash
, SWT
.NONE
);
96 fViewer
.setContentProvider(new FilterTreeContentProvider());
97 fViewer
.setLabelProvider(new FilterTreeLabelProvider());
98 fViewer
.setInput(new TmfFilterRootNode());
100 // Create the empty filter node properties panel
101 fComposite
= new Composite(sash
, SWT
.NONE
);
102 GridLayout gl
= new GridLayout();
105 fComposite
.setLayout(gl
);
109 fViewer
.addSelectionChangedListener(new ISelectionChangedListener() {
111 public void selectionChanged(SelectionChangedEvent event
) {
112 if (!(event
.getSelection().isEmpty()) && event
.getSelection() instanceof IStructuredSelection
) {
113 // Update the filter node properties panel to the selection
114 IStructuredSelection selection
= (IStructuredSelection
) event
.getSelection();
115 ITmfFilterTreeNode node
= (ITmfFilterTreeNode
) selection
.getFirstElement();
116 updateFilterNodeComposite(node
);
117 // Highlight the selection's children
118 highlightTreeItems(fViewer
.getTree().getSelection()[0].getItems());
120 updateFilterNodeComposite(null);
125 fViewer
.getTree().addPaintListener(new PaintListener() {
127 public void paintControl(PaintEvent e
) {
128 TmfFilterTreeNode root
= (TmfFilterTreeNode
) fViewer
.getInput();
129 if (root
== null || root
.getChildrenCount() == 0) {
130 e
.gc
.setForeground(Display
.getDefault().getSystemColor(SWT
.COLOR_BLACK
));
131 e
.gc
.drawText(Messages
.FilterViewer_EmptyTreeHintText
, 5, 0);
138 * Create the context menu for the tree viewer
140 private void createContextMenu() {
141 // Adds root context menu
142 MenuManager menuManager
= new MenuManager();
143 menuManager
.setRemoveAllWhenShown(true);
144 menuManager
.addMenuListener(new IMenuListener() {
146 public void menuAboutToShow(IMenuManager manager
) {
147 fillContextMenu(manager
);
152 Menu contextMenu
= menuManager
.createContextMenu(fViewer
.getTree());
155 fViewer
.getTree().setMenu(contextMenu
);
159 * Fill the context menu for the tree viewer.
164 protected void fillContextMenu(IMenuManager manager
) {
165 final ISelection selection
= fViewer
.getSelection();
166 ITmfFilterTreeNode filterTreeNode
= null;
167 if (selection
instanceof StructuredSelection
) {
168 Object element
= ((StructuredSelection
) selection
).getFirstElement();
169 if (element
instanceof ITmfFilterTreeNode
) {
170 filterTreeNode
= (ITmfFilterTreeNode
) element
;
174 final ITmfFilterTreeNode selectedNode
= filterTreeNode
;
176 if (selectedNode
!= null) {
178 fillContextMenuForNode(selectedNode
, manager
);
180 if (selectedNode
.getValidChildren().size() > 0) {
181 manager
.add(new Separator());
184 Action deleteAction
= new Action() {
187 selectedNode
.remove();
191 deleteAction
.setText(Messages
.FilterViewer_DeleteActionText
);
192 manager
.add(deleteAction
);
194 manager
.add(new Separator());
197 if (fViewer
.getInput() instanceof TmfFilterRootNode
|| selectedNode
== null) {
198 final ITmfFilterTreeNode root
= (ITmfFilterTreeNode
) fViewer
.getInput();
200 fillContextMenuForNode(root
, manager
);
205 * Fill the context menu with the valid children of the provided node
212 protected void fillContextMenuForNode(final ITmfFilterTreeNode node
, IMenuManager manager
) {
213 for (final String child
: node
.getValidChildren()) {
214 final Action action
= new Action() {
217 ITmfFilterTreeNode newNode
= null;
218 if (TmfFilterNode
.NODE_NAME
.equals(child
)) {
219 newNode
= new TmfFilterNode(node
, ""); //$NON-NLS-1$
220 } else if (TmfFilterEventTypeNode
.NODE_NAME
.equals(child
)) {
221 newNode
= new TmfFilterEventTypeNode(node
);
222 } else if (TmfFilterAndNode
.NODE_NAME
.equals(child
)) {
223 newNode
= new TmfFilterAndNode(node
);
224 } else if (TmfFilterOrNode
.NODE_NAME
.equals(child
)) {
225 newNode
= new TmfFilterOrNode(node
);
226 } else if (TmfFilterContainsNode
.NODE_NAME
.equals(child
)) {
227 newNode
= new TmfFilterContainsNode(node
);
228 } else if (TmfFilterEqualsNode
.NODE_NAME
.equals(child
)) {
229 newNode
= new TmfFilterEqualsNode(node
);
230 } else if (TmfFilterMatchesNode
.NODE_NAME
.equals(child
)) {
231 newNode
= new TmfFilterMatchesNode(node
);
232 } else if (TmfFilterCompareNode
.NODE_NAME
.equals(child
)) {
233 newNode
= new TmfFilterCompareNode(node
);
235 if (newNode
!= null) {
237 fViewer
.setSelection(new StructuredSelection(newNode
), true);
241 if (TmfFilterNode
.NODE_NAME
.equals(child
)) {
242 action
.setText(Messages
.FilterViewer_NewPrefix
+ " " + child
); //$NON-NLS-1$
244 action
.setText(child
);
251 * Create the appropriate filter node properties composite
253 private void updateFilterNodeComposite(ITmfFilterTreeNode node
) {
254 for (Control control
: fComposite
.getChildren()) {
258 if (node
instanceof TmfFilterNode
) {
259 new FilterNodeComposite(fComposite
, (TmfFilterNode
) node
);
260 } else if (node
instanceof TmfFilterEventTypeNode
) {
261 new FilterEventTypeNodeComposite(fComposite
, (TmfFilterEventTypeNode
) node
);
262 } else if (node
instanceof TmfFilterAndNode
) {
263 new FilterAndNodeComposite(fComposite
, (TmfFilterAndNode
) node
);
264 } else if (node
instanceof TmfFilterOrNode
) {
265 new FilterOrNodeComposite(fComposite
, (TmfFilterOrNode
) node
);
266 } else if (node
instanceof TmfFilterContainsNode
) {
267 new FilterContainsNodeComposite(fComposite
, (TmfFilterContainsNode
) node
);
268 } else if (node
instanceof TmfFilterEqualsNode
) {
269 new FilterEqualsNodeComposite(fComposite
, (TmfFilterEqualsNode
) node
);
270 } else if (node
instanceof TmfFilterMatchesNode
) {
271 new FilterMatchesNodeComposite(fComposite
, (TmfFilterMatchesNode
) node
);
272 } else if (node
instanceof TmfFilterCompareNode
) {
273 new FilterCompareNodeComposite(fComposite
, (TmfFilterCompareNode
) node
);
275 new FilterBaseNodeComposite(fComposite
);
281 * Highlight the provided tree items
283 private void highlightTreeItems(TreeItem
[] items
) {
284 resetTreeItems(fViewer
.getTree().getItems());
285 for (TreeItem item
: items
) {
286 item
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLUE
));
292 * Reset the provided tree items (remove highlight)
294 private void resetTreeItems(TreeItem
[] items
) {
295 for (TreeItem item
: items
) {
296 item
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
297 resetTreeItems(item
.getItems());
301 public void setInput(ITmfFilterTreeNode root
) {
302 fViewer
.setInput(root
);
305 updateFilterNodeComposite(null);
308 public ITmfFilterTreeNode
getInput() {
309 return (ITmfFilterTreeNode
) fViewer
.getInput();
312 public void refresh() {
316 public void setSelection(ITmfFilterTreeNode node
, boolean reveal
) {
317 fViewer
.setSelection(new StructuredSelection(node
), reveal
);
320 public void setSelection(ITmfFilterTreeNode node
) {
321 fViewer
.setSelection(new StructuredSelection(node
));
324 public ITmfFilterTreeNode
getSelection() {
325 final ISelection selection
= fViewer
.getSelection();
326 ITmfFilterTreeNode filterTreeNode
= null;
327 if (selection
instanceof StructuredSelection
) {
328 Object element
= ((StructuredSelection
) selection
).getFirstElement();
329 if (element
instanceof ITmfFilterTreeNode
) {
330 filterTreeNode
= (ITmfFilterTreeNode
) element
;
334 final ITmfFilterTreeNode selectedNode
= filterTreeNode
;
338 public void addSelectionChangedListener(ISelectionChangedListener listener
) {
339 fViewer
.addSelectionChangedListener(listener
);
342 public void removeSelectionChangedListener(ISelectionChangedListener listener
) {
343 fViewer
.removeSelectionChangedListener(listener
);
346 private class FilterBaseNodeComposite
extends Composite
{
348 FilterBaseNodeComposite(Composite parent
) {
349 super(parent
, SWT
.NONE
);
350 setLayout(new GridLayout(2, false));
351 setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
352 setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
355 protected String
[] getFieldsList(ITmfFilterTreeNode node
) {
356 ArrayList
<String
> fieldsList
= new ArrayList
<String
>();
357 ITmfFilterTreeNode curNode
= node
;
358 while (curNode
!= null) {
359 if (curNode
instanceof TmfFilterEventTypeNode
) {
360 TmfFilterEventTypeNode eventTypeNode
= (TmfFilterEventTypeNode
) curNode
;
361 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
362 if (ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
).equals(eventTypeNode
.getEventType())) {
364 ITmfEvent event
= (ITmfEvent
) ce
.createExecutableExtension(TmfTraceType
.EVENT_TYPE_ATTR
);
365 ITmfEventType eventType
= event
.getType();
366 if (eventType
!= null) {
367 for (String field
: eventType
.getRootField().getFieldNames()) {
368 fieldsList
.add(field
);
371 } catch (CoreException e
) {
373 if (fieldsList
.size() == 0) {
374 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TIMESTAMP
);
375 fieldsList
.add(ITmfEvent
.EVENT_FIELD_SOURCE
);
376 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TYPE
);
377 fieldsList
.add(ITmfEvent
.EVENT_FIELD_REFERENCE
);
378 fieldsList
.add(ITmfEvent
.EVENT_FIELD_CONTENT
);
380 return fieldsList
.toArray(new String
[0]);
383 if (eventTypeNode
.getEventType() != null && eventTypeNode
.getEventType().startsWith(CustomTxtEvent
.class.getCanonicalName())) {
384 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
385 if (eventTypeNode
.getEventType().equals(CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
)) { //$NON-NLS-1$
386 for (OutputColumn output
: def
.outputs
) {
387 fieldsList
.add(output
.name
);
389 return fieldsList
.toArray(new String
[0]);
393 if (eventTypeNode
.getEventType() != null && eventTypeNode
.getEventType().startsWith(CustomXmlEvent
.class.getCanonicalName())) {
394 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
395 if (eventTypeNode
.getEventType().equals(CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
)) { //$NON-NLS-1$
396 for (OutputColumn output
: def
.outputs
) {
397 fieldsList
.add(output
.name
);
399 return fieldsList
.toArray(new String
[0]);
404 curNode
= curNode
.getParent();
407 fieldsList
.add(Messages
.FilterViewer_CommonCategory
);
408 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TIMESTAMP
);
409 fieldsList
.add(ITmfEvent
.EVENT_FIELD_SOURCE
);
410 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TYPE
);
411 fieldsList
.add(ITmfEvent
.EVENT_FIELD_REFERENCE
);
412 fieldsList
.add(ITmfEvent
.EVENT_FIELD_CONTENT
);
413 fieldsList
.add(""); //$NON-NLS-1$
415 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
417 ITmfEvent event
= (ITmfEvent
) ce
.createExecutableExtension(TmfTraceType
.EVENT_TYPE_ATTR
);
418 ITmfEventType eventType
= event
.getType();
419 if (eventType
!= null && eventType
.getFieldNames().length
> 0) {
420 fieldsList
.add("[" + TmfTraceType
.getCategoryName(ce
.getAttribute(TmfTraceType
.CATEGORY_ATTR
)) + //$NON-NLS-1$
421 " : " + ce
.getAttribute(TmfTraceType
.NAME_ATTR
) + "]"); //$NON-NLS-1$ //$NON-NLS-2$
422 for (String field
: eventType
.getFieldNames()) {
423 fieldsList
.add(field
);
425 fieldsList
.add(""); //$NON-NLS-1$
427 } catch (CoreException e
) {
430 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
431 if (def
.outputs
.size() > 0) {
432 fieldsList
.add("[" + CUSTOM_TXT_CATEGORY
+ //$NON-NLS-1$
433 " : " + def
.definitionName
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$
434 for (OutputColumn output
: def
.outputs
) {
435 fieldsList
.add(output
.name
);
437 fieldsList
.add(""); //$NON-NLS-1$
440 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
441 if (def
.outputs
.size() > 0) {
442 fieldsList
.add("[" + CUSTOM_XML_CATEGORY
+ //$NON-NLS-1$
443 " : " + def
.definitionName
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$
444 for (OutputColumn output
: def
.outputs
) {
445 fieldsList
.add(output
.name
);
447 fieldsList
.add(""); //$NON-NLS-1$
450 return fieldsList
.toArray(new String
[0]);
454 private class FilterNodeComposite
extends FilterBaseNodeComposite
{
458 FilterNodeComposite(Composite parent
, TmfFilterNode node
) {
462 Label label
= new Label(this, SWT
.NONE
);
463 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
464 label
.setText(Messages
.FilterViewer_NameLabel
);
466 fNameText
= new Text(this, SWT
.BORDER
);
467 fNameText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
468 if (node
.getFilterName() != null && node
.getFilterName().length() > 0) {
469 fNameText
.setText(node
.getFilterName());
471 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
472 fNameText
.setText(Messages
.FilterViewer_FilterNameHint
);
474 fNameText
.addFocusListener(new FocusListener() {
476 public void focusLost(FocusEvent e
) {
477 if (fNode
.getFilterName() == null || fNode
.getFilterName().length() == 0) {
478 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
479 fNameText
.setText(Messages
.FilterViewer_FilterNameHint
);
483 public void focusGained(FocusEvent e
) {
484 if (fNameText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
485 fNameText
.setText(""); //$NON-NLS-1$
487 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
490 fNameText
.addModifyListener(new ModifyListener() {
492 public void modifyText(ModifyEvent e
) {
493 if (! fNameText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
494 fNode
.setFilterName(fNameText
.getText());
495 fViewer
.refresh(fNode
);
502 private class FilterEventTypeNodeComposite
extends FilterBaseNodeComposite
{
503 TmfFilterEventTypeNode fNode
;
505 Map
<String
, Object
> fEventsTypeMap
;
507 FilterEventTypeNodeComposite(Composite parent
, TmfFilterEventTypeNode node
) {
510 fEventsTypeMap
= getEventsTypeMap();
512 Label label
= new Label(this, SWT
.NONE
);
513 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
514 label
.setText(Messages
.FilterViewer_TypeLabel
);
516 fTypeCombo
= new Combo(this, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
517 fTypeCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
518 fTypeCombo
.setItems(fEventsTypeMap
.keySet().toArray(new String
[0]));
519 if (fNode
.getEventType() != null) {
520 for (Entry
<String
, Object
> eventTypeEntry
: fEventsTypeMap
.entrySet()) {
521 Object value
= eventTypeEntry
.getValue();
522 if (value
instanceof IConfigurationElement
) {
523 IConfigurationElement ce
= (IConfigurationElement
) value
;
524 if (ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
).equals(fNode
.getEventType())) {
525 fTypeCombo
.setText(eventTypeEntry
.getKey());
527 } else if (value
instanceof CustomTxtTraceDefinition
) {
528 CustomTxtTraceDefinition def
= (CustomTxtTraceDefinition
) value
;
529 String eventType
= CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
; //$NON-NLS-1$
530 if (eventType
.equals(fNode
.getEventType())) {
531 fTypeCombo
.setText(eventTypeEntry
.getKey());
533 } else if (value
instanceof CustomXmlTraceDefinition
) {
534 CustomXmlTraceDefinition def
= (CustomXmlTraceDefinition
) value
;
535 String eventType
= CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
; //$NON-NLS-1$
536 if (eventType
.equals(fNode
.getEventType())) {
537 fTypeCombo
.setText(eventTypeEntry
.getKey());
542 fTypeCombo
.addModifyListener(new ModifyListener() {
544 public void modifyText(ModifyEvent e
) {
545 for (Entry
<String
, Object
> eventTypeEntry
: fEventsTypeMap
.entrySet()) {
546 if (eventTypeEntry
.getKey().equals(fTypeCombo
.getText())) {
547 Object value
= eventTypeEntry
.getValue();
548 if (value
instanceof IConfigurationElement
) {
549 IConfigurationElement ce
= (IConfigurationElement
) value
;
550 fNode
.setEventType(ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
));
551 fNode
.setName(ce
.getAttribute(TmfTraceType
.NAME_ATTR
));
552 } else if (value
instanceof CustomTxtTraceDefinition
) {
553 CustomTxtTraceDefinition def
= (CustomTxtTraceDefinition
) value
;
554 fNode
.setEventType(CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
); //$NON-NLS-1$
555 fNode
.setName(def
.definitionName
);
556 } else if (value
instanceof CustomXmlTraceDefinition
) {
557 CustomXmlTraceDefinition def
= (CustomXmlTraceDefinition
) value
;
558 fNode
.setEventType(CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
); //$NON-NLS-1$
559 fNode
.setName(def
.definitionName
);
561 fViewer
.refresh(fNode
);
569 protected Map
<String
, Object
> getEventsTypeMap() {
570 Map
<String
, Object
> eventsTypeMap
= new LinkedHashMap
<String
, Object
>();
571 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
572 String categoryName
= TmfTraceType
.getCategoryName(ce
.getAttribute(TmfTraceType
.CATEGORY_ATTR
));
573 String text
= categoryName
+ " : " + ce
.getAttribute(TmfTraceType
.NAME_ATTR
); //$NON-NLS-1$
574 eventsTypeMap
.put(text
, ce
);
576 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
577 String text
= CUSTOM_TXT_CATEGORY
+ " : " + def
.definitionName
; //$NON-NLS-1$
578 eventsTypeMap
.put(text
, def
);
580 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
581 String text
= CUSTOM_XML_CATEGORY
+ " : " + def
.definitionName
; //$NON-NLS-1$
582 eventsTypeMap
.put(text
, def
);
584 return eventsTypeMap
;
588 private class FilterAndNodeComposite
extends FilterBaseNodeComposite
{
589 TmfFilterAndNode fNode
;
592 FilterAndNodeComposite(Composite parent
, TmfFilterAndNode node
) {
596 Label label
= new Label(this, SWT
.NONE
);
597 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
598 label
.setText(Messages
.FilterViewer_NotLabel
);
600 fNotButton
= new Button(this, SWT
.CHECK
);
601 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
602 fNotButton
.setSelection(fNode
.isNot());
603 fNotButton
.addSelectionListener(new SelectionAdapter() {
605 public void widgetSelected(SelectionEvent e
) {
606 fNode
.setNot(fNotButton
.getSelection());
607 fViewer
.refresh(fNode
);
613 private class FilterOrNodeComposite
extends FilterBaseNodeComposite
{
614 TmfFilterOrNode fNode
;
617 FilterOrNodeComposite(Composite parent
, TmfFilterOrNode node
) {
621 Label label
= new Label(this, SWT
.NONE
);
622 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
623 label
.setText(Messages
.FilterViewer_NotLabel
);
625 fNotButton
= new Button(this, SWT
.CHECK
);
626 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
627 fNotButton
.setSelection(fNode
.isNot());
628 fNotButton
.addSelectionListener(new SelectionAdapter() {
630 public void widgetSelected(SelectionEvent e
) {
631 fNode
.setNot(fNotButton
.getSelection());
632 fViewer
.refresh(fNode
);
638 private class FilterContainsNodeComposite
extends FilterBaseNodeComposite
{
639 TmfFilterContainsNode fNode
;
643 Button fIgnoreCaseButton
;
645 FilterContainsNodeComposite(Composite parent
, TmfFilterContainsNode node
) {
649 Label label
= new Label(this, SWT
.NONE
);
650 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
651 label
.setText(Messages
.FilterViewer_NotLabel
);
653 fNotButton
= new Button(this, SWT
.CHECK
);
654 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
655 fNotButton
.setSelection(fNode
.isNot());
656 fNotButton
.addSelectionListener(new SelectionAdapter() {
658 public void widgetSelected(SelectionEvent e
) {
659 fNode
.setNot(fNotButton
.getSelection());
660 fViewer
.refresh(fNode
);
664 label
= new Label(this, SWT
.NONE
);
665 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
666 label
.setText(Messages
.FilterViewer_FieldLabel
);
668 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
669 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
670 fFieldCombo
.setItems(getFieldsList(fNode
));
671 if (fNode
.getField() != null) {
672 fFieldCombo
.setText(fNode
.getField());
674 fFieldCombo
.addModifyListener(new ModifyListener() {
676 public void modifyText(ModifyEvent e
) {
677 fNode
.setField(fFieldCombo
.getText());
678 fViewer
.refresh(fNode
);
682 label
= new Label(this, SWT
.NONE
);
683 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
684 label
.setText(Messages
.FilterViewer_ValueLabel
);
686 fValueText
= new Text(this, SWT
.BORDER
);
687 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
688 if (node
.getValue() != null && node
.getValue().length() > 0) {
689 fValueText
.setText(node
.getValue());
691 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
692 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
694 fValueText
.addFocusListener(new FocusListener() {
696 public void focusLost(FocusEvent e
) {
697 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
698 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
699 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
703 public void focusGained(FocusEvent e
) {
704 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
705 fValueText
.setText(""); //$NON-NLS-1$
707 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
710 fValueText
.addModifyListener(new ModifyListener() {
712 public void modifyText(ModifyEvent e
) {
713 if (! fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
714 fNode
.setValue(fValueText
.getText());
715 fViewer
.refresh(fNode
);
720 label
= new Label(this, SWT
.NONE
);
721 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
723 fIgnoreCaseButton
= new Button(this, SWT
.CHECK
);
724 fIgnoreCaseButton
.setSelection(fNode
.isIgnoreCase());
725 fIgnoreCaseButton
.setText(Messages
.FilterViewer_IgnoreCaseButtonText
);
726 fIgnoreCaseButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
727 fIgnoreCaseButton
.addSelectionListener(new SelectionAdapter() {
729 public void widgetSelected(SelectionEvent e
) {
730 fNode
.setIgnoreCase(fIgnoreCaseButton
.getSelection());
731 fViewer
.refresh(fNode
);
737 private class FilterEqualsNodeComposite
extends FilterBaseNodeComposite
{
738 TmfFilterEqualsNode fNode
;
742 Button fIgnoreCaseButton
;
744 FilterEqualsNodeComposite(Composite parent
, TmfFilterEqualsNode node
) {
748 Label label
= new Label(this, SWT
.NONE
);
749 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
750 label
.setText(Messages
.FilterViewer_NotLabel
);
752 fNotButton
= new Button(this, SWT
.CHECK
);
753 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
754 fNotButton
.setSelection(fNode
.isNot());
755 fNotButton
.addSelectionListener(new SelectionAdapter() {
757 public void widgetSelected(SelectionEvent e
) {
758 fNode
.setNot(fNotButton
.getSelection());
759 fViewer
.refresh(fNode
);
763 label
= new Label(this, SWT
.NONE
);
764 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
765 label
.setText(Messages
.FilterViewer_FieldLabel
);
767 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
768 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
769 fFieldCombo
.setItems(getFieldsList(fNode
));
770 if (fNode
.getField() != null) {
771 fFieldCombo
.setText(fNode
.getField());
773 fFieldCombo
.addModifyListener(new ModifyListener() {
775 public void modifyText(ModifyEvent e
) {
776 fNode
.setField(fFieldCombo
.getText());
777 fViewer
.refresh(fNode
);
781 label
= new Label(this, SWT
.NONE
);
782 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
783 label
.setText(Messages
.FilterViewer_ValueLabel
);
785 fValueText
= new Text(this, SWT
.BORDER
);
786 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
787 if (node
.getValue() != null && node
.getValue().length() > 0) {
788 fValueText
.setText(node
.getValue());
790 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
791 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
793 fValueText
.addFocusListener(new FocusListener() {
795 public void focusLost(FocusEvent e
) {
796 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
797 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
798 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
802 public void focusGained(FocusEvent e
) {
803 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
804 fValueText
.setText(""); //$NON-NLS-1$
806 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
809 fValueText
.addModifyListener(new ModifyListener() {
811 public void modifyText(ModifyEvent e
) {
812 if (! fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
813 fNode
.setValue(fValueText
.getText());
814 fViewer
.refresh(fNode
);
819 label
= new Label(this, SWT
.NONE
);
820 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
822 fIgnoreCaseButton
= new Button(this, SWT
.CHECK
);
823 fIgnoreCaseButton
.setSelection(fNode
.isIgnoreCase());
824 fIgnoreCaseButton
.setText(Messages
.FilterViewer_IgnoreCaseButtonText
);
825 fIgnoreCaseButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
826 fIgnoreCaseButton
.addSelectionListener(new SelectionAdapter() {
828 public void widgetSelected(SelectionEvent e
) {
829 fNode
.setIgnoreCase(fIgnoreCaseButton
.getSelection());
830 fViewer
.refresh(fNode
);
836 private class FilterMatchesNodeComposite
extends FilterBaseNodeComposite
{
837 TmfFilterMatchesNode fNode
;
842 FilterMatchesNodeComposite(Composite parent
, TmfFilterMatchesNode node
) {
846 Label label
= new Label(this, SWT
.NONE
);
847 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
848 label
.setText(Messages
.FilterViewer_NotLabel
);
850 fNotButton
= new Button(this, SWT
.CHECK
);
851 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
852 fNotButton
.setSelection(fNode
.isNot());
853 fNotButton
.addSelectionListener(new SelectionAdapter() {
855 public void widgetSelected(SelectionEvent e
) {
856 fNode
.setNot(fNotButton
.getSelection());
857 fViewer
.refresh(fNode
);
861 label
= new Label(this, SWT
.NONE
);
862 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
863 label
.setText(Messages
.FilterViewer_FieldLabel
);
865 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
866 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
867 fFieldCombo
.setItems(getFieldsList(fNode
));
868 if (fNode
.getField() != null) {
869 fFieldCombo
.setText(fNode
.getField());
871 fFieldCombo
.addModifyListener(new ModifyListener() {
873 public void modifyText(ModifyEvent e
) {
874 fNode
.setField(fFieldCombo
.getText());
875 fViewer
.refresh(fNode
);
879 label
= new Label(this, SWT
.NONE
);
880 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
881 label
.setText(Messages
.FilterViewer_RegexLabel
);
883 fRegexText
= new Text(this, SWT
.BORDER
);
884 fRegexText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
885 if (node
.getRegex() != null && node
.getRegex().length() > 0) {
886 fRegexText
.setText(node
.getRegex());
888 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
889 fRegexText
.setText(Messages
.FilterViewer_RegexHint
);
891 fRegexText
.addFocusListener(new FocusListener() {
893 public void focusLost(FocusEvent e
) {
894 if (fNode
.getRegex() == null || fNode
.getRegex().length() == 0) {
895 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
896 fRegexText
.setText(Messages
.FilterViewer_RegexHint
);
900 public void focusGained(FocusEvent e
) {
901 if (fRegexText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
902 fRegexText
.setText(""); //$NON-NLS-1$
904 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
907 fRegexText
.addModifyListener(new ModifyListener() {
909 public void modifyText(ModifyEvent e
) {
910 if (! fRegexText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
911 fNode
.setRegex(fRegexText
.getText());
912 fViewer
.refresh(fNode
);
919 private class FilterCompareNodeComposite
extends FilterBaseNodeComposite
{
920 TmfFilterCompareNode fNode
;
929 Button fTimestampButton
;
931 FilterCompareNodeComposite(Composite parent
, TmfFilterCompareNode node
) {
935 Label label
= new Label(this, SWT
.NONE
);
936 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
937 label
.setText(Messages
.FilterViewer_NotLabel
);
939 fNotButton
= new Button(this, SWT
.CHECK
);
940 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
941 fNotButton
.setSelection(fNode
.isNot());
942 fNotButton
.addSelectionListener(new SelectionAdapter() {
944 public void widgetSelected(SelectionEvent e
) {
945 fNode
.setNot(fNotButton
.getSelection());
946 fViewer
.refresh(fNode
);
950 label
= new Label(this, SWT
.NONE
);
951 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
952 label
.setText(Messages
.FilterViewer_FieldLabel
);
954 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
955 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
956 fFieldCombo
.setItems(getFieldsList(fNode
));
957 if (fNode
.getField() != null) {
958 fFieldCombo
.setText(fNode
.getField());
960 fFieldCombo
.addModifyListener(new ModifyListener() {
962 public void modifyText(ModifyEvent e
) {
963 fNode
.setField(fFieldCombo
.getText());
964 fViewer
.refresh(fNode
);
968 label
= new Label(this, SWT
.NONE
);
969 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
970 label
.setText(Messages
.FilterViewer_ResultLabel
);
972 Composite resultGroup
= new Composite(this, SWT
.NONE
);
973 GridLayout rggl
= new GridLayout(3, true);
974 rggl
.marginHeight
= 0;
975 rggl
.marginWidth
= 0;
976 resultGroup
.setLayout(rggl
);
977 resultGroup
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
979 fLTButton
= new Button(resultGroup
, SWT
.RADIO
);
980 fLTButton
.setSelection(fNode
.getResult() < 0);
981 fLTButton
.setText("<"); //$NON-NLS-1$
982 fLTButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
983 fLTButton
.addSelectionListener(new SelectionAdapter() {
985 public void widgetSelected(SelectionEvent e
) {
986 if (fLTButton
.getSelection()) {
989 fViewer
.refresh(fNode
);
993 fEQButton
= new Button(resultGroup
, SWT
.RADIO
);
994 fEQButton
.setSelection(fNode
.getResult() == 0);
995 fEQButton
.setText("="); //$NON-NLS-1$
996 fEQButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
997 fEQButton
.addSelectionListener(new SelectionAdapter() {
999 public void widgetSelected(SelectionEvent e
) {
1000 if (fEQButton
.getSelection()) {
1003 fViewer
.refresh(fNode
);
1007 fGTButton
= new Button(resultGroup
, SWT
.RADIO
);
1008 fGTButton
.setSelection(fNode
.getResult() > 0);
1009 fGTButton
.setText(">"); //$NON-NLS-1$
1010 fGTButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1011 fGTButton
.addSelectionListener(new SelectionAdapter() {
1013 public void widgetSelected(SelectionEvent e
) {
1014 if (fGTButton
.getSelection()) {
1017 fViewer
.refresh(fNode
);
1021 label
= new Label(this, SWT
.NONE
);
1022 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1023 label
.setText(Messages
.FilterViewer_TypeLabel
);
1025 Composite typeGroup
= new Composite(this, SWT
.NONE
);
1026 GridLayout tggl
= new GridLayout(3, false);
1027 tggl
.marginHeight
= 0;
1028 tggl
.marginWidth
= 0;
1029 typeGroup
.setLayout(tggl
);
1030 typeGroup
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1032 fNumButton
= new Button(typeGroup
, SWT
.RADIO
);
1033 fNumButton
.setSelection(fNode
.getType() == Type
.NUM
);
1034 fNumButton
.setText(Messages
.FilterViewer_NumButtonText
);
1035 fNumButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1036 fNumButton
.addSelectionListener(new SelectionAdapter() {
1038 public void widgetSelected(SelectionEvent e
) {
1039 if (fNumButton
.getSelection()) {
1040 fNode
.setType(Type
.NUM
);
1042 fViewer
.refresh(fNode
);
1046 fAlphaButton
= new Button(typeGroup
, SWT
.RADIO
);
1047 fAlphaButton
.setSelection(fNode
.getType() == Type
.ALPHA
);
1048 fAlphaButton
.setText(Messages
.FilterViewer_AlphaButtonText
);
1049 fAlphaButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1050 fAlphaButton
.addSelectionListener(new SelectionAdapter() {
1052 public void widgetSelected(SelectionEvent e
) {
1053 if (fAlphaButton
.getSelection()) {
1054 fNode
.setType(Type
.ALPHA
);
1056 fViewer
.refresh(fNode
);
1060 fTimestampButton
= new Button(typeGroup
, SWT
.RADIO
);
1061 fTimestampButton
.setSelection(fNode
.getType() == Type
.TIMESTAMP
);
1062 fTimestampButton
.setText(Messages
.FilterViewer_TimestampButtonText
);
1063 fTimestampButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1064 fTimestampButton
.addSelectionListener(new SelectionAdapter() {
1066 public void widgetSelected(SelectionEvent e
) {
1067 if (fTimestampButton
.getSelection()) {
1068 fNode
.setType(Type
.TIMESTAMP
);
1070 fViewer
.refresh(fNode
);
1074 label
= new Label(this, SWT
.NONE
);
1075 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1076 label
.setText(Messages
.FilterViewer_ValueLabel
);
1078 fValueText
= new Text(this, SWT
.BORDER
);
1079 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1080 if (node
.getValue() != null && node
.getValue().length() > 0) {
1081 fValueText
.setText(node
.getValue());
1083 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
1084 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
1086 fValueText
.addFocusListener(new FocusListener() {
1088 public void focusLost(FocusEvent e
) {
1089 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
1090 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
1091 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
1095 public void focusGained(FocusEvent e
) {
1096 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
1097 fValueText
.setText(""); //$NON-NLS-1$
1099 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
1102 fValueText
.addModifyListener(new ModifyListener() {
1104 public void modifyText(ModifyEvent e
) {
1105 if (! fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
1106 fNode
.setValue(fValueText
.getText());
1107 fViewer
.refresh(fNode
);