1 /*******************************************************************************
2 * Copyright (c) 2010 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 while (node
!= null) {
358 if (node
instanceof TmfFilterEventTypeNode
) {
359 TmfFilterEventTypeNode eventTypeNode
= (TmfFilterEventTypeNode
) node
;
360 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
361 if (ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
).equals(eventTypeNode
.getEventType())) {
363 ITmfEvent event
= (ITmfEvent
) ce
.createExecutableExtension(TmfTraceType
.EVENT_TYPE_ATTR
);
364 ITmfEventType eventType
= event
.getType();
365 if (eventType
!= null) {
366 for (String field
: eventType
.getRootField().getFieldNames()) {
367 fieldsList
.add(field
);
370 } catch (CoreException e
) {
372 if (fieldsList
.size() == 0) {
373 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TIMESTAMP
);
374 fieldsList
.add(ITmfEvent
.EVENT_FIELD_SOURCE
);
375 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TYPE
);
376 fieldsList
.add(ITmfEvent
.EVENT_FIELD_REFERENCE
);
377 fieldsList
.add(ITmfEvent
.EVENT_FIELD_CONTENT
);
379 return fieldsList
.toArray(new String
[0]);
382 if (eventTypeNode
.getEventType() != null && eventTypeNode
.getEventType().startsWith(CustomTxtEvent
.class.getCanonicalName())) {
383 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
384 if (eventTypeNode
.getEventType().equals(CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
)) { //$NON-NLS-1$
385 for (OutputColumn output
: def
.outputs
) {
386 fieldsList
.add(output
.name
);
388 return fieldsList
.toArray(new String
[0]);
392 if (eventTypeNode
.getEventType() != null && eventTypeNode
.getEventType().startsWith(CustomXmlEvent
.class.getCanonicalName())) {
393 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
394 if (eventTypeNode
.getEventType().equals(CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
)) { //$NON-NLS-1$
395 for (OutputColumn output
: def
.outputs
) {
396 fieldsList
.add(output
.name
);
398 return fieldsList
.toArray(new String
[0]);
403 node
= node
.getParent();
406 fieldsList
.add(Messages
.FilterViewer_CommonCategory
);
407 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TIMESTAMP
);
408 fieldsList
.add(ITmfEvent
.EVENT_FIELD_SOURCE
);
409 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TYPE
);
410 fieldsList
.add(ITmfEvent
.EVENT_FIELD_REFERENCE
);
411 fieldsList
.add(ITmfEvent
.EVENT_FIELD_CONTENT
);
412 fieldsList
.add(""); //$NON-NLS-1$
414 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
416 ITmfEvent event
= (ITmfEvent
) ce
.createExecutableExtension(TmfTraceType
.EVENT_TYPE_ATTR
);
417 ITmfEventType eventType
= event
.getType();
418 if (eventType
!= null && eventType
.getFieldNames().length
> 0) {
419 fieldsList
.add("[" + TmfTraceType
.getCategoryName(ce
.getAttribute(TmfTraceType
.CATEGORY_ATTR
)) + //$NON-NLS-1$
420 " : " + ce
.getAttribute(TmfTraceType
.NAME_ATTR
) + "]"); //$NON-NLS-1$ //$NON-NLS-2$
421 for (String field
: eventType
.getFieldNames()) {
422 fieldsList
.add(field
);
424 fieldsList
.add(""); //$NON-NLS-1$
426 } catch (CoreException e
) {
429 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
430 if (def
.outputs
.size() > 0) {
431 fieldsList
.add("[" + CUSTOM_TXT_CATEGORY
+ //$NON-NLS-1$
432 " : " + def
.definitionName
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$
433 for (OutputColumn output
: def
.outputs
) {
434 fieldsList
.add(output
.name
);
436 fieldsList
.add(""); //$NON-NLS-1$
439 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
440 if (def
.outputs
.size() > 0) {
441 fieldsList
.add("[" + CUSTOM_XML_CATEGORY
+ //$NON-NLS-1$
442 " : " + def
.definitionName
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$
443 for (OutputColumn output
: def
.outputs
) {
444 fieldsList
.add(output
.name
);
446 fieldsList
.add(""); //$NON-NLS-1$
449 return fieldsList
.toArray(new String
[0]);
453 private class FilterNodeComposite
extends FilterBaseNodeComposite
{
457 FilterNodeComposite(Composite parent
, TmfFilterNode node
) {
461 Label label
= new Label(this, SWT
.NONE
);
462 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
463 label
.setText(Messages
.FilterViewer_NameLabel
);
465 fNameText
= new Text(this, SWT
.BORDER
);
466 fNameText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
467 if (node
.getFilterName() != null && node
.getFilterName().length() > 0) {
468 fNameText
.setText(node
.getFilterName());
470 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
471 fNameText
.setText(Messages
.FilterViewer_FilterNameHint
);
473 fNameText
.addFocusListener(new FocusListener() {
475 public void focusLost(FocusEvent e
) {
476 if (fNode
.getFilterName() == null || fNode
.getFilterName().length() == 0) {
477 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
478 fNameText
.setText(Messages
.FilterViewer_FilterNameHint
);
482 public void focusGained(FocusEvent e
) {
483 if (fNameText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
484 fNameText
.setText(""); //$NON-NLS-1$
486 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
489 fNameText
.addModifyListener(new ModifyListener() {
491 public void modifyText(ModifyEvent e
) {
492 if (! fNameText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
493 fNode
.setFilterName(fNameText
.getText());
494 fViewer
.refresh(fNode
);
501 private class FilterEventTypeNodeComposite
extends FilterBaseNodeComposite
{
502 TmfFilterEventTypeNode fNode
;
504 Map
<String
, Object
> fEventsTypeMap
;
506 FilterEventTypeNodeComposite(Composite parent
, TmfFilterEventTypeNode node
) {
509 fEventsTypeMap
= getEventsTypeMap();
511 Label label
= new Label(this, SWT
.NONE
);
512 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
513 label
.setText(Messages
.FilterViewer_TypeLabel
);
515 fTypeCombo
= new Combo(this, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
516 fTypeCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
517 fTypeCombo
.setItems(fEventsTypeMap
.keySet().toArray(new String
[0]));
518 if (fNode
.getEventType() != null) {
519 for (Entry
<String
, Object
> eventTypeEntry
: fEventsTypeMap
.entrySet()) {
520 Object value
= eventTypeEntry
.getValue();
521 if (value
instanceof IConfigurationElement
) {
522 IConfigurationElement ce
= (IConfigurationElement
) value
;
523 if (ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
).equals(fNode
.getEventType())) {
524 fTypeCombo
.setText(eventTypeEntry
.getKey());
526 } else if (value
instanceof CustomTxtTraceDefinition
) {
527 CustomTxtTraceDefinition def
= (CustomTxtTraceDefinition
) value
;
528 String eventType
= CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
; //$NON-NLS-1$
529 if (eventType
.equals(fNode
.getEventType())) {
530 fTypeCombo
.setText(eventTypeEntry
.getKey());
532 } else if (value
instanceof CustomXmlTraceDefinition
) {
533 CustomXmlTraceDefinition def
= (CustomXmlTraceDefinition
) value
;
534 String eventType
= CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
; //$NON-NLS-1$
535 if (eventType
.equals(fNode
.getEventType())) {
536 fTypeCombo
.setText(eventTypeEntry
.getKey());
541 fTypeCombo
.addModifyListener(new ModifyListener() {
543 public void modifyText(ModifyEvent e
) {
544 for (Entry
<String
, Object
> eventTypeEntry
: fEventsTypeMap
.entrySet()) {
545 if (eventTypeEntry
.getKey().equals(fTypeCombo
.getText())) {
546 Object value
= eventTypeEntry
.getValue();
547 if (value
instanceof IConfigurationElement
) {
548 IConfigurationElement ce
= (IConfigurationElement
) value
;
549 fNode
.setEventType(ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
));
550 fNode
.setName(ce
.getAttribute(TmfTraceType
.NAME_ATTR
));
551 } else if (value
instanceof CustomTxtTraceDefinition
) {
552 CustomTxtTraceDefinition def
= (CustomTxtTraceDefinition
) value
;
553 fNode
.setEventType(CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
); //$NON-NLS-1$
554 fNode
.setName(def
.definitionName
);
555 } else if (value
instanceof CustomXmlTraceDefinition
) {
556 CustomXmlTraceDefinition def
= (CustomXmlTraceDefinition
) value
;
557 fNode
.setEventType(CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
); //$NON-NLS-1$
558 fNode
.setName(def
.definitionName
);
560 fViewer
.refresh(fNode
);
568 protected Map
<String
, Object
> getEventsTypeMap() {
569 Map
<String
, Object
> eventsTypeMap
= new LinkedHashMap
<String
, Object
>();
570 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
571 String categoryName
= TmfTraceType
.getCategoryName(ce
.getAttribute(TmfTraceType
.CATEGORY_ATTR
));
572 String text
= categoryName
+ " : " + ce
.getAttribute(TmfTraceType
.NAME_ATTR
); //$NON-NLS-1$
573 eventsTypeMap
.put(text
, ce
);
575 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
576 String text
= CUSTOM_TXT_CATEGORY
+ " : " + def
.definitionName
; //$NON-NLS-1$
577 eventsTypeMap
.put(text
, def
);
579 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
580 String text
= CUSTOM_XML_CATEGORY
+ " : " + def
.definitionName
; //$NON-NLS-1$
581 eventsTypeMap
.put(text
, def
);
583 return eventsTypeMap
;
587 private class FilterAndNodeComposite
extends FilterBaseNodeComposite
{
588 TmfFilterAndNode fNode
;
591 FilterAndNodeComposite(Composite parent
, TmfFilterAndNode node
) {
595 Label label
= new Label(this, SWT
.NONE
);
596 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
597 label
.setText(Messages
.FilterViewer_NotLabel
);
599 fNotButton
= new Button(this, SWT
.CHECK
);
600 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
601 fNotButton
.setSelection(fNode
.isNot());
602 fNotButton
.addSelectionListener(new SelectionAdapter() {
604 public void widgetSelected(SelectionEvent e
) {
605 fNode
.setNot(fNotButton
.getSelection());
606 fViewer
.refresh(fNode
);
612 private class FilterOrNodeComposite
extends FilterBaseNodeComposite
{
613 TmfFilterOrNode fNode
;
616 FilterOrNodeComposite(Composite parent
, TmfFilterOrNode node
) {
620 Label label
= new Label(this, SWT
.NONE
);
621 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
622 label
.setText(Messages
.FilterViewer_NotLabel
);
624 fNotButton
= new Button(this, SWT
.CHECK
);
625 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
626 fNotButton
.setSelection(fNode
.isNot());
627 fNotButton
.addSelectionListener(new SelectionAdapter() {
629 public void widgetSelected(SelectionEvent e
) {
630 fNode
.setNot(fNotButton
.getSelection());
631 fViewer
.refresh(fNode
);
637 private class FilterContainsNodeComposite
extends FilterBaseNodeComposite
{
638 TmfFilterContainsNode fNode
;
642 Button fIgnoreCaseButton
;
644 FilterContainsNodeComposite(Composite parent
, TmfFilterContainsNode node
) {
648 Label label
= new Label(this, SWT
.NONE
);
649 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
650 label
.setText(Messages
.FilterViewer_NotLabel
);
652 fNotButton
= new Button(this, SWT
.CHECK
);
653 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
654 fNotButton
.setSelection(fNode
.isNot());
655 fNotButton
.addSelectionListener(new SelectionAdapter() {
657 public void widgetSelected(SelectionEvent e
) {
658 fNode
.setNot(fNotButton
.getSelection());
659 fViewer
.refresh(fNode
);
663 label
= new Label(this, SWT
.NONE
);
664 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
665 label
.setText(Messages
.FilterViewer_FieldLabel
);
667 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
668 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
669 fFieldCombo
.setItems(getFieldsList(fNode
));
670 if (fNode
.getField() != null) {
671 fFieldCombo
.setText(fNode
.getField());
673 fFieldCombo
.addModifyListener(new ModifyListener() {
675 public void modifyText(ModifyEvent e
) {
676 fNode
.setField(fFieldCombo
.getText());
677 fViewer
.refresh(fNode
);
681 label
= new Label(this, SWT
.NONE
);
682 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
683 label
.setText(Messages
.FilterViewer_ValueLabel
);
685 fValueText
= new Text(this, SWT
.BORDER
);
686 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
687 if (node
.getValue() != null && node
.getValue().length() > 0) {
688 fValueText
.setText(node
.getValue());
690 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
691 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
693 fValueText
.addFocusListener(new FocusListener() {
695 public void focusLost(FocusEvent e
) {
696 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
697 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
698 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
702 public void focusGained(FocusEvent e
) {
703 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
704 fValueText
.setText(""); //$NON-NLS-1$
706 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
709 fValueText
.addModifyListener(new ModifyListener() {
711 public void modifyText(ModifyEvent e
) {
712 if (! fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
713 fNode
.setValue(fValueText
.getText());
714 fViewer
.refresh(fNode
);
719 label
= new Label(this, SWT
.NONE
);
720 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
722 fIgnoreCaseButton
= new Button(this, SWT
.CHECK
);
723 fIgnoreCaseButton
.setSelection(fNode
.isIgnoreCase());
724 fIgnoreCaseButton
.setText(Messages
.FilterViewer_IgnoreCaseButtonText
);
725 fIgnoreCaseButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
726 fIgnoreCaseButton
.addSelectionListener(new SelectionAdapter() {
728 public void widgetSelected(SelectionEvent e
) {
729 fNode
.setIgnoreCase(fIgnoreCaseButton
.getSelection());
730 fViewer
.refresh(fNode
);
736 private class FilterEqualsNodeComposite
extends FilterBaseNodeComposite
{
737 TmfFilterEqualsNode fNode
;
741 Button fIgnoreCaseButton
;
743 FilterEqualsNodeComposite(Composite parent
, TmfFilterEqualsNode node
) {
747 Label label
= new Label(this, SWT
.NONE
);
748 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
749 label
.setText(Messages
.FilterViewer_NotLabel
);
751 fNotButton
= new Button(this, SWT
.CHECK
);
752 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
753 fNotButton
.setSelection(fNode
.isNot());
754 fNotButton
.addSelectionListener(new SelectionAdapter() {
756 public void widgetSelected(SelectionEvent e
) {
757 fNode
.setNot(fNotButton
.getSelection());
758 fViewer
.refresh(fNode
);
762 label
= new Label(this, SWT
.NONE
);
763 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
764 label
.setText(Messages
.FilterViewer_FieldLabel
);
766 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
767 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
768 fFieldCombo
.setItems(getFieldsList(fNode
));
769 if (fNode
.getField() != null) {
770 fFieldCombo
.setText(fNode
.getField());
772 fFieldCombo
.addModifyListener(new ModifyListener() {
774 public void modifyText(ModifyEvent e
) {
775 fNode
.setField(fFieldCombo
.getText());
776 fViewer
.refresh(fNode
);
780 label
= new Label(this, SWT
.NONE
);
781 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
782 label
.setText(Messages
.FilterViewer_ValueLabel
);
784 fValueText
= new Text(this, SWT
.BORDER
);
785 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
786 if (node
.getValue() != null && node
.getValue().length() > 0) {
787 fValueText
.setText(node
.getValue());
789 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
790 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
792 fValueText
.addFocusListener(new FocusListener() {
794 public void focusLost(FocusEvent e
) {
795 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
796 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
797 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
801 public void focusGained(FocusEvent e
) {
802 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
803 fValueText
.setText(""); //$NON-NLS-1$
805 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
808 fValueText
.addModifyListener(new ModifyListener() {
810 public void modifyText(ModifyEvent e
) {
811 if (! fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
812 fNode
.setValue(fValueText
.getText());
813 fViewer
.refresh(fNode
);
818 label
= new Label(this, SWT
.NONE
);
819 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
821 fIgnoreCaseButton
= new Button(this, SWT
.CHECK
);
822 fIgnoreCaseButton
.setSelection(fNode
.isIgnoreCase());
823 fIgnoreCaseButton
.setText(Messages
.FilterViewer_IgnoreCaseButtonText
);
824 fIgnoreCaseButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
825 fIgnoreCaseButton
.addSelectionListener(new SelectionAdapter() {
827 public void widgetSelected(SelectionEvent e
) {
828 fNode
.setIgnoreCase(fIgnoreCaseButton
.getSelection());
829 fViewer
.refresh(fNode
);
835 private class FilterMatchesNodeComposite
extends FilterBaseNodeComposite
{
836 TmfFilterMatchesNode fNode
;
841 FilterMatchesNodeComposite(Composite parent
, TmfFilterMatchesNode node
) {
845 Label label
= new Label(this, SWT
.NONE
);
846 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
847 label
.setText(Messages
.FilterViewer_NotLabel
);
849 fNotButton
= new Button(this, SWT
.CHECK
);
850 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
851 fNotButton
.setSelection(fNode
.isNot());
852 fNotButton
.addSelectionListener(new SelectionAdapter() {
854 public void widgetSelected(SelectionEvent e
) {
855 fNode
.setNot(fNotButton
.getSelection());
856 fViewer
.refresh(fNode
);
860 label
= new Label(this, SWT
.NONE
);
861 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
862 label
.setText(Messages
.FilterViewer_FieldLabel
);
864 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
865 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
866 fFieldCombo
.setItems(getFieldsList(fNode
));
867 if (fNode
.getField() != null) {
868 fFieldCombo
.setText(fNode
.getField());
870 fFieldCombo
.addModifyListener(new ModifyListener() {
872 public void modifyText(ModifyEvent e
) {
873 fNode
.setField(fFieldCombo
.getText());
874 fViewer
.refresh(fNode
);
878 label
= new Label(this, SWT
.NONE
);
879 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
880 label
.setText(Messages
.FilterViewer_RegexLabel
);
882 fRegexText
= new Text(this, SWT
.BORDER
);
883 fRegexText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
884 if (node
.getRegex() != null && node
.getRegex().length() > 0) {
885 fRegexText
.setText(node
.getRegex());
887 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
888 fRegexText
.setText(Messages
.FilterViewer_RegexHint
);
890 fRegexText
.addFocusListener(new FocusListener() {
892 public void focusLost(FocusEvent e
) {
893 if (fNode
.getRegex() == null || fNode
.getRegex().length() == 0) {
894 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
895 fRegexText
.setText(Messages
.FilterViewer_RegexHint
);
899 public void focusGained(FocusEvent e
) {
900 if (fRegexText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
901 fRegexText
.setText(""); //$NON-NLS-1$
903 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
906 fRegexText
.addModifyListener(new ModifyListener() {
908 public void modifyText(ModifyEvent e
) {
909 if (! fRegexText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
910 fNode
.setRegex(fRegexText
.getText());
911 fViewer
.refresh(fNode
);
918 private class FilterCompareNodeComposite
extends FilterBaseNodeComposite
{
919 TmfFilterCompareNode fNode
;
928 Button fTimestampButton
;
930 FilterCompareNodeComposite(Composite parent
, TmfFilterCompareNode node
) {
934 Label label
= new Label(this, SWT
.NONE
);
935 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
936 label
.setText(Messages
.FilterViewer_NotLabel
);
938 fNotButton
= new Button(this, SWT
.CHECK
);
939 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
940 fNotButton
.setSelection(fNode
.isNot());
941 fNotButton
.addSelectionListener(new SelectionAdapter() {
943 public void widgetSelected(SelectionEvent e
) {
944 fNode
.setNot(fNotButton
.getSelection());
945 fViewer
.refresh(fNode
);
949 label
= new Label(this, SWT
.NONE
);
950 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
951 label
.setText(Messages
.FilterViewer_FieldLabel
);
953 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
954 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
955 fFieldCombo
.setItems(getFieldsList(fNode
));
956 if (fNode
.getField() != null) {
957 fFieldCombo
.setText(fNode
.getField());
959 fFieldCombo
.addModifyListener(new ModifyListener() {
961 public void modifyText(ModifyEvent e
) {
962 fNode
.setField(fFieldCombo
.getText());
963 fViewer
.refresh(fNode
);
967 label
= new Label(this, SWT
.NONE
);
968 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
969 label
.setText(Messages
.FilterViewer_ResultLabel
);
971 Composite resultGroup
= new Composite(this, SWT
.NONE
);
972 GridLayout rggl
= new GridLayout(3, true);
973 rggl
.marginHeight
= 0;
974 rggl
.marginWidth
= 0;
975 resultGroup
.setLayout(rggl
);
976 resultGroup
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
978 fLTButton
= new Button(resultGroup
, SWT
.RADIO
);
979 fLTButton
.setSelection(fNode
.getResult() < 0);
980 fLTButton
.setText("<"); //$NON-NLS-1$
981 fLTButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
982 fLTButton
.addSelectionListener(new SelectionAdapter() {
984 public void widgetSelected(SelectionEvent e
) {
985 if (fLTButton
.getSelection()) {
988 fViewer
.refresh(fNode
);
992 fEQButton
= new Button(resultGroup
, SWT
.RADIO
);
993 fEQButton
.setSelection(fNode
.getResult() == 0);
994 fEQButton
.setText("="); //$NON-NLS-1$
995 fEQButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
996 fEQButton
.addSelectionListener(new SelectionAdapter() {
998 public void widgetSelected(SelectionEvent e
) {
999 if (fEQButton
.getSelection()) {
1002 fViewer
.refresh(fNode
);
1006 fGTButton
= new Button(resultGroup
, SWT
.RADIO
);
1007 fGTButton
.setSelection(fNode
.getResult() > 0);
1008 fGTButton
.setText(">"); //$NON-NLS-1$
1009 fGTButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1010 fGTButton
.addSelectionListener(new SelectionAdapter() {
1012 public void widgetSelected(SelectionEvent e
) {
1013 if (fGTButton
.getSelection()) {
1016 fViewer
.refresh(fNode
);
1020 label
= new Label(this, SWT
.NONE
);
1021 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1022 label
.setText(Messages
.FilterViewer_TypeLabel
);
1024 Composite typeGroup
= new Composite(this, SWT
.NONE
);
1025 GridLayout tggl
= new GridLayout(3, false);
1026 tggl
.marginHeight
= 0;
1027 tggl
.marginWidth
= 0;
1028 typeGroup
.setLayout(tggl
);
1029 typeGroup
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1031 fNumButton
= new Button(typeGroup
, SWT
.RADIO
);
1032 fNumButton
.setSelection(fNode
.getType() == Type
.NUM
);
1033 fNumButton
.setText(Messages
.FilterViewer_NumButtonText
);
1034 fNumButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1035 fNumButton
.addSelectionListener(new SelectionAdapter() {
1037 public void widgetSelected(SelectionEvent e
) {
1038 if (fNumButton
.getSelection()) {
1039 fNode
.setType(Type
.NUM
);
1041 fViewer
.refresh(fNode
);
1045 fAlphaButton
= new Button(typeGroup
, SWT
.RADIO
);
1046 fAlphaButton
.setSelection(fNode
.getType() == Type
.ALPHA
);
1047 fAlphaButton
.setText(Messages
.FilterViewer_AlphaButtonText
);
1048 fAlphaButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1049 fAlphaButton
.addSelectionListener(new SelectionAdapter() {
1051 public void widgetSelected(SelectionEvent e
) {
1052 if (fAlphaButton
.getSelection()) {
1053 fNode
.setType(Type
.ALPHA
);
1055 fViewer
.refresh(fNode
);
1059 fTimestampButton
= new Button(typeGroup
, SWT
.RADIO
);
1060 fTimestampButton
.setSelection(fNode
.getType() == Type
.TIMESTAMP
);
1061 fTimestampButton
.setText(Messages
.FilterViewer_TimestampButtonText
);
1062 fTimestampButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1063 fTimestampButton
.addSelectionListener(new SelectionAdapter() {
1065 public void widgetSelected(SelectionEvent e
) {
1066 if (fTimestampButton
.getSelection()) {
1067 fNode
.setType(Type
.TIMESTAMP
);
1069 fViewer
.refresh(fNode
);
1073 label
= new Label(this, SWT
.NONE
);
1074 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1075 label
.setText(Messages
.FilterViewer_ValueLabel
);
1077 fValueText
= new Text(this, SWT
.BORDER
);
1078 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1079 if (node
.getValue() != null && node
.getValue().length() > 0) {
1080 fValueText
.setText(node
.getValue());
1082 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
1083 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
1085 fValueText
.addFocusListener(new FocusListener() {
1087 public void focusLost(FocusEvent e
) {
1088 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
1089 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
1090 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
1094 public void focusGained(FocusEvent e
) {
1095 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
1096 fValueText
.setText(""); //$NON-NLS-1$
1098 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
1101 fValueText
.addModifyListener(new ModifyListener() {
1103 public void modifyText(ModifyEvent e
) {
1104 if (! fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
1105 fNode
.setValue(fValueText
.getText());
1106 fViewer
.refresh(fNode
);