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 * Xavier Raynaud - add cut/copy/paste/dnd support
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.filter
;
16 import java
.util
.ArrayList
;
17 import java
.util
.LinkedHashMap
;
19 import java
.util
.Map
.Entry
;
21 import org
.eclipse
.core
.runtime
.CoreException
;
22 import org
.eclipse
.core
.runtime
.IConfigurationElement
;
23 import org
.eclipse
.jface
.action
.Action
;
24 import org
.eclipse
.jface
.action
.IMenuManager
;
25 import org
.eclipse
.jface
.action
.Separator
;
26 import org
.eclipse
.jface
.util
.LocalSelectionTransfer
;
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
.tmf
.core
.event
.ITmfEvent
;
35 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEventType
;
36 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.ITmfFilterTreeNode
;
37 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterAndNode
;
38 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterCompareNode
;
39 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterCompareNode
.Type
;
40 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterContainsNode
;
41 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterEqualsNode
;
42 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterEventTypeNode
;
43 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterMatchesNode
;
44 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterNode
;
45 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterOrNode
;
46 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterRootNode
;
47 import org
.eclipse
.linuxtools
.tmf
.core
.filter
.model
.TmfFilterTreeNode
;
48 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomTxtEvent
;
49 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomTxtTraceDefinition
;
50 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomXmlEvent
;
51 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomXmlTraceDefinition
;
52 import org
.eclipse
.linuxtools
.tmf
.core
.parsers
.custom
.CustomTraceDefinition
.OutputColumn
;
53 import org
.eclipse
.linuxtools
.tmf
.core
.project
.model
.TmfTraceType
;
54 import org
.eclipse
.swt
.SWT
;
55 import org
.eclipse
.swt
.custom
.SashForm
;
56 import org
.eclipse
.swt
.dnd
.DND
;
57 import org
.eclipse
.swt
.dnd
.DragSource
;
58 import org
.eclipse
.swt
.dnd
.DropTarget
;
59 import org
.eclipse
.swt
.dnd
.Transfer
;
60 import org
.eclipse
.swt
.events
.FocusEvent
;
61 import org
.eclipse
.swt
.events
.FocusListener
;
62 import org
.eclipse
.swt
.events
.ModifyEvent
;
63 import org
.eclipse
.swt
.events
.ModifyListener
;
64 import org
.eclipse
.swt
.events
.PaintEvent
;
65 import org
.eclipse
.swt
.events
.PaintListener
;
66 import org
.eclipse
.swt
.events
.SelectionAdapter
;
67 import org
.eclipse
.swt
.events
.SelectionEvent
;
68 import org
.eclipse
.swt
.layout
.FillLayout
;
69 import org
.eclipse
.swt
.layout
.GridData
;
70 import org
.eclipse
.swt
.layout
.GridLayout
;
71 import org
.eclipse
.swt
.widgets
.Button
;
72 import org
.eclipse
.swt
.widgets
.Combo
;
73 import org
.eclipse
.swt
.widgets
.Composite
;
74 import org
.eclipse
.swt
.widgets
.Control
;
75 import org
.eclipse
.swt
.widgets
.Display
;
76 import org
.eclipse
.swt
.widgets
.Label
;
77 import org
.eclipse
.swt
.widgets
.Text
;
78 import org
.eclipse
.swt
.widgets
.TreeItem
;
80 class FilterViewer
extends Composite
{
82 private static final String CUSTOM_TXT_CATEGORY
= "Custom Text"; //$NON-NLS-1$
83 private static final String CUSTOM_XML_CATEGORY
= "Custom XML"; //$NON-NLS-1$
85 private TreeViewer fViewer
;
87 private Composite fComposite
;
89 public FilterViewer(Composite parent
, int style
) {
92 setLayout(new FillLayout());
93 GridData gd
= new GridData(SWT
.FILL
, SWT
.FILL
, true, true);
96 final SashForm sash
= new SashForm(this, SWT
.HORIZONTAL
);
98 // Create the tree viewer to display the filter tree
99 fViewer
= new TreeViewer(sash
, SWT
.NONE
);
100 fViewer
.setContentProvider(new FilterTreeContentProvider());
101 fViewer
.setLabelProvider(new FilterTreeLabelProvider());
102 fViewer
.setInput(new TmfFilterRootNode());
104 // Create the empty filter node properties panel
105 fComposite
= new Composite(sash
, SWT
.NONE
);
106 GridLayout gl
= new GridLayout();
109 fComposite
.setLayout(gl
);
111 fViewer
.addSelectionChangedListener(new ISelectionChangedListener() {
113 public void selectionChanged(SelectionChangedEvent event
) {
114 if (!(event
.getSelection().isEmpty()) && event
.getSelection() instanceof IStructuredSelection
) {
115 // Update the filter node properties panel to the selection
116 IStructuredSelection selection
= (IStructuredSelection
) event
.getSelection();
117 ITmfFilterTreeNode node
= (ITmfFilterTreeNode
) selection
.getFirstElement();
118 updateFilterNodeComposite(node
);
119 // Highlight the selection's children
120 highlightTreeItems(fViewer
.getTree().getSelection()[0].getItems());
122 updateFilterNodeComposite(null);
127 fViewer
.getTree().addPaintListener(new PaintListener() {
129 public void paintControl(PaintEvent e
) {
130 TmfFilterTreeNode root
= (TmfFilterTreeNode
) fViewer
.getInput();
131 if (root
== null || root
.getChildrenCount() == 0) {
132 e
.gc
.setForeground(Display
.getDefault().getSystemColor(SWT
.COLOR_BLACK
));
133 e
.gc
.drawText(Messages
.FilterViewer_EmptyTreeHintText
, 5, 0);
138 int operations
= DND
.DROP_MOVE
| DND
.DROP_COPY
;
139 DragSource dragSource
= new org
.eclipse
.swt
.dnd
.DragSource(fViewer
.getTree(), operations
);
140 dragSource
.setTransfer(new Transfer
[] { LocalSelectionTransfer
.getTransfer() });
141 dragSource
.addDragListener(new FilterDragSourceAdapter(this));
142 DropTarget dropTarget
= new DropTarget(fViewer
.getTree(), operations
);
143 dropTarget
.setTransfer(new Transfer
[] { LocalSelectionTransfer
.getTransfer() });
144 dropTarget
.addDropListener(new FilterDropTargetAdapter(this));
148 * Fill the context menu for the tree viewer.
153 protected void fillContextMenu(IMenuManager manager
) {
154 final ISelection selection
= fViewer
.getSelection();
155 ITmfFilterTreeNode filterTreeNode
= null;
156 if (selection
instanceof StructuredSelection
) {
157 Object element
= ((StructuredSelection
) selection
).getFirstElement();
158 if (element
instanceof ITmfFilterTreeNode
) {
159 filterTreeNode
= (ITmfFilterTreeNode
) element
;
163 if (filterTreeNode
!= null) {
164 fillContextMenuForNode(filterTreeNode
, manager
);
166 manager
.add(new Separator("delete")); //$NON-NLS-1$
167 manager
.add(new Separator("edit")); //$NON-NLS-1$
169 if (fViewer
.getInput() instanceof TmfFilterRootNode
|| filterTreeNode
== null) {
170 manager
.add(new Separator());
171 ITmfFilterTreeNode root
= (ITmfFilterTreeNode
) fViewer
.getInput();
172 fillContextMenuForNode(root
, manager
);
177 * Fill the context menu with the valid children of the provided node
184 protected void fillContextMenuForNode(final ITmfFilterTreeNode node
, IMenuManager manager
) {
185 for (final String child
: node
.getValidChildren()) {
186 final Action action
= new Action() {
189 ITmfFilterTreeNode newNode
= null;
190 if (TmfFilterNode
.NODE_NAME
.equals(child
)) {
191 newNode
= new TmfFilterNode(node
, ""); //$NON-NLS-1$
192 } else if (TmfFilterEventTypeNode
.NODE_NAME
.equals(child
)) {
193 newNode
= new TmfFilterEventTypeNode(node
);
194 } else if (TmfFilterAndNode
.NODE_NAME
.equals(child
)) {
195 newNode
= new TmfFilterAndNode(node
);
196 } else if (TmfFilterOrNode
.NODE_NAME
.equals(child
)) {
197 newNode
= new TmfFilterOrNode(node
);
198 } else if (TmfFilterContainsNode
.NODE_NAME
.equals(child
)) {
199 newNode
= new TmfFilterContainsNode(node
);
200 } else if (TmfFilterEqualsNode
.NODE_NAME
.equals(child
)) {
201 newNode
= new TmfFilterEqualsNode(node
);
202 } else if (TmfFilterMatchesNode
.NODE_NAME
.equals(child
)) {
203 newNode
= new TmfFilterMatchesNode(node
);
204 } else if (TmfFilterCompareNode
.NODE_NAME
.equals(child
)) {
205 newNode
= new TmfFilterCompareNode(node
);
207 if (newNode
!= null) {
209 fViewer
.setSelection(new StructuredSelection(newNode
), true);
213 if (TmfFilterNode
.NODE_NAME
.equals(child
)) {
214 action
.setText(Messages
.FilterViewer_NewPrefix
+ " " + child
); //$NON-NLS-1$
216 action
.setText(child
);
223 * Create the appropriate filter node properties composite
225 private void updateFilterNodeComposite(ITmfFilterTreeNode node
) {
226 for (Control control
: fComposite
.getChildren()) {
230 if (node
instanceof TmfFilterNode
) {
231 new FilterNodeComposite(fComposite
, (TmfFilterNode
) node
);
232 } else if (node
instanceof TmfFilterEventTypeNode
) {
233 new FilterEventTypeNodeComposite(fComposite
, (TmfFilterEventTypeNode
) node
);
234 } else if (node
instanceof TmfFilterAndNode
) {
235 new FilterAndNodeComposite(fComposite
, (TmfFilterAndNode
) node
);
236 } else if (node
instanceof TmfFilterOrNode
) {
237 new FilterOrNodeComposite(fComposite
, (TmfFilterOrNode
) node
);
238 } else if (node
instanceof TmfFilterContainsNode
) {
239 new FilterContainsNodeComposite(fComposite
, (TmfFilterContainsNode
) node
);
240 } else if (node
instanceof TmfFilterEqualsNode
) {
241 new FilterEqualsNodeComposite(fComposite
, (TmfFilterEqualsNode
) node
);
242 } else if (node
instanceof TmfFilterMatchesNode
) {
243 new FilterMatchesNodeComposite(fComposite
, (TmfFilterMatchesNode
) node
);
244 } else if (node
instanceof TmfFilterCompareNode
) {
245 new FilterCompareNodeComposite(fComposite
, (TmfFilterCompareNode
) node
);
247 new FilterBaseNodeComposite(fComposite
);
253 * Highlight the provided tree items
255 private void highlightTreeItems(TreeItem
[] items
) {
256 resetTreeItems(fViewer
.getTree().getItems());
257 for (TreeItem item
: items
) {
258 item
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLUE
));
264 * Reset the provided tree items (remove highlight)
266 private void resetTreeItems(TreeItem
[] items
) {
267 for (TreeItem item
: items
) {
268 item
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
269 resetTreeItems(item
.getItems());
273 public void setInput(ITmfFilterTreeNode root
) {
274 fViewer
.setInput(root
);
277 updateFilterNodeComposite(null);
280 public ITmfFilterTreeNode
getInput() {
281 return (ITmfFilterTreeNode
) fViewer
.getInput();
284 public void refresh() {
288 public void setSelection(ITmfFilterTreeNode node
, boolean reveal
) {
289 fViewer
.setSelection(new StructuredSelection(node
), reveal
);
292 public void setSelection(ITmfFilterTreeNode node
) {
293 fViewer
.setSelection(new StructuredSelection(node
));
296 public ITmfFilterTreeNode
getSelection() {
297 final ISelection selection
= fViewer
.getSelection();
298 ITmfFilterTreeNode filterTreeNode
= null;
299 if (selection
instanceof StructuredSelection
) {
300 Object element
= ((StructuredSelection
) selection
).getFirstElement();
301 if (element
instanceof ITmfFilterTreeNode
) {
302 filterTreeNode
= (ITmfFilterTreeNode
) element
;
306 final ITmfFilterTreeNode selectedNode
= filterTreeNode
;
310 public void addSelectionChangedListener(ISelectionChangedListener listener
) {
311 fViewer
.addSelectionChangedListener(listener
);
314 public void removeSelectionChangedListener(ISelectionChangedListener listener
) {
315 fViewer
.removeSelectionChangedListener(listener
);
319 * Gets the TreeViewer displaying filters
320 * @return a {@link TreeViewer}
322 TreeViewer
getTreeViewer() {
326 private class FilterBaseNodeComposite
extends Composite
{
328 FilterBaseNodeComposite(Composite parent
) {
329 super(parent
, SWT
.NONE
);
330 setLayout(new GridLayout(2, false));
331 setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
332 setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
335 protected String
[] getFieldsList(ITmfFilterTreeNode node
) {
336 ArrayList
<String
> fieldsList
= new ArrayList
<>();
337 ITmfFilterTreeNode curNode
= node
;
338 while (curNode
!= null) {
339 if (curNode
instanceof TmfFilterEventTypeNode
) {
340 TmfFilterEventTypeNode eventTypeNode
= (TmfFilterEventTypeNode
) curNode
;
341 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
342 if (ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
).equals(eventTypeNode
.getEventType())) {
344 ITmfEvent event
= (ITmfEvent
) ce
.createExecutableExtension(TmfTraceType
.EVENT_TYPE_ATTR
);
345 ITmfEventType eventType
= event
.getType();
346 if (eventType
!= null) {
347 for (String field
: eventType
.getRootField().getFieldNames()) {
348 fieldsList
.add(field
);
351 } catch (CoreException e
) {
353 if (fieldsList
.size() == 0) {
354 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TIMESTAMP
);
355 fieldsList
.add(ITmfEvent
.EVENT_FIELD_SOURCE
);
356 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TYPE
);
357 fieldsList
.add(ITmfEvent
.EVENT_FIELD_REFERENCE
);
358 fieldsList
.add(ITmfEvent
.EVENT_FIELD_CONTENT
);
360 return fieldsList
.toArray(new String
[0]);
363 if (eventTypeNode
.getEventType() != null && eventTypeNode
.getEventType().startsWith(CustomTxtEvent
.class.getCanonicalName())) {
364 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
365 if (eventTypeNode
.getEventType().equals(CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
)) { //$NON-NLS-1$
366 for (OutputColumn output
: def
.outputs
) {
367 fieldsList
.add(output
.name
);
369 return fieldsList
.toArray(new String
[0]);
373 if (eventTypeNode
.getEventType() != null && eventTypeNode
.getEventType().startsWith(CustomXmlEvent
.class.getCanonicalName())) {
374 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
375 if (eventTypeNode
.getEventType().equals(CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
)) { //$NON-NLS-1$
376 for (OutputColumn output
: def
.outputs
) {
377 fieldsList
.add(output
.name
);
379 return fieldsList
.toArray(new String
[0]);
384 curNode
= curNode
.getParent();
387 fieldsList
.add(Messages
.FilterViewer_CommonCategory
);
388 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TIMESTAMP
);
389 fieldsList
.add(ITmfEvent
.EVENT_FIELD_SOURCE
);
390 fieldsList
.add(ITmfEvent
.EVENT_FIELD_TYPE
);
391 fieldsList
.add(ITmfEvent
.EVENT_FIELD_REFERENCE
);
392 fieldsList
.add(ITmfEvent
.EVENT_FIELD_CONTENT
);
393 fieldsList
.add(""); //$NON-NLS-1$
395 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
397 ITmfEvent event
= (ITmfEvent
) ce
.createExecutableExtension(TmfTraceType
.EVENT_TYPE_ATTR
);
398 ITmfEventType eventType
= event
.getType();
399 if (eventType
!= null && eventType
.getFieldNames().length
> 0) {
400 fieldsList
.add("[" + TmfTraceType
.getCategoryName(ce
.getAttribute(TmfTraceType
.CATEGORY_ATTR
)) + //$NON-NLS-1$
401 " : " + ce
.getAttribute(TmfTraceType
.NAME_ATTR
) + "]"); //$NON-NLS-1$ //$NON-NLS-2$
402 for (String field
: eventType
.getFieldNames()) {
403 fieldsList
.add(field
);
405 fieldsList
.add(""); //$NON-NLS-1$
407 } catch (CoreException e
) {
410 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
411 if (def
.outputs
.size() > 0) {
412 fieldsList
.add("[" + CUSTOM_TXT_CATEGORY
+ //$NON-NLS-1$
413 " : " + def
.definitionName
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$
414 for (OutputColumn output
: def
.outputs
) {
415 fieldsList
.add(output
.name
);
417 fieldsList
.add(""); //$NON-NLS-1$
420 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
421 if (def
.outputs
.size() > 0) {
422 fieldsList
.add("[" + CUSTOM_XML_CATEGORY
+ //$NON-NLS-1$
423 " : " + def
.definitionName
+ "]"); //$NON-NLS-1$ //$NON-NLS-2$
424 for (OutputColumn output
: def
.outputs
) {
425 fieldsList
.add(output
.name
);
427 fieldsList
.add(""); //$NON-NLS-1$
430 return fieldsList
.toArray(new String
[0]);
434 private class FilterNodeComposite
extends FilterBaseNodeComposite
{
438 FilterNodeComposite(Composite parent
, TmfFilterNode node
) {
442 Label label
= new Label(this, SWT
.NONE
);
443 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
444 label
.setText(Messages
.FilterViewer_NameLabel
);
446 fNameText
= new Text(this, SWT
.BORDER
);
447 fNameText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
448 if (node
.getFilterName() != null && node
.getFilterName().length() > 0) {
449 fNameText
.setText(node
.getFilterName());
451 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
452 fNameText
.setText(Messages
.FilterViewer_FilterNameHint
);
454 fNameText
.addFocusListener(new FocusListener() {
456 public void focusLost(FocusEvent e
) {
457 if (fNode
.getFilterName() == null || fNode
.getFilterName().length() == 0) {
458 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
459 fNameText
.setText(Messages
.FilterViewer_FilterNameHint
);
464 public void focusGained(FocusEvent e
) {
465 if (fNameText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
466 fNameText
.setText(""); //$NON-NLS-1$
468 fNameText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
471 fNameText
.addModifyListener(new ModifyListener() {
473 public void modifyText(ModifyEvent e
) {
474 if (!fNameText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
475 fNode
.setFilterName(fNameText
.getText());
476 fViewer
.refresh(fNode
);
483 private class FilterEventTypeNodeComposite
extends FilterBaseNodeComposite
{
484 TmfFilterEventTypeNode fNode
;
486 Map
<String
, Object
> fEventsTypeMap
;
488 FilterEventTypeNodeComposite(Composite parent
, TmfFilterEventTypeNode node
) {
491 fEventsTypeMap
= getEventsTypeMap();
493 Label label
= new Label(this, SWT
.NONE
);
494 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
495 label
.setText(Messages
.FilterViewer_TypeLabel
);
497 fTypeCombo
= new Combo(this, SWT
.DROP_DOWN
| SWT
.READ_ONLY
);
498 fTypeCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
499 fTypeCombo
.setItems(fEventsTypeMap
.keySet().toArray(new String
[0]));
500 if (fNode
.getEventType() != null) {
501 for (Entry
<String
, Object
> eventTypeEntry
: fEventsTypeMap
.entrySet()) {
502 Object value
= eventTypeEntry
.getValue();
503 if (value
instanceof IConfigurationElement
) {
504 IConfigurationElement ce
= (IConfigurationElement
) value
;
505 if (ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
).equals(fNode
.getEventType())) {
506 fTypeCombo
.setText(eventTypeEntry
.getKey());
508 } else if (value
instanceof CustomTxtTraceDefinition
) {
509 CustomTxtTraceDefinition def
= (CustomTxtTraceDefinition
) value
;
510 String eventType
= CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
; //$NON-NLS-1$
511 if (eventType
.equals(fNode
.getEventType())) {
512 fTypeCombo
.setText(eventTypeEntry
.getKey());
514 } else if (value
instanceof CustomXmlTraceDefinition
) {
515 CustomXmlTraceDefinition def
= (CustomXmlTraceDefinition
) value
;
516 String eventType
= CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
; //$NON-NLS-1$
517 if (eventType
.equals(fNode
.getEventType())) {
518 fTypeCombo
.setText(eventTypeEntry
.getKey());
523 fTypeCombo
.addModifyListener(new ModifyListener() {
525 public void modifyText(ModifyEvent e
) {
526 for (Entry
<String
, Object
> eventTypeEntry
: fEventsTypeMap
.entrySet()) {
527 if (eventTypeEntry
.getKey().equals(fTypeCombo
.getText())) {
528 Object value
= eventTypeEntry
.getValue();
529 if (value
instanceof IConfigurationElement
) {
530 IConfigurationElement ce
= (IConfigurationElement
) value
;
531 fNode
.setEventType(ce
.getAttribute(TmfTraceType
.EVENT_TYPE_ATTR
));
532 fNode
.setName(ce
.getAttribute(TmfTraceType
.NAME_ATTR
));
533 } else if (value
instanceof CustomTxtTraceDefinition
) {
534 CustomTxtTraceDefinition def
= (CustomTxtTraceDefinition
) value
;
535 fNode
.setEventType(CustomTxtEvent
.class.getCanonicalName() + ":" + def
.definitionName
); //$NON-NLS-1$
536 fNode
.setName(def
.definitionName
);
537 } else if (value
instanceof CustomXmlTraceDefinition
) {
538 CustomXmlTraceDefinition def
= (CustomXmlTraceDefinition
) value
;
539 fNode
.setEventType(CustomXmlEvent
.class.getCanonicalName() + ":" + def
.definitionName
); //$NON-NLS-1$
540 fNode
.setName(def
.definitionName
);
542 fViewer
.refresh(fNode
);
550 protected Map
<String
, Object
> getEventsTypeMap() {
551 Map
<String
, Object
> eventsTypeMap
= new LinkedHashMap
<>();
552 for (IConfigurationElement ce
: TmfTraceType
.getTypeElements()) {
553 String categoryName
= TmfTraceType
.getCategoryName(ce
.getAttribute(TmfTraceType
.CATEGORY_ATTR
));
554 String text
= categoryName
+ " : " + ce
.getAttribute(TmfTraceType
.NAME_ATTR
); //$NON-NLS-1$
555 eventsTypeMap
.put(text
, ce
);
557 for (CustomTxtTraceDefinition def
: CustomTxtTraceDefinition
.loadAll()) {
558 String text
= CUSTOM_TXT_CATEGORY
+ " : " + def
.definitionName
; //$NON-NLS-1$
559 eventsTypeMap
.put(text
, def
);
561 for (CustomXmlTraceDefinition def
: CustomXmlTraceDefinition
.loadAll()) {
562 String text
= CUSTOM_XML_CATEGORY
+ " : " + def
.definitionName
; //$NON-NLS-1$
563 eventsTypeMap
.put(text
, def
);
565 return eventsTypeMap
;
569 private class FilterAndNodeComposite
extends FilterBaseNodeComposite
{
570 TmfFilterAndNode fNode
;
573 FilterAndNodeComposite(Composite parent
, TmfFilterAndNode node
) {
577 Label label
= new Label(this, SWT
.NONE
);
578 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
579 label
.setText(Messages
.FilterViewer_NotLabel
);
581 fNotButton
= new Button(this, SWT
.CHECK
);
582 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
583 fNotButton
.setSelection(fNode
.isNot());
584 fNotButton
.addSelectionListener(new SelectionAdapter() {
586 public void widgetSelected(SelectionEvent e
) {
587 fNode
.setNot(fNotButton
.getSelection());
588 fViewer
.refresh(fNode
);
594 private class FilterOrNodeComposite
extends FilterBaseNodeComposite
{
595 TmfFilterOrNode fNode
;
598 FilterOrNodeComposite(Composite parent
, TmfFilterOrNode node
) {
602 Label label
= new Label(this, SWT
.NONE
);
603 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
604 label
.setText(Messages
.FilterViewer_NotLabel
);
606 fNotButton
= new Button(this, SWT
.CHECK
);
607 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
608 fNotButton
.setSelection(fNode
.isNot());
609 fNotButton
.addSelectionListener(new SelectionAdapter() {
611 public void widgetSelected(SelectionEvent e
) {
612 fNode
.setNot(fNotButton
.getSelection());
613 fViewer
.refresh(fNode
);
619 private class FilterContainsNodeComposite
extends FilterBaseNodeComposite
{
620 TmfFilterContainsNode fNode
;
624 Button fIgnoreCaseButton
;
626 FilterContainsNodeComposite(Composite parent
, TmfFilterContainsNode node
) {
630 Label label
= new Label(this, SWT
.NONE
);
631 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
632 label
.setText(Messages
.FilterViewer_NotLabel
);
634 fNotButton
= new Button(this, SWT
.CHECK
);
635 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
636 fNotButton
.setSelection(fNode
.isNot());
637 fNotButton
.addSelectionListener(new SelectionAdapter() {
639 public void widgetSelected(SelectionEvent e
) {
640 fNode
.setNot(fNotButton
.getSelection());
641 fViewer
.refresh(fNode
);
645 label
= new Label(this, SWT
.NONE
);
646 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
647 label
.setText(Messages
.FilterViewer_FieldLabel
);
649 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
650 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
651 fFieldCombo
.setItems(getFieldsList(fNode
));
652 if (fNode
.getField() != null) {
653 fFieldCombo
.setText(fNode
.getField());
655 fFieldCombo
.addModifyListener(new ModifyListener() {
657 public void modifyText(ModifyEvent e
) {
658 fNode
.setField(fFieldCombo
.getText());
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_ValueLabel
);
667 fValueText
= new Text(this, SWT
.BORDER
);
668 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
669 if (node
.getValue() != null && node
.getValue().length() > 0) {
670 fValueText
.setText(node
.getValue());
672 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
673 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
675 fValueText
.addFocusListener(new FocusListener() {
677 public void focusLost(FocusEvent e
) {
678 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
679 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
680 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
685 public void focusGained(FocusEvent e
) {
686 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
687 fValueText
.setText(""); //$NON-NLS-1$
689 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
692 fValueText
.addModifyListener(new ModifyListener() {
694 public void modifyText(ModifyEvent e
) {
695 if (!fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
696 fNode
.setValue(fValueText
.getText());
697 fViewer
.refresh(fNode
);
702 label
= new Label(this, SWT
.NONE
);
703 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
705 fIgnoreCaseButton
= new Button(this, SWT
.CHECK
);
706 fIgnoreCaseButton
.setSelection(fNode
.isIgnoreCase());
707 fIgnoreCaseButton
.setText(Messages
.FilterViewer_IgnoreCaseButtonText
);
708 fIgnoreCaseButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
709 fIgnoreCaseButton
.addSelectionListener(new SelectionAdapter() {
711 public void widgetSelected(SelectionEvent e
) {
712 fNode
.setIgnoreCase(fIgnoreCaseButton
.getSelection());
713 fViewer
.refresh(fNode
);
719 private class FilterEqualsNodeComposite
extends FilterBaseNodeComposite
{
720 TmfFilterEqualsNode fNode
;
724 Button fIgnoreCaseButton
;
726 FilterEqualsNodeComposite(Composite parent
, TmfFilterEqualsNode node
) {
730 Label label
= new Label(this, SWT
.NONE
);
731 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
732 label
.setText(Messages
.FilterViewer_NotLabel
);
734 fNotButton
= new Button(this, SWT
.CHECK
);
735 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
736 fNotButton
.setSelection(fNode
.isNot());
737 fNotButton
.addSelectionListener(new SelectionAdapter() {
739 public void widgetSelected(SelectionEvent e
) {
740 fNode
.setNot(fNotButton
.getSelection());
741 fViewer
.refresh(fNode
);
745 label
= new Label(this, SWT
.NONE
);
746 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
747 label
.setText(Messages
.FilterViewer_FieldLabel
);
749 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
750 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
751 fFieldCombo
.setItems(getFieldsList(fNode
));
752 if (fNode
.getField() != null) {
753 fFieldCombo
.setText(fNode
.getField());
755 fFieldCombo
.addModifyListener(new ModifyListener() {
757 public void modifyText(ModifyEvent e
) {
758 fNode
.setField(fFieldCombo
.getText());
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_ValueLabel
);
767 fValueText
= new Text(this, SWT
.BORDER
);
768 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
769 if (node
.getValue() != null && node
.getValue().length() > 0) {
770 fValueText
.setText(node
.getValue());
772 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
773 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
775 fValueText
.addFocusListener(new FocusListener() {
777 public void focusLost(FocusEvent e
) {
778 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
779 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
780 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
785 public void focusGained(FocusEvent e
) {
786 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
787 fValueText
.setText(""); //$NON-NLS-1$
789 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
792 fValueText
.addModifyListener(new ModifyListener() {
794 public void modifyText(ModifyEvent e
) {
795 if (!fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
796 fNode
.setValue(fValueText
.getText());
797 fViewer
.refresh(fNode
);
802 label
= new Label(this, SWT
.NONE
);
803 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
805 fIgnoreCaseButton
= new Button(this, SWT
.CHECK
);
806 fIgnoreCaseButton
.setSelection(fNode
.isIgnoreCase());
807 fIgnoreCaseButton
.setText(Messages
.FilterViewer_IgnoreCaseButtonText
);
808 fIgnoreCaseButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
809 fIgnoreCaseButton
.addSelectionListener(new SelectionAdapter() {
811 public void widgetSelected(SelectionEvent e
) {
812 fNode
.setIgnoreCase(fIgnoreCaseButton
.getSelection());
813 fViewer
.refresh(fNode
);
819 private class FilterMatchesNodeComposite
extends FilterBaseNodeComposite
{
820 TmfFilterMatchesNode fNode
;
825 FilterMatchesNodeComposite(Composite parent
, TmfFilterMatchesNode node
) {
829 Label label
= new Label(this, SWT
.NONE
);
830 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
831 label
.setText(Messages
.FilterViewer_NotLabel
);
833 fNotButton
= new Button(this, SWT
.CHECK
);
834 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
835 fNotButton
.setSelection(fNode
.isNot());
836 fNotButton
.addSelectionListener(new SelectionAdapter() {
838 public void widgetSelected(SelectionEvent e
) {
839 fNode
.setNot(fNotButton
.getSelection());
840 fViewer
.refresh(fNode
);
844 label
= new Label(this, SWT
.NONE
);
845 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
846 label
.setText(Messages
.FilterViewer_FieldLabel
);
848 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
849 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
850 fFieldCombo
.setItems(getFieldsList(fNode
));
851 if (fNode
.getField() != null) {
852 fFieldCombo
.setText(fNode
.getField());
854 fFieldCombo
.addModifyListener(new ModifyListener() {
856 public void modifyText(ModifyEvent e
) {
857 fNode
.setField(fFieldCombo
.getText());
858 fViewer
.refresh(fNode
);
862 label
= new Label(this, SWT
.NONE
);
863 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
864 label
.setText(Messages
.FilterViewer_RegexLabel
);
866 fRegexText
= new Text(this, SWT
.BORDER
);
867 fRegexText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
868 if (node
.getRegex() != null && node
.getRegex().length() > 0) {
869 fRegexText
.setText(node
.getRegex());
871 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
872 fRegexText
.setText(Messages
.FilterViewer_RegexHint
);
874 fRegexText
.addFocusListener(new FocusListener() {
876 public void focusLost(FocusEvent e
) {
877 if (fNode
.getRegex() == null || fNode
.getRegex().length() == 0) {
878 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
879 fRegexText
.setText(Messages
.FilterViewer_RegexHint
);
884 public void focusGained(FocusEvent e
) {
885 if (fRegexText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
886 fRegexText
.setText(""); //$NON-NLS-1$
888 fRegexText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
891 fRegexText
.addModifyListener(new ModifyListener() {
893 public void modifyText(ModifyEvent e
) {
894 if (!fRegexText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
895 fNode
.setRegex(fRegexText
.getText());
896 fViewer
.refresh(fNode
);
903 private class FilterCompareNodeComposite
extends FilterBaseNodeComposite
{
904 TmfFilterCompareNode fNode
;
913 Button fTimestampButton
;
915 FilterCompareNodeComposite(Composite parent
, TmfFilterCompareNode node
) {
919 Label label
= new Label(this, SWT
.NONE
);
920 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
921 label
.setText(Messages
.FilterViewer_NotLabel
);
923 fNotButton
= new Button(this, SWT
.CHECK
);
924 fNotButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
925 fNotButton
.setSelection(fNode
.isNot());
926 fNotButton
.addSelectionListener(new SelectionAdapter() {
928 public void widgetSelected(SelectionEvent e
) {
929 fNode
.setNot(fNotButton
.getSelection());
930 fViewer
.refresh(fNode
);
934 label
= new Label(this, SWT
.NONE
);
935 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
936 label
.setText(Messages
.FilterViewer_FieldLabel
);
938 fFieldCombo
= new Combo(this, SWT
.DROP_DOWN
);
939 fFieldCombo
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
940 fFieldCombo
.setItems(getFieldsList(fNode
));
941 if (fNode
.getField() != null) {
942 fFieldCombo
.setText(fNode
.getField());
944 fFieldCombo
.addModifyListener(new ModifyListener() {
946 public void modifyText(ModifyEvent e
) {
947 fNode
.setField(fFieldCombo
.getText());
948 fViewer
.refresh(fNode
);
952 label
= new Label(this, SWT
.NONE
);
953 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
954 label
.setText(Messages
.FilterViewer_ResultLabel
);
956 Composite resultGroup
= new Composite(this, SWT
.NONE
);
957 GridLayout rggl
= new GridLayout(3, true);
958 rggl
.marginHeight
= 0;
959 rggl
.marginWidth
= 0;
960 resultGroup
.setLayout(rggl
);
961 resultGroup
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
963 fLTButton
= new Button(resultGroup
, SWT
.RADIO
);
964 fLTButton
.setSelection(fNode
.getResult() < 0);
965 fLTButton
.setText("<"); //$NON-NLS-1$
966 fLTButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
967 fLTButton
.addSelectionListener(new SelectionAdapter() {
969 public void widgetSelected(SelectionEvent e
) {
970 if (fLTButton
.getSelection()) {
973 fViewer
.refresh(fNode
);
977 fEQButton
= new Button(resultGroup
, SWT
.RADIO
);
978 fEQButton
.setSelection(fNode
.getResult() == 0);
979 fEQButton
.setText("="); //$NON-NLS-1$
980 fEQButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
981 fEQButton
.addSelectionListener(new SelectionAdapter() {
983 public void widgetSelected(SelectionEvent e
) {
984 if (fEQButton
.getSelection()) {
987 fViewer
.refresh(fNode
);
991 fGTButton
= new Button(resultGroup
, SWT
.RADIO
);
992 fGTButton
.setSelection(fNode
.getResult() > 0);
993 fGTButton
.setText(">"); //$NON-NLS-1$
994 fGTButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
995 fGTButton
.addSelectionListener(new SelectionAdapter() {
997 public void widgetSelected(SelectionEvent e
) {
998 if (fGTButton
.getSelection()) {
1001 fViewer
.refresh(fNode
);
1005 label
= new Label(this, SWT
.NONE
);
1006 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1007 label
.setText(Messages
.FilterViewer_TypeLabel
);
1009 Composite typeGroup
= new Composite(this, SWT
.NONE
);
1010 GridLayout tggl
= new GridLayout(3, false);
1011 tggl
.marginHeight
= 0;
1012 tggl
.marginWidth
= 0;
1013 typeGroup
.setLayout(tggl
);
1014 typeGroup
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1016 fNumButton
= new Button(typeGroup
, SWT
.RADIO
);
1017 fNumButton
.setSelection(fNode
.getType() == Type
.NUM
);
1018 fNumButton
.setText(Messages
.FilterViewer_NumButtonText
);
1019 fNumButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1020 fNumButton
.addSelectionListener(new SelectionAdapter() {
1022 public void widgetSelected(SelectionEvent e
) {
1023 if (fNumButton
.getSelection()) {
1024 fNode
.setType(Type
.NUM
);
1026 fViewer
.refresh(fNode
);
1030 fAlphaButton
= new Button(typeGroup
, SWT
.RADIO
);
1031 fAlphaButton
.setSelection(fNode
.getType() == Type
.ALPHA
);
1032 fAlphaButton
.setText(Messages
.FilterViewer_AlphaButtonText
);
1033 fAlphaButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1034 fAlphaButton
.addSelectionListener(new SelectionAdapter() {
1036 public void widgetSelected(SelectionEvent e
) {
1037 if (fAlphaButton
.getSelection()) {
1038 fNode
.setType(Type
.ALPHA
);
1040 fViewer
.refresh(fNode
);
1044 fTimestampButton
= new Button(typeGroup
, SWT
.RADIO
);
1045 fTimestampButton
.setSelection(fNode
.getType() == Type
.TIMESTAMP
);
1046 fTimestampButton
.setText(Messages
.FilterViewer_TimestampButtonText
);
1047 fTimestampButton
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1048 fTimestampButton
.addSelectionListener(new SelectionAdapter() {
1050 public void widgetSelected(SelectionEvent e
) {
1051 if (fTimestampButton
.getSelection()) {
1052 fNode
.setType(Type
.TIMESTAMP
);
1054 fViewer
.refresh(fNode
);
1058 label
= new Label(this, SWT
.NONE
);
1059 label
.setBackground(Display
.getCurrent().getSystemColor(SWT
.COLOR_WHITE
));
1060 label
.setText(Messages
.FilterViewer_ValueLabel
);
1062 fValueText
= new Text(this, SWT
.BORDER
);
1063 fValueText
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false));
1064 if (node
.getValue() != null && node
.getValue().length() > 0) {
1065 fValueText
.setText(node
.getValue());
1067 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
1068 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
1070 fValueText
.addFocusListener(new FocusListener() {
1072 public void focusLost(FocusEvent e
) {
1073 if (fNode
.getValue() == null || fNode
.getValue().length() == 0) {
1074 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
));
1075 fValueText
.setText(Messages
.FilterViewer_ValueHint
);
1080 public void focusGained(FocusEvent e
) {
1081 if (fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
1082 fValueText
.setText(""); //$NON-NLS-1$
1084 fValueText
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_BLACK
));
1087 fValueText
.addModifyListener(new ModifyListener() {
1089 public void modifyText(ModifyEvent e
) {
1090 if (!fValueText
.getForeground().equals(Display
.getCurrent().getSystemColor(SWT
.COLOR_GRAY
))) {
1091 fNode
.setValue(fValueText
.getText());
1092 fViewer
.refresh(fNode
);