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
161 protected void fillContextMenu(IMenuManager manager
) {
162 final ISelection selection
= fViewer
.getSelection();
163 ITmfFilterTreeNode filterTreeNode
= null;
164 if (selection
instanceof StructuredSelection
) {
165 Object element
= ((StructuredSelection
) selection
).getFirstElement();
166 if (element
instanceof ITmfFilterTreeNode
) {
167 filterTreeNode
= (ITmfFilterTreeNode
) element
;
171 final ITmfFilterTreeNode selectedNode
= filterTreeNode
;
173 if (selectedNode
!= null) {
175 fillContextMenuForNode(selectedNode
, manager
);
177 if (selectedNode
.getValidChildren().size() > 0) {
178 manager
.add(new Separator());
181 Action deleteAction
= new Action() {
184 selectedNode
.remove();
188 deleteAction
.setText(Messages
.FilterViewer_DeleteActionText
);
189 manager
.add(deleteAction
);
191 manager
.add(new Separator());
194 if (fViewer
.getInput() instanceof TmfFilterRootNode
|| selectedNode
== null) {
195 final ITmfFilterTreeNode root
= (ITmfFilterTreeNode
) fViewer
.getInput();
197 fillContextMenuForNode(root
, manager
);
202 * Fill the context menu with the valid children of the provided node
204 protected void fillContextMenuForNode(final ITmfFilterTreeNode node
, IMenuManager manager
) {
205 for (final String child
: node
.getValidChildren()) {
206 final Action action
= new Action() {
209 ITmfFilterTreeNode newNode
= null;
210 if (TmfFilterNode
.NODE_NAME
.equals(child
)) {
211 newNode
= new TmfFilterNode(node
, ""); //$NON-NLS-1$
212 } else if (TmfFilterEventTypeNode
.NODE_NAME
.equals(child
)) {
213 newNode
= new TmfFilterEventTypeNode(node
);
214 } else if (TmfFilterAndNode
.NODE_NAME
.equals(child
)) {
215 newNode
= new TmfFilterAndNode(node
);
216 } else if (TmfFilterOrNode
.NODE_NAME
.equals(child
)) {
217 newNode
= new TmfFilterOrNode(node
);
218 } else if (TmfFilterContainsNode
.NODE_NAME
.equals(child
)) {
219 newNode
= new TmfFilterContainsNode(node
);
220 } else if (TmfFilterEqualsNode
.NODE_NAME
.equals(child
)) {
221 newNode
= new TmfFilterEqualsNode(node
);
222 } else if (TmfFilterMatchesNode
.NODE_NAME
.equals(child
)) {
223 newNode
= new TmfFilterMatchesNode(node
);
224 } else if (TmfFilterCompareNode
.NODE_NAME
.equals(child
)) {
225 newNode
= new TmfFilterCompareNode(node
);
227 if (newNode
!= null) {
229 fViewer
.setSelection(new StructuredSelection(newNode
), true);
233 if (TmfFilterNode
.NODE_NAME
.equals(child
)) {
234 action
.setText(Messages
.FilterViewer_NewPrefix
+ " " + child
); //$NON-NLS-1$
236 action
.setText(child
);
243 * Create the appropriate filter node properties composite
245 private void updateFilterNodeComposite(ITmfFilterTreeNode node
) {
246 for (Control control
: fComposite
.getChildren()) {
250 if (node
instanceof TmfFilterNode
) {
251 new FilterNodeComposite(fComposite
, (TmfFilterNode
) node
);
252 } else if (node
instanceof TmfFilterEventTypeNode
) {
253 new FilterEventTypeNodeComposite(fComposite
, (TmfFilterEventTypeNode
) node
);
254 } else if (node
instanceof TmfFilterAndNode
) {
255 new FilterAndNodeComposite(fComposite
, (TmfFilterAndNode
) node
);
256 } else if (node
instanceof TmfFilterOrNode
) {
257 new FilterOrNodeComposite(fComposite
, (TmfFilterOrNode
) node
);
258 } else if (node
instanceof TmfFilterContainsNode
) {
259 new FilterContainsNodeComposite(fComposite
, (TmfFilterContainsNode
) node
);
260 } else if (node
instanceof TmfFilterEqualsNode
) {
261 new FilterEqualsNodeComposite(fComposite
, (TmfFilterEqualsNode
) node
);
262 } else if (node
instanceof TmfFilterMatchesNode
) {
263 new FilterMatchesNodeComposite(fComposite
, (TmfFilterMatchesNode
) node
);
264 } else if (node
instanceof TmfFilterCompareNode
) {
265 new FilterCompareNodeComposite(fComposite
, (TmfFilterCompareNode
) node
);
267 new FilterBaseNodeComposite(fComposite
);
273 * Highlight the provided tree items
275 private void highlightTreeItems(TreeItem
[] items
) {
276 resetTreeItems(fViewer
.getTree().getItems());
277 for (TreeItem item
: items
) {
278 item
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLUE
));
284 * Reset the provided tree items (remove highlight)
286 private void resetTreeItems(TreeItem
[] items
) {
287 for (TreeItem item
: items
) {
288 item
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
289 resetTreeItems(item
.getItems());
293 public void setInput(ITmfFilterTreeNode root
) {
294 fViewer
.setInput(root
);
297 updateFilterNodeComposite(null);
300 public ITmfFilterTreeNode
getInput() {
301 return (ITmfFilterTreeNode
) fViewer
.getInput();
304 public void refresh() {
308 public void setSelection(ITmfFilterTreeNode node
, boolean reveal
) {
309 fViewer
.setSelection(new StructuredSelection(node
), reveal
);
312 public void setSelection(ITmfFilterTreeNode node
) {
313 fViewer
.setSelection(new StructuredSelection(node
));
316 public ITmfFilterTreeNode
getSelection() {
317 final ISelection selection
= fViewer
.getSelection();
318 ITmfFilterTreeNode filterTreeNode
= null;
319 if (selection
instanceof StructuredSelection
) {
320 Object element
= ((StructuredSelection
) selection
).getFirstElement();
321 if (element
instanceof ITmfFilterTreeNode
) {
322 filterTreeNode
= (ITmfFilterTreeNode
) element
;
326 final ITmfFilterTreeNode selectedNode
= filterTreeNode
;
330 public void addSelectionChangedListener(ISelectionChangedListener listener
) {
331 fViewer
.addSelectionChangedListener(listener
);
334 public void removeSelectionChangedListener(ISelectionChangedListener listener
) {
335 fViewer
.removeSelectionChangedListener(listener
);
338 private class FilterBaseNodeComposite
extends Composite
{
340 FilterBaseNodeComposite(Composite parent
) {
341 super(parent
, SWT
.NONE
);
342 setLayout(new GridLayout(2, false));
343 setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
344 setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
347 protected String
[] getFieldsList(ITmfFilterTreeNode node
) {
348 ArrayList
<String
> fieldsList
= new ArrayList
<String
>();
349 while (node
!= null) {
350 if (node
instanceof TmfFilterEventTypeNode
) {
351 TmfFilterEventTypeNode eventTypeNode
= (TmfFilterEventTypeNode
) node
;
352 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
353 if (ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
).equals(eventTypeNode
.getEventType())) {
355 ITmfEvent event
= (ITmfEvent
) ce
.createExecutableExtension(TmfTraceType
.EVENT_TYPE_ATTR
);
356 ITmfEventType eventType
= event
.getType();
357 if (eventType
!= null) {
358 for (String field
: eventType
.getRootField().getFieldNames()) {
359 fieldsList
.add(field
);
362 } catch (CoreException e
) {
364 if (fieldsList
.size() == 0) {
365 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TIMESTAMP
);
366 fieldsList
.add(ITmfEvent
.EVENT_FIELD_SOURCE
);
367 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TYPE
);
368 fieldsList
.add(ITmfEvent
.EVENT_FIELD_REFERENCE
);
369 fieldsList
.add(ITmfEvent
.EVENT_FIELD_CONTENT
);
371 return fieldsList
.toArray(new String
[0]);
374 if (eventTypeNode
.getEventType() != null && eventTypeNode
.getEventType().startsWith(CustomTxtEvent
.class.getCanonicalName())) {
375 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
376 if (eventTypeNode
.getEventType().equals(CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
)) { //$NON-NLS-1$
377 for (OutputColumn output
: def
.outputs
) {
378 fieldsList
.add(output
.name
);
380 return fieldsList
.toArray(new String
[0]);
384 if (eventTypeNode
.getEventType() != null && eventTypeNode
.getEventType().startsWith(CustomXmlEvent
.class.getCanonicalName())) {
385 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
386 if (eventTypeNode
.getEventType().equals(CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
)) { //$NON-NLS-1$
387 for (OutputColumn output
: def
.outputs
) {
388 fieldsList
.add(output
.name
);
390 return fieldsList
.toArray(new String
[0]);
395 node
= node
.getParent();
398 fieldsList
.add(Messages
.FilterViewer_CommonCategory
);
399 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TIMESTAMP
);
400 fieldsList
.add(ITmfEvent
.EVENT_FIELD_SOURCE
);
401 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TYPE
);
402 fieldsList
.add(ITmfEvent
.EVENT_FIELD_REFERENCE
);
403 fieldsList
.add(ITmfEvent
.EVENT_FIELD_CONTENT
);
404 fieldsList
.add(""); //$NON-NLS-1$
406 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
408 ITmfEvent event
= (ITmfEvent
) ce
.createExecutableExtension(TmfTraceType
.EVENT_TYPE_ATTR
);
409 ITmfEventType eventType
= event
.getType();
410 if (eventType
!= null && eventType
.getFieldNames().length
> 0) {
411 fieldsList
.add("[" + TmfTraceType
.getCategoryName(ce
.getAttribute(TmfTraceType
.CATEGORY_ATTR
)) + //$NON-NLS-1$
412 " : " + ce
.getAttribute(TmfTraceType
.NAME_ATTR
) + "]"); //$NON-NLS-1$ //$NON-NLS-2$
413 for (String field
: eventType
.getFieldNames()) {
414 fieldsList
.add(field
);
416 fieldsList
.add(""); //$NON-NLS-1$
418 } catch (CoreException e
) {
421 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
422 if (def
.outputs
.size() > 0) {
423 fieldsList
.add("[" + CUSTOM_TXT_CATEGORY
+ //$NON-NLS-1$
424 " : " + def
.definitionName
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$
425 for (OutputColumn output
: def
.outputs
) {
426 fieldsList
.add(output
.name
);
428 fieldsList
.add(""); //$NON-NLS-1$
431 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
432 if (def
.outputs
.size() > 0) {
433 fieldsList
.add("[" + CUSTOM_XML_CATEGORY
+ //$NON-NLS-1$
434 " : " + def
.definitionName
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$
435 for (OutputColumn output
: def
.outputs
) {
436 fieldsList
.add(output
.name
);
438 fieldsList
.add(""); //$NON-NLS-1$
441 return fieldsList
.toArray(new String
[0]);
445 private class FilterNodeComposite
extends FilterBaseNodeComposite
{
449 FilterNodeComposite(Composite parent
, TmfFilterNode node
) {
453 Label label
= new Label(this, SWT
.NONE
);
454 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
455 label
.setText(Messages
.FilterViewer_NameLabel
);
457 fNameText
= new Text(this, SWT
.BORDER
);
458 fNameText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
459 if (node
.getFilterName() != null && node
.getFilterName().length() > 0) {
460 fNameText
.setText(node
.getFilterName());
462 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
463 fNameText
.setText(Messages
.FilterViewer_FilterNameHint
);
465 fNameText
.addFocusListener(new FocusListener() {
467 public void focusLost(FocusEvent e
) {
468 if (fNode
.getFilterName() == null || fNode
.getFilterName().length() == 0) {
469 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
470 fNameText
.setText(Messages
.FilterViewer_FilterNameHint
);
474 public void focusGained(FocusEvent e
) {
475 if (fNameText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
476 fNameText
.setText(""); //$NON-NLS-1$
478 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
481 fNameText
.addModifyListener(new ModifyListener() {
483 public void modifyText(ModifyEvent e
) {
484 if (! fNameText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
485 fNode
.setFilterName(fNameText
.getText());
486 fViewer
.refresh(fNode
);
493 private class FilterEventTypeNodeComposite
extends FilterBaseNodeComposite
{
494 TmfFilterEventTypeNode fNode
;
496 Map
<String
, Object
> fEventsTypeMap
;
498 FilterEventTypeNodeComposite(Composite parent
, TmfFilterEventTypeNode node
) {
501 fEventsTypeMap
= getEventsTypeMap();
503 Label label
= new Label(this, SWT
.NONE
);
504 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
505 label
.setText(Messages
.FilterViewer_TypeLabel
);
507 fTypeCombo
= new Combo(this, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
508 fTypeCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
509 fTypeCombo
.setItems(fEventsTypeMap
.keySet().toArray(new String
[0]));
510 if (fNode
.getEventType() != null) {
511 for (Entry
<String
, Object
> eventTypeEntry
: fEventsTypeMap
.entrySet()) {
512 Object value
= eventTypeEntry
.getValue();
513 if (value
instanceof IConfigurationElement
) {
514 IConfigurationElement ce
= (IConfigurationElement
) value
;
515 if (ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
).equals(fNode
.getEventType())) {
516 fTypeCombo
.setText(eventTypeEntry
.getKey());
518 } else if (value
instanceof CustomTxtTraceDefinition
) {
519 CustomTxtTraceDefinition def
= (CustomTxtTraceDefinition
) value
;
520 String eventType
= CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
; //$NON-NLS-1$
521 if (eventType
.equals(fNode
.getEventType())) {
522 fTypeCombo
.setText(eventTypeEntry
.getKey());
524 } else if (value
instanceof CustomXmlTraceDefinition
) {
525 CustomXmlTraceDefinition def
= (CustomXmlTraceDefinition
) value
;
526 String eventType
= CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
; //$NON-NLS-1$
527 if (eventType
.equals(fNode
.getEventType())) {
528 fTypeCombo
.setText(eventTypeEntry
.getKey());
533 fTypeCombo
.addModifyListener(new ModifyListener() {
535 public void modifyText(ModifyEvent e
) {
536 for (Entry
<String
, Object
> eventTypeEntry
: fEventsTypeMap
.entrySet()) {
537 if (eventTypeEntry
.getKey().equals(fTypeCombo
.getText())) {
538 Object value
= eventTypeEntry
.getValue();
539 if (value
instanceof IConfigurationElement
) {
540 IConfigurationElement ce
= (IConfigurationElement
) value
;
541 fNode
.setEventType(ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
));
542 fNode
.setName(ce
.getAttribute(TmfTraceType
.NAME_ATTR
));
543 } else if (value
instanceof CustomTxtTraceDefinition
) {
544 CustomTxtTraceDefinition def
= (CustomTxtTraceDefinition
) value
;
545 fNode
.setEventType(CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
); //$NON-NLS-1$
546 fNode
.setName(def
.definitionName
);
547 } else if (value
instanceof CustomXmlTraceDefinition
) {
548 CustomXmlTraceDefinition def
= (CustomXmlTraceDefinition
) value
;
549 fNode
.setEventType(CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
); //$NON-NLS-1$
550 fNode
.setName(def
.definitionName
);
552 fViewer
.refresh(fNode
);
560 protected Map
<String
, Object
> getEventsTypeMap() {
561 Map
<String
, Object
> eventsTypeMap
= new LinkedHashMap
<String
, Object
>();
562 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
563 String categoryName
= TmfTraceType
.getCategoryName(ce
.getAttribute(TmfTraceType
.CATEGORY_ATTR
));
564 String text
= categoryName
+ " : " + ce
.getAttribute(TmfTraceType
.NAME_ATTR
); //$NON-NLS-1$
565 eventsTypeMap
.put(text
, ce
);
567 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
568 String text
= CUSTOM_TXT_CATEGORY
+ " : " + def
.definitionName
; //$NON-NLS-1$
569 eventsTypeMap
.put(text
, def
);
571 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
572 String text
= CUSTOM_XML_CATEGORY
+ " : " + def
.definitionName
; //$NON-NLS-1$
573 eventsTypeMap
.put(text
, def
);
575 return eventsTypeMap
;
579 private class FilterAndNodeComposite
extends FilterBaseNodeComposite
{
580 TmfFilterAndNode fNode
;
583 FilterAndNodeComposite(Composite parent
, TmfFilterAndNode node
) {
587 Label label
= new Label(this, SWT
.NONE
);
588 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
589 label
.setText(Messages
.FilterViewer_NotLabel
);
591 fNotButton
= new Button(this, SWT
.CHECK
);
592 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
593 fNotButton
.setSelection(fNode
.isNot());
594 fNotButton
.addSelectionListener(new SelectionAdapter() {
596 public void widgetSelected(SelectionEvent e
) {
597 fNode
.setNot(fNotButton
.getSelection());
598 fViewer
.refresh(fNode
);
604 private class FilterOrNodeComposite
extends FilterBaseNodeComposite
{
605 TmfFilterOrNode fNode
;
608 FilterOrNodeComposite(Composite parent
, TmfFilterOrNode node
) {
612 Label label
= new Label(this, SWT
.NONE
);
613 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
614 label
.setText(Messages
.FilterViewer_NotLabel
);
616 fNotButton
= new Button(this, SWT
.CHECK
);
617 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
618 fNotButton
.setSelection(fNode
.isNot());
619 fNotButton
.addSelectionListener(new SelectionAdapter() {
621 public void widgetSelected(SelectionEvent e
) {
622 fNode
.setNot(fNotButton
.getSelection());
623 fViewer
.refresh(fNode
);
629 private class FilterContainsNodeComposite
extends FilterBaseNodeComposite
{
630 TmfFilterContainsNode fNode
;
634 Button fIgnoreCaseButton
;
636 FilterContainsNodeComposite(Composite parent
, TmfFilterContainsNode node
) {
640 Label label
= new Label(this, SWT
.NONE
);
641 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
642 label
.setText(Messages
.FilterViewer_NotLabel
);
644 fNotButton
= new Button(this, SWT
.CHECK
);
645 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
646 fNotButton
.setSelection(fNode
.isNot());
647 fNotButton
.addSelectionListener(new SelectionAdapter() {
649 public void widgetSelected(SelectionEvent e
) {
650 fNode
.setNot(fNotButton
.getSelection());
651 fViewer
.refresh(fNode
);
655 label
= new Label(this, SWT
.NONE
);
656 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
657 label
.setText(Messages
.FilterViewer_FieldLabel
);
659 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
660 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
661 fFieldCombo
.setItems(getFieldsList(fNode
));
662 if (fNode
.getField() != null) {
663 fFieldCombo
.setText(fNode
.getField());
665 fFieldCombo
.addModifyListener(new ModifyListener() {
667 public void modifyText(ModifyEvent e
) {
668 fNode
.setField(fFieldCombo
.getText());
669 fViewer
.refresh(fNode
);
673 label
= new Label(this, SWT
.NONE
);
674 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
675 label
.setText(Messages
.FilterViewer_ValueLabel
);
677 fValueText
= new Text(this, SWT
.BORDER
);
678 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
679 if (node
.getValue() != null && node
.getValue().length() > 0) {
680 fValueText
.setText(node
.getValue());
682 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
683 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
685 fValueText
.addFocusListener(new FocusListener() {
687 public void focusLost(FocusEvent e
) {
688 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
689 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
690 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
694 public void focusGained(FocusEvent e
) {
695 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
696 fValueText
.setText(""); //$NON-NLS-1$
698 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
701 fValueText
.addModifyListener(new ModifyListener() {
703 public void modifyText(ModifyEvent e
) {
704 if (! fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
705 fNode
.setValue(fValueText
.getText());
706 fViewer
.refresh(fNode
);
711 label
= new Label(this, SWT
.NONE
);
712 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
714 fIgnoreCaseButton
= new Button(this, SWT
.CHECK
);
715 fIgnoreCaseButton
.setSelection(fNode
.isIgnoreCase());
716 fIgnoreCaseButton
.setText(Messages
.FilterViewer_IgnoreCaseButtonText
);
717 fIgnoreCaseButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
718 fIgnoreCaseButton
.addSelectionListener(new SelectionAdapter() {
720 public void widgetSelected(SelectionEvent e
) {
721 fNode
.setIgnoreCase(fIgnoreCaseButton
.getSelection());
722 fViewer
.refresh(fNode
);
728 private class FilterEqualsNodeComposite
extends FilterBaseNodeComposite
{
729 TmfFilterEqualsNode fNode
;
733 Button fIgnoreCaseButton
;
735 FilterEqualsNodeComposite(Composite parent
, TmfFilterEqualsNode node
) {
739 Label label
= new Label(this, SWT
.NONE
);
740 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
741 label
.setText(Messages
.FilterViewer_NotLabel
);
743 fNotButton
= new Button(this, SWT
.CHECK
);
744 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
745 fNotButton
.setSelection(fNode
.isNot());
746 fNotButton
.addSelectionListener(new SelectionAdapter() {
748 public void widgetSelected(SelectionEvent e
) {
749 fNode
.setNot(fNotButton
.getSelection());
750 fViewer
.refresh(fNode
);
754 label
= new Label(this, SWT
.NONE
);
755 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
756 label
.setText(Messages
.FilterViewer_FieldLabel
);
758 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
759 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
760 fFieldCombo
.setItems(getFieldsList(fNode
));
761 if (fNode
.getField() != null) {
762 fFieldCombo
.setText(fNode
.getField());
764 fFieldCombo
.addModifyListener(new ModifyListener() {
766 public void modifyText(ModifyEvent e
) {
767 fNode
.setField(fFieldCombo
.getText());
768 fViewer
.refresh(fNode
);
772 label
= new Label(this, SWT
.NONE
);
773 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
774 label
.setText(Messages
.FilterViewer_ValueLabel
);
776 fValueText
= new Text(this, SWT
.BORDER
);
777 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
778 if (node
.getValue() != null && node
.getValue().length() > 0) {
779 fValueText
.setText(node
.getValue());
781 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
782 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
784 fValueText
.addFocusListener(new FocusListener() {
786 public void focusLost(FocusEvent e
) {
787 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
788 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
789 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
793 public void focusGained(FocusEvent e
) {
794 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
795 fValueText
.setText(""); //$NON-NLS-1$
797 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
800 fValueText
.addModifyListener(new ModifyListener() {
802 public void modifyText(ModifyEvent e
) {
803 if (! fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
804 fNode
.setValue(fValueText
.getText());
805 fViewer
.refresh(fNode
);
810 label
= new Label(this, SWT
.NONE
);
811 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
813 fIgnoreCaseButton
= new Button(this, SWT
.CHECK
);
814 fIgnoreCaseButton
.setSelection(fNode
.isIgnoreCase());
815 fIgnoreCaseButton
.setText(Messages
.FilterViewer_IgnoreCaseButtonText
);
816 fIgnoreCaseButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
817 fIgnoreCaseButton
.addSelectionListener(new SelectionAdapter() {
819 public void widgetSelected(SelectionEvent e
) {
820 fNode
.setIgnoreCase(fIgnoreCaseButton
.getSelection());
821 fViewer
.refresh(fNode
);
827 private class FilterMatchesNodeComposite
extends FilterBaseNodeComposite
{
828 TmfFilterMatchesNode fNode
;
833 FilterMatchesNodeComposite(Composite parent
, TmfFilterMatchesNode node
) {
837 Label label
= new Label(this, SWT
.NONE
);
838 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
839 label
.setText(Messages
.FilterViewer_NotLabel
);
841 fNotButton
= new Button(this, SWT
.CHECK
);
842 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
843 fNotButton
.setSelection(fNode
.isNot());
844 fNotButton
.addSelectionListener(new SelectionAdapter() {
846 public void widgetSelected(SelectionEvent e
) {
847 fNode
.setNot(fNotButton
.getSelection());
848 fViewer
.refresh(fNode
);
852 label
= new Label(this, SWT
.NONE
);
853 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
854 label
.setText(Messages
.FilterViewer_FieldLabel
);
856 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
857 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
858 fFieldCombo
.setItems(getFieldsList(fNode
));
859 if (fNode
.getField() != null) {
860 fFieldCombo
.setText(fNode
.getField());
862 fFieldCombo
.addModifyListener(new ModifyListener() {
864 public void modifyText(ModifyEvent e
) {
865 fNode
.setField(fFieldCombo
.getText());
866 fViewer
.refresh(fNode
);
870 label
= new Label(this, SWT
.NONE
);
871 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
872 label
.setText(Messages
.FilterViewer_RegexLabel
);
874 fRegexText
= new Text(this, SWT
.BORDER
);
875 fRegexText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
876 if (node
.getRegex() != null && node
.getRegex().length() > 0) {
877 fRegexText
.setText(node
.getRegex());
879 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
880 fRegexText
.setText(Messages
.FilterViewer_RegexHint
);
882 fRegexText
.addFocusListener(new FocusListener() {
884 public void focusLost(FocusEvent e
) {
885 if (fNode
.getRegex() == null || fNode
.getRegex().length() == 0) {
886 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
887 fRegexText
.setText(Messages
.FilterViewer_RegexHint
);
891 public void focusGained(FocusEvent e
) {
892 if (fRegexText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
893 fRegexText
.setText(""); //$NON-NLS-1$
895 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
898 fRegexText
.addModifyListener(new ModifyListener() {
900 public void modifyText(ModifyEvent e
) {
901 if (! fRegexText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
902 fNode
.setRegex(fRegexText
.getText());
903 fViewer
.refresh(fNode
);
910 private class FilterCompareNodeComposite
extends FilterBaseNodeComposite
{
911 TmfFilterCompareNode fNode
;
920 Button fTimestampButton
;
922 FilterCompareNodeComposite(Composite parent
, TmfFilterCompareNode node
) {
926 Label label
= new Label(this, SWT
.NONE
);
927 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
928 label
.setText(Messages
.FilterViewer_NotLabel
);
930 fNotButton
= new Button(this, SWT
.CHECK
);
931 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
932 fNotButton
.setSelection(fNode
.isNot());
933 fNotButton
.addSelectionListener(new SelectionAdapter() {
935 public void widgetSelected(SelectionEvent e
) {
936 fNode
.setNot(fNotButton
.getSelection());
937 fViewer
.refresh(fNode
);
941 label
= new Label(this, SWT
.NONE
);
942 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
943 label
.setText(Messages
.FilterViewer_FieldLabel
);
945 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
946 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
947 fFieldCombo
.setItems(getFieldsList(fNode
));
948 if (fNode
.getField() != null) {
949 fFieldCombo
.setText(fNode
.getField());
951 fFieldCombo
.addModifyListener(new ModifyListener() {
953 public void modifyText(ModifyEvent e
) {
954 fNode
.setField(fFieldCombo
.getText());
955 fViewer
.refresh(fNode
);
959 label
= new Label(this, SWT
.NONE
);
960 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
961 label
.setText(Messages
.FilterViewer_ResultLabel
);
963 Composite resultGroup
= new Composite(this, SWT
.NONE
);
964 GridLayout rggl
= new GridLayout(3, true);
965 rggl
.marginHeight
= 0;
966 rggl
.marginWidth
= 0;
967 resultGroup
.setLayout(rggl
);
968 resultGroup
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
970 fLTButton
= new Button(resultGroup
, SWT
.RADIO
);
971 fLTButton
.setSelection(fNode
.getResult() < 0);
972 fLTButton
.setText("<"); //$NON-NLS-1$
973 fLTButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
974 fLTButton
.addSelectionListener(new SelectionAdapter() {
976 public void widgetSelected(SelectionEvent e
) {
977 if (fLTButton
.getSelection()) {
980 fViewer
.refresh(fNode
);
984 fEQButton
= new Button(resultGroup
, SWT
.RADIO
);
985 fEQButton
.setSelection(fNode
.getResult() == 0);
986 fEQButton
.setText("="); //$NON-NLS-1$
987 fEQButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
988 fEQButton
.addSelectionListener(new SelectionAdapter() {
990 public void widgetSelected(SelectionEvent e
) {
991 if (fEQButton
.getSelection()) {
994 fViewer
.refresh(fNode
);
998 fGTButton
= new Button(resultGroup
, SWT
.RADIO
);
999 fGTButton
.setSelection(fNode
.getResult() > 0);
1000 fGTButton
.setText(">"); //$NON-NLS-1$
1001 fGTButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1002 fGTButton
.addSelectionListener(new SelectionAdapter() {
1004 public void widgetSelected(SelectionEvent e
) {
1005 if (fGTButton
.getSelection()) {
1008 fViewer
.refresh(fNode
);
1012 label
= new Label(this, SWT
.NONE
);
1013 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1014 label
.setText(Messages
.FilterViewer_TypeLabel
);
1016 Composite typeGroup
= new Composite(this, SWT
.NONE
);
1017 GridLayout tggl
= new GridLayout(3, false);
1018 tggl
.marginHeight
= 0;
1019 tggl
.marginWidth
= 0;
1020 typeGroup
.setLayout(tggl
);
1021 typeGroup
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1023 fNumButton
= new Button(typeGroup
, SWT
.RADIO
);
1024 fNumButton
.setSelection(fNode
.getType() == Type
.NUM
);
1025 fNumButton
.setText(Messages
.FilterViewer_NumButtonText
);
1026 fNumButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1027 fNumButton
.addSelectionListener(new SelectionAdapter() {
1029 public void widgetSelected(SelectionEvent e
) {
1030 if (fNumButton
.getSelection()) {
1031 fNode
.setType(Type
.NUM
);
1033 fViewer
.refresh(fNode
);
1037 fAlphaButton
= new Button(typeGroup
, SWT
.RADIO
);
1038 fAlphaButton
.setSelection(fNode
.getType() == Type
.ALPHA
);
1039 fAlphaButton
.setText(Messages
.FilterViewer_AlphaButtonText
);
1040 fAlphaButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1041 fAlphaButton
.addSelectionListener(new SelectionAdapter() {
1043 public void widgetSelected(SelectionEvent e
) {
1044 if (fAlphaButton
.getSelection()) {
1045 fNode
.setType(Type
.ALPHA
);
1047 fViewer
.refresh(fNode
);
1051 fTimestampButton
= new Button(typeGroup
, SWT
.RADIO
);
1052 fTimestampButton
.setSelection(fNode
.getType() == Type
.TIMESTAMP
);
1053 fTimestampButton
.setText(Messages
.FilterViewer_TimestampButtonText
);
1054 fTimestampButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1055 fTimestampButton
.addSelectionListener(new SelectionAdapter() {
1057 public void widgetSelected(SelectionEvent e
) {
1058 if (fTimestampButton
.getSelection()) {
1059 fNode
.setType(Type
.TIMESTAMP
);
1061 fViewer
.refresh(fNode
);
1065 label
= new Label(this, SWT
.NONE
);
1066 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1067 label
.setText(Messages
.FilterViewer_ValueLabel
);
1069 fValueText
= new Text(this, SWT
.BORDER
);
1070 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1071 if (node
.getValue() != null && node
.getValue().length() > 0) {
1072 fValueText
.setText(node
.getValue());
1074 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
1075 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
1077 fValueText
.addFocusListener(new FocusListener() {
1079 public void focusLost(FocusEvent e
) {
1080 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
1081 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
1082 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
1086 public void focusGained(FocusEvent e
) {
1087 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
1088 fValueText
.setText(""); //$NON-NLS-1$
1090 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
1093 fValueText
.addModifyListener(new ModifyListener() {
1095 public void modifyText(ModifyEvent e
) {
1096 if (! fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
1097 fNode
.setValue(fValueText
.getText());
1098 fViewer
.refresh(fNode
);