import java.util.Map;\r
import java.util.Map.Entry;\r
\r
+import org.eclipse.core.runtime.CoreException;\r
+import org.eclipse.core.runtime.IConfigurationElement;\r
import org.eclipse.jface.action.Action;\r
import org.eclipse.jface.action.IMenuListener;\r
import org.eclipse.jface.action.IMenuManager;\r
import org.eclipse.jface.viewers.SelectionChangedEvent;\r
import org.eclipse.jface.viewers.StructuredSelection;\r
import org.eclipse.jface.viewers.TreeViewer;\r
-import org.eclipse.linuxtools.tmf.filter.model.ITmfFilterTreeNode;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterAndNode;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterCompareNode;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterCompareNode.Type;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterContainsNode;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterEqualsNode;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterEventTypeNode;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterMatchesNode;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterNode;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterOrNode;\r
-import org.eclipse.linuxtools.tmf.filter.model.TmfFilterRootNode;\r
+import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r
+import org.eclipse.linuxtools.tmf.core.event.TmfEventType;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.ITmfFilterTreeNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterAndNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterCompareNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterContainsNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterEqualsNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterEventTypeNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterMatchesNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterOrNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterRootNode;\r
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterCompareNode.Type;\r
+import org.eclipse.linuxtools.tmf.core.util.TmfTraceType;\r
import org.eclipse.linuxtools.tmf.ui.internal.Messages;\r
-import org.eclipse.linuxtools.tmf.ui.parsers.ParserProviderManager;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTraceDefinition.OutputColumn;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtEvent;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTrace;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomTxtTraceDefinition;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlEvent;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTrace;\r
+import org.eclipse.linuxtools.tmf.ui.parsers.custom.CustomXmlTraceDefinition;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.custom.SashForm;\r
import org.eclipse.swt.events.FocusEvent;\r
\r
class FilterViewer extends Composite {\r
\r
- private static final Map<String, Entry<String, String>> EVENT_TYPES_MAP;\r
- static {\r
- Map<String, Entry<String, String>> eventTypesMap = new LinkedHashMap<String, Entry<String, String>>();\r
- for (Entry<String, Map<String, String>> categoryEntry : ParserProviderManager.getParserMap().entrySet()) {\r
- for (Entry<String, String> parserEntry : categoryEntry.getValue().entrySet()) {\r
- String prefix = categoryEntry.getKey() + " - " + parserEntry.getKey() + " - "; //$NON-NLS-1$ //$NON-NLS-2$\r
- for (Entry<String, String> eventTypeEntry : ParserProviderManager.getEventTypeMapForParser(parserEntry.getValue()).entrySet()) {\r
- eventTypesMap.put(prefix + eventTypeEntry.getKey(), eventTypeEntry);\r
- }\r
- }\r
- }\r
- EVENT_TYPES_MAP = eventTypesMap;\r
- }\r
- \r
- private static final String[] FIELDS_LIST;\r
- static {\r
- ArrayList<String> fieldsList = new ArrayList<String>();\r
- for (Entry<String, Map<String, String>> categoryEntry : ParserProviderManager.getParserMap().entrySet()) {\r
- for (Entry<String, String> parserEntry : categoryEntry.getValue().entrySet()) {\r
- fieldsList.add(""); //$NON-NLS-1$\r
- fieldsList.add("["+ categoryEntry.getKey() +" - " + parserEntry.getKey() +"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
- for (String eventType : ParserProviderManager.getEventTypeMapForParser(parserEntry.getValue()).values()) {\r
- for (String field : ParserProviderManager.getFieldLabelsForEventType(eventType)) {\r
- fieldsList.add(field);\r
- }\r
- }\r
- }\r
- }\r
- FIELDS_LIST = fieldsList.toArray(new String[0]);\r
- }\r
- \r
+ private static final String CUSTOM_TXT_CATEGORY = "Custom Text"; //$NON-NLS-1$\r
+ private static final String CUSTOM_XML_CATEGORY = "Custom XML"; //$NON-NLS-1$\r
+\r
private TreeViewer fViewer;\r
private Composite fComposite;\r
\r
- public FilterViewer(Composite parent, int style) {\r
- super(parent, style);\r
+ public FilterViewer(Composite parent, int style) {\r
+ super(parent, style);\r
\r
- setLayout(new FillLayout());\r
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);\r
- setLayoutData(gd);\r
- \r
+ setLayout(new FillLayout());\r
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);\r
+ setLayoutData(gd);\r
+ \r
final SashForm sash = new SashForm(this, SWT.HORIZONTAL);\r
\r
- // Create the tree viewer to display the filter tree\r
- fViewer = new TreeViewer(sash, SWT.NONE);\r
- fViewer.setContentProvider(new FilterTreeContentProvider());\r
- fViewer.setLabelProvider(new FilterTreeLabelProvider());\r
- fViewer.setInput(new TmfFilterRootNode());\r
- \r
- // Create the empty filter node properties panel\r
- fComposite = new Composite(sash, SWT.NONE);\r
- GridLayout gl = new GridLayout();\r
- gl.marginHeight = 0;\r
- gl.marginWidth = 0;\r
- fComposite.setLayout(gl);\r
+ // Create the tree viewer to display the filter tree\r
+ fViewer = new TreeViewer(sash, SWT.NONE);\r
+ fViewer.setContentProvider(new FilterTreeContentProvider());\r
+ fViewer.setLabelProvider(new FilterTreeLabelProvider());\r
+ fViewer.setInput(new TmfFilterRootNode());\r
+ \r
+ // Create the empty filter node properties panel\r
+ fComposite = new Composite(sash, SWT.NONE);\r
+ GridLayout gl = new GridLayout();\r
+ gl.marginHeight = 0;\r
+ gl.marginWidth = 0;\r
+ fComposite.setLayout(gl);\r
\r
- createContextMenu();\r
- \r
- fViewer.addSelectionChangedListener(new ISelectionChangedListener() {\r
- @Override\r
+ createContextMenu();\r
+ \r
+ fViewer.addSelectionChangedListener(new ISelectionChangedListener() {\r
+ @Override\r
public void selectionChanged(SelectionChangedEvent event) {\r
- if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {\r
- // Update the filter node properties panel to the selection\r
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();\r
- ITmfFilterTreeNode node = (ITmfFilterTreeNode) selection.getFirstElement();\r
- updateFilterNodeComposite(node);\r
- // Highlight the selection's children\r
- highlightTreeItems(fViewer.getTree().getSelection()[0].getItems());\r
- } else {\r
- updateFilterNodeComposite(null);\r
- }\r
- }\r
- });\r
- }\r
- \r
- /**\r
- * Create the context menu for the tree viewer\r
- */\r
- private void createContextMenu() {\r
- // Adds root context menu\r
- MenuManager menuManager = new MenuManager();\r
- menuManager.setRemoveAllWhenShown(true);\r
- menuManager.addMenuListener(new IMenuListener() {\r
- @Override\r
+ if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {\r
+ // Update the filter node properties panel to the selection\r
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();\r
+ ITmfFilterTreeNode node = (ITmfFilterTreeNode) selection.getFirstElement();\r
+ updateFilterNodeComposite(node);\r
+ // Highlight the selection's children\r
+ highlightTreeItems(fViewer.getTree().getSelection()[0].getItems());\r
+ } else {\r
+ updateFilterNodeComposite(null);\r
+ }\r
+ }\r
+ });\r
+ }\r
+ \r
+ /**\r
+ * Create the context menu for the tree viewer\r
+ */\r
+ private void createContextMenu() {\r
+ // Adds root context menu\r
+ MenuManager menuManager = new MenuManager();\r
+ menuManager.setRemoveAllWhenShown(true);\r
+ menuManager.addMenuListener(new IMenuListener() {\r
+ @Override\r
public void menuAboutToShow(IMenuManager manager) {\r
- fillContextMenu(manager);\r
- }\r
- });\r
+ fillContextMenu(manager);\r
+ }\r
+ });\r
\r
- // Context\r
- Menu contextMenu = menuManager.createContextMenu(fViewer.getTree());\r
+ // Context\r
+ Menu contextMenu = menuManager.createContextMenu(fViewer.getTree());\r
\r
- // Publish it\r
- fViewer.getTree().setMenu(contextMenu);\r
- }\r
- \r
- /**\r
- * Fill the context menu for the tree viewer\r
- */\r
- protected void fillContextMenu(IMenuManager manager) {\r
- final ISelection selection = fViewer.getSelection();\r
- ITmfFilterTreeNode filterTreeNode = null;\r
- if (selection instanceof StructuredSelection) {\r
- Object element = ((StructuredSelection) selection).getFirstElement();\r
- if (element instanceof ITmfFilterTreeNode) {\r
- filterTreeNode = (ITmfFilterTreeNode) element;\r
- }\r
- }\r
+ // Publish it\r
+ fViewer.getTree().setMenu(contextMenu);\r
+ }\r
+ \r
+ /**\r
+ * Fill the context menu for the tree viewer\r
+ */\r
+ protected void fillContextMenu(IMenuManager manager) {\r
+ final ISelection selection = fViewer.getSelection();\r
+ ITmfFilterTreeNode filterTreeNode = null;\r
+ if (selection instanceof StructuredSelection) {\r
+ Object element = ((StructuredSelection) selection).getFirstElement();\r
+ if (element instanceof ITmfFilterTreeNode) {\r
+ filterTreeNode = (ITmfFilterTreeNode) element;\r
+ }\r
+ }\r
\r
- final ITmfFilterTreeNode selectedNode = filterTreeNode;\r
- \r
- if (selectedNode != null) {\r
- \r
- fillContextMenuForNode(selectedNode, manager);\r
- \r
- if (selectedNode.getValidChildren().size() > 0) {\r
- manager.add(new Separator());\r
- }\r
+ final ITmfFilterTreeNode selectedNode = filterTreeNode;\r
+ \r
+ if (selectedNode != null) {\r
+ \r
+ fillContextMenuForNode(selectedNode, manager);\r
+ \r
+ if (selectedNode.getValidChildren().size() > 0) {\r
+ manager.add(new Separator());\r
+ }\r
\r
- Action deleteAction = new Action() {\r
- @Override\r
- public void run() {\r
- selectedNode.remove();\r
- fViewer.refresh();\r
- }\r
- };\r
- deleteAction.setText(Messages.FilterViewer_DeleteActionText);\r
- manager.add(deleteAction);\r
- \r
- manager.add(new Separator());\r
- }\r
+ Action deleteAction = new Action() {\r
+ @Override\r
+ public void run() {\r
+ selectedNode.remove();\r
+ fViewer.refresh();\r
+ }\r
+ };\r
+ deleteAction.setText(Messages.FilterViewer_DeleteActionText);\r
+ manager.add(deleteAction);\r
+ \r
+ manager.add(new Separator());\r
+ }\r
\r
- if (fViewer.getInput() instanceof TmfFilterRootNode || selectedNode == null) {\r
- final ITmfFilterTreeNode root = (ITmfFilterTreeNode) fViewer.getInput();\r
- \r
- fillContextMenuForNode(root, manager);\r
- }\r
- }\r
- \r
- /**\r
- * Fill the context menu with the valid children of the provided node\r
- */\r
- protected void fillContextMenuForNode(final ITmfFilterTreeNode node, IMenuManager manager) {\r
- for (final String child : node.getValidChildren()) {\r
- final Action action = new Action() {\r
- @Override\r
- public void run() {\r
- ITmfFilterTreeNode newNode = null;\r
- if (TmfFilterNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterNode(node, ""); //$NON-NLS-1$\r
- } else if (TmfFilterEventTypeNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterEventTypeNode(node);\r
- } else if (TmfFilterAndNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterAndNode(node);\r
- } else if (TmfFilterOrNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterOrNode(node);\r
- } else if (TmfFilterContainsNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterContainsNode(node);\r
- } else if (TmfFilterEqualsNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterEqualsNode(node);\r
- } else if (TmfFilterMatchesNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterMatchesNode(node);\r
- } else if (TmfFilterCompareNode.NODE_NAME.equals(child)) {\r
- newNode = new TmfFilterCompareNode(node);\r
- }\r
- if (newNode != null) {\r
- fViewer.refresh();\r
- fViewer.setSelection(new StructuredSelection(newNode), true);\r
- }\r
- }\r
- };\r
- if (TmfFilterNode.NODE_NAME.equals(child)) {\r
- action.setText(Messages.FilterViewer_NewPrefix + " " + child); //$NON-NLS-1$\r
- } else {\r
- action.setText(child);\r
- }\r
- manager.add(action);\r
- }\r
- }\r
- \r
- /**\r
- * Create the appropriate filter node properties composite\r
- */\r
- private void updateFilterNodeComposite(ITmfFilterTreeNode node) {\r
- for (Control control : fComposite.getChildren()) {\r
- control.dispose();\r
- }\r
- \r
- if (node instanceof TmfFilterNode) {\r
- new FilterNodeComposite(fComposite, (TmfFilterNode) node);\r
- } else if (node instanceof TmfFilterEventTypeNode) {\r
- new FilterEventTypeNodeComposite(fComposite, (TmfFilterEventTypeNode) node);\r
- } else if (node instanceof TmfFilterAndNode) {\r
- new FilterAndNodeComposite(fComposite, (TmfFilterAndNode) node);\r
- } else if (node instanceof TmfFilterOrNode) {\r
- new FilterOrNodeComposite(fComposite, (TmfFilterOrNode) node);\r
- } else if (node instanceof TmfFilterContainsNode) {\r
- new FilterContainsNodeComposite(fComposite, (TmfFilterContainsNode) node);\r
- } else if (node instanceof TmfFilterEqualsNode) {\r
- new FilterEqualsNodeComposite(fComposite, (TmfFilterEqualsNode) node);\r
- } else if (node instanceof TmfFilterMatchesNode) {\r
- new FilterMatchesNodeComposite(fComposite, (TmfFilterMatchesNode) node);\r
- } else if (node instanceof TmfFilterCompareNode) {\r
- new FilterCompareNodeComposite(fComposite, (TmfFilterCompareNode) node);\r
- } else {\r
- new FilterBaseNodeComposite(fComposite);\r
- }\r
- fComposite.layout();\r
- }\r
- \r
- /**\r
- * Highlight the provided tree items\r
- */\r
- private void highlightTreeItems(TreeItem[] items) {\r
- resetTreeItems(fViewer.getTree().getItems());\r
- for (TreeItem item : items) {\r
- item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));\r
- }\r
+ if (fViewer.getInput() instanceof TmfFilterRootNode || selectedNode == null) {\r
+ final ITmfFilterTreeNode root = (ITmfFilterTreeNode) fViewer.getInput();\r
+ \r
+ fillContextMenuForNode(root, manager);\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * Fill the context menu with the valid children of the provided node\r
+ */\r
+ protected void fillContextMenuForNode(final ITmfFilterTreeNode node, IMenuManager manager) {\r
+ for (final String child : node.getValidChildren()) {\r
+ final Action action = new Action() {\r
+ @Override\r
+ public void run() {\r
+ ITmfFilterTreeNode newNode = null;\r
+ if (TmfFilterNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterNode(node, ""); //$NON-NLS-1$\r
+ } else if (TmfFilterEventTypeNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterEventTypeNode(node);\r
+ } else if (TmfFilterAndNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterAndNode(node);\r
+ } else if (TmfFilterOrNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterOrNode(node);\r
+ } else if (TmfFilterContainsNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterContainsNode(node);\r
+ } else if (TmfFilterEqualsNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterEqualsNode(node);\r
+ } else if (TmfFilterMatchesNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterMatchesNode(node);\r
+ } else if (TmfFilterCompareNode.NODE_NAME.equals(child)) {\r
+ newNode = new TmfFilterCompareNode(node);\r
+ }\r
+ if (newNode != null) {\r
+ fViewer.refresh();\r
+ fViewer.setSelection(new StructuredSelection(newNode), true);\r
+ }\r
+ }\r
+ };\r
+ if (TmfFilterNode.NODE_NAME.equals(child)) {\r
+ action.setText(Messages.FilterViewer_NewPrefix + " " + child); //$NON-NLS-1$\r
+ } else {\r
+ action.setText(child);\r
+ }\r
+ manager.add(action);\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * Create the appropriate filter node properties composite\r
+ */\r
+ private void updateFilterNodeComposite(ITmfFilterTreeNode node) {\r
+ for (Control control : fComposite.getChildren()) {\r
+ control.dispose();\r
+ }\r
+ \r
+ if (node instanceof TmfFilterNode) {\r
+ new FilterNodeComposite(fComposite, (TmfFilterNode) node);\r
+ } else if (node instanceof TmfFilterEventTypeNode) {\r
+ new FilterEventTypeNodeComposite(fComposite, (TmfFilterEventTypeNode) node);\r
+ } else if (node instanceof TmfFilterAndNode) {\r
+ new FilterAndNodeComposite(fComposite, (TmfFilterAndNode) node);\r
+ } else if (node instanceof TmfFilterOrNode) {\r
+ new FilterOrNodeComposite(fComposite, (TmfFilterOrNode) node);\r
+ } else if (node instanceof TmfFilterContainsNode) {\r
+ new FilterContainsNodeComposite(fComposite, (TmfFilterContainsNode) node);\r
+ } else if (node instanceof TmfFilterEqualsNode) {\r
+ new FilterEqualsNodeComposite(fComposite, (TmfFilterEqualsNode) node);\r
+ } else if (node instanceof TmfFilterMatchesNode) {\r
+ new FilterMatchesNodeComposite(fComposite, (TmfFilterMatchesNode) node);\r
+ } else if (node instanceof TmfFilterCompareNode) {\r
+ new FilterCompareNodeComposite(fComposite, (TmfFilterCompareNode) node);\r
+ } else {\r
+ new FilterBaseNodeComposite(fComposite);\r
+ }\r
+ fComposite.layout();\r
+ }\r
+ \r
+ /**\r
+ * Highlight the provided tree items\r
+ */\r
+ private void highlightTreeItems(TreeItem[] items) {\r
+ resetTreeItems(fViewer.getTree().getItems());\r
+ for (TreeItem item : items) {\r
+ item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));\r
+ }\r
\r
- }\r
- \r
- /**\r
- * Reset the provided tree items (remove highlight)\r
- */\r
- private void resetTreeItems(TreeItem[] items) {\r
- for (TreeItem item : items) {\r
- item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- resetTreeItems(item.getItems());\r
- }\r
- }\r
- \r
- public void setInput(ITmfFilterTreeNode root) {\r
- fViewer.setInput(root);\r
- fViewer.expandAll();\r
- \r
- updateFilterNodeComposite(null);\r
- }\r
- \r
- public ITmfFilterTreeNode getInput() {\r
- return (ITmfFilterTreeNode) fViewer.getInput();\r
- }\r
- \r
- public void refresh() {\r
- fViewer.refresh();\r
- }\r
+ }\r
+ \r
+ /**\r
+ * Reset the provided tree items (remove highlight)\r
+ */\r
+ private void resetTreeItems(TreeItem[] items) {\r
+ for (TreeItem item : items) {\r
+ item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ resetTreeItems(item.getItems());\r
+ }\r
+ }\r
+ \r
+ public void setInput(ITmfFilterTreeNode root) {\r
+ fViewer.setInput(root);\r
+ fViewer.expandAll();\r
+ \r
+ updateFilterNodeComposite(null);\r
+ }\r
+ \r
+ public ITmfFilterTreeNode getInput() {\r
+ return (ITmfFilterTreeNode) fViewer.getInput();\r
+ }\r
+ \r
+ public void refresh() {\r
+ fViewer.refresh();\r
+ }\r
\r
- public void setSelection(ITmfFilterTreeNode node, boolean reveal) {\r
- fViewer.setSelection(new StructuredSelection(node), reveal);\r
- }\r
+ public void setSelection(ITmfFilterTreeNode node, boolean reveal) {\r
+ fViewer.setSelection(new StructuredSelection(node), reveal);\r
+ }\r
\r
- public void setSelection(ITmfFilterTreeNode node) {\r
- fViewer.setSelection(new StructuredSelection(node));\r
- }\r
- \r
- public ITmfFilterTreeNode getSelection() {\r
- final ISelection selection = fViewer.getSelection();\r
- ITmfFilterTreeNode filterTreeNode = null;\r
- if (selection instanceof StructuredSelection) {\r
- Object element = ((StructuredSelection) selection).getFirstElement();\r
- if (element instanceof ITmfFilterTreeNode) {\r
- filterTreeNode = (ITmfFilterTreeNode) element;\r
- }\r
- }\r
+ public void setSelection(ITmfFilterTreeNode node) {\r
+ fViewer.setSelection(new StructuredSelection(node));\r
+ }\r
+ \r
+ public ITmfFilterTreeNode getSelection() {\r
+ final ISelection selection = fViewer.getSelection();\r
+ ITmfFilterTreeNode filterTreeNode = null;\r
+ if (selection instanceof StructuredSelection) {\r
+ Object element = ((StructuredSelection) selection).getFirstElement();\r
+ if (element instanceof ITmfFilterTreeNode) {\r
+ filterTreeNode = (ITmfFilterTreeNode) element;\r
+ }\r
+ }\r
\r
- final ITmfFilterTreeNode selectedNode = filterTreeNode;\r
- return selectedNode;\r
- }\r
- \r
- public void addSelectionChangedListener(ISelectionChangedListener listener) {\r
- fViewer.addSelectionChangedListener(listener);\r
- }\r
- \r
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {\r
- fViewer.removeSelectionChangedListener(listener);\r
- }\r
- \r
- private class FilterBaseNodeComposite extends Composite {\r
- \r
- FilterBaseNodeComposite(Composite parent) {\r
- super(parent, SWT.NONE);\r
- setLayout(new GridLayout(2, false));\r
- setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
- setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- }\r
- \r
- protected String[] getFieldsList(ITmfFilterTreeNode node) {\r
- while (node != null) {\r
- if (node instanceof TmfFilterEventTypeNode) {\r
- TmfFilterEventTypeNode eventTypeNode = (TmfFilterEventTypeNode) node;\r
- return ParserProviderManager.getFieldLabelsForEventType(eventTypeNode.getEventType());\r
- }\r
- node = node.getParent();\r
- }\r
- return FIELDS_LIST;\r
- }\r
- }\r
+ final ITmfFilterTreeNode selectedNode = filterTreeNode;\r
+ return selectedNode;\r
+ }\r
+ \r
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {\r
+ fViewer.addSelectionChangedListener(listener);\r
+ }\r
+ \r
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {\r
+ fViewer.removeSelectionChangedListener(listener);\r
+ }\r
+ \r
+ private class FilterBaseNodeComposite extends Composite {\r
+ \r
+ FilterBaseNodeComposite(Composite parent) {\r
+ super(parent, SWT.NONE);\r
+ setLayout(new GridLayout(2, false));\r
+ setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
+ setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ }\r
+ \r
+ protected String[] getFieldsList(ITmfFilterTreeNode node) {\r
+ ArrayList<String> fieldsList = new ArrayList<String>();\r
+ while (node != null) {\r
+ if (node instanceof TmfFilterEventTypeNode) {\r
+ TmfFilterEventTypeNode eventTypeNode = (TmfFilterEventTypeNode) node;\r
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {\r
+ if (ce.getAttribute(TmfTraceType.EVENT_TYPE_ATTR).equals(eventTypeNode.getEventType())) {\r
+ try {\r
+ TmfEvent event = (TmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR);\r
+ TmfEventType eventType = event.getType();\r
+ if (eventType != null) {\r
+ for (String field : eventType.getLabels()) {\r
+ fieldsList.add(field);\r
+ }\r
+ }\r
+ } catch (CoreException e) {\r
+ }\r
+ return fieldsList.toArray(new String[0]);\r
+ }\r
+ }\r
+ if (eventTypeNode.getEventType().startsWith(CustomTxtEvent.class.getCanonicalName())) {\r
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
+ if (eventTypeNode.getEventType().equals(CustomTxtEvent.class.getCanonicalName() + ":" + def.definitionName)) { //$NON-NLS-1$\r
+ for (OutputColumn output : def.outputs) {\r
+ fieldsList.add(output.name);\r
+ }\r
+ return fieldsList.toArray(new String[0]);\r
+ }\r
+ }\r
+ }\r
+ if (eventTypeNode.getEventType().startsWith(CustomXmlEvent.class.getCanonicalName())) {\r
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
+ if (eventTypeNode.getEventType().equals(CustomXmlEvent.class.getCanonicalName() + ":" + def.definitionName)) { //$NON-NLS-1$\r
+ for (OutputColumn output : def.outputs) {\r
+ fieldsList.add(output.name);\r
+ }\r
+ return fieldsList.toArray(new String[0]);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ node = node.getParent();\r
+ }\r
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {\r
+ try {\r
+ TmfEvent event = (TmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR);\r
+ TmfEventType eventType = event.getType();\r
+ if (eventType != null) {\r
+ fieldsList.add("[" + TmfTraceType.getCategoryName(ce.getAttribute(TmfTraceType.CATEGORY_ATTR)) + //$NON-NLS-1$\r
+ " : " + ce.getAttribute(TmfTraceType.NAME_ATTR) + "]"); //$NON-NLS-1$ //$NON-NLS-2$\r
+ for (String field : eventType.getLabels()) {\r
+ fieldsList.add(field);\r
+ }\r
+ fieldsList.add(""); //$NON-NLS-1$\r
+ }\r
+ } catch (CoreException e) {\r
+ }\r
+ }\r
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
+ fieldsList.add("[" + CUSTOM_TXT_CATEGORY + //$NON-NLS-1$\r
+ " : " + def.definitionName + "]"); //$NON-NLS-1$ //$NON-NLS-2$\r
+ for (OutputColumn output : def.outputs) {\r
+ fieldsList.add(output.name);\r
+ }\r
+ fieldsList.add(""); //$NON-NLS-1$\r
+ }\r
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
+ fieldsList.add("[" + CUSTOM_XML_CATEGORY + //$NON-NLS-1$\r
+ " : " + def.definitionName + "]"); //$NON-NLS-1$ //$NON-NLS-2$\r
+ for (OutputColumn output : def.outputs) {\r
+ fieldsList.add(output.name);\r
+ }\r
+ fieldsList.add(""); //$NON-NLS-1$\r
+ }\r
+ return fieldsList.toArray(new String[0]);\r
+ }\r
+ }\r
\r
- private class FilterNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterNode fNode;\r
- Text fNameText;\r
- \r
- FilterNodeComposite(Composite parent, TmfFilterNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NameLabel);\r
- \r
- fNameText = new Text(this, SWT.BORDER);\r
- fNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getFilterName() != null && node.getFilterName().length() > 0) {\r
- fNameText.setText(node.getFilterName());\r
- } else {\r
- fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fNameText.setText(Messages.FilterViewer_FilterNameHint);\r
- }\r
- fNameText.addFocusListener(new FocusListener() {\r
- @Override\r
+ private class FilterNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterNode fNode;\r
+ Text fNameText;\r
+ \r
+ FilterNodeComposite(Composite parent, TmfFilterNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NameLabel);\r
+ \r
+ fNameText = new Text(this, SWT.BORDER);\r
+ fNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getFilterName() != null && node.getFilterName().length() > 0) {\r
+ fNameText.setText(node.getFilterName());\r
+ } else {\r
+ fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fNameText.setText(Messages.FilterViewer_FilterNameHint);\r
+ }\r
+ fNameText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getFilterName() == null || fNode.getFilterName().length() == 0) {\r
- fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fNameText.setText(Messages.FilterViewer_FilterNameHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getFilterName() == null || fNode.getFilterName().length() == 0) {\r
+ fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fNameText.setText(Messages.FilterViewer_FilterNameHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fNameText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNameText.setText(""); //$NON-NLS-1$\r
- }\r
- fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fNameText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fNameText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNameText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fNameText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fNameText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setFilterName(fNameText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- }\r
- }\r
+ if (! fNameText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setFilterName(fNameText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterEventTypeNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterEventTypeNode fNode;\r
- Combo fTypeCombo;\r
- \r
- FilterEventTypeNodeComposite(Composite parent, TmfFilterEventTypeNode node) {\r
- super(parent);\r
- fNode = node;\r
+ private class FilterEventTypeNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterEventTypeNode fNode;\r
+ Combo fTypeCombo;\r
+ Map<String, Object> fEventsTypeMap;\r
+ \r
+ FilterEventTypeNodeComposite(Composite parent, TmfFilterEventTypeNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ fEventsTypeMap = getEventsTypeMap();\r
\r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_TypeLabel);\r
- \r
- fTypeCombo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);\r
- fTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fTypeCombo.setItems(EVENT_TYPES_MAP.keySet().toArray(new String[0]));\r
- if (fNode.getEventType() != null) {\r
- for (Entry <String, Entry<String, String>> eventTypeEntry : EVENT_TYPES_MAP.entrySet()) {\r
- if (eventTypeEntry.getValue().getValue().equals(fNode.getEventType())) {\r
- fTypeCombo.setText(eventTypeEntry.getKey());\r
- }\r
- }\r
- }\r
- fTypeCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_TypeLabel);\r
+ \r
+ fTypeCombo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);\r
+ fTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fTypeCombo.setItems(fEventsTypeMap.keySet().toArray(new String[0]));\r
+ if (fNode.getEventType() != null) {\r
+ for (Entry <String, Object> eventTypeEntry : fEventsTypeMap.entrySet()) {\r
+ Object value = eventTypeEntry.getValue();\r
+ if (value instanceof IConfigurationElement) {\r
+ IConfigurationElement ce = (IConfigurationElement) value;\r
+ if (ce.getAttribute(TmfTraceType.EVENT_TYPE_ATTR).equals(fNode.getEventType())) {\r
+ fTypeCombo.setText(eventTypeEntry.getKey());\r
+ }\r
+ } else if (value instanceof CustomTxtTraceDefinition) {\r
+ CustomTxtTraceDefinition def = (CustomTxtTraceDefinition) value;\r
+ String eventType = CustomTxtEvent.class.getCanonicalName() + ":" + def.definitionName; //$NON-NLS-1$\r
+ if (eventType.equals(fNode.getEventType())) {\r
+ fTypeCombo.setText(eventTypeEntry.getKey());\r
+ }\r
+ } else if (value instanceof CustomXmlTraceDefinition) {\r
+ CustomXmlTraceDefinition def = (CustomXmlTraceDefinition) value;\r
+ String eventType = CustomXmlEvent.class.getCanonicalName() + ":" + def.definitionName; //$NON-NLS-1$\r
+ if (eventType.equals(fNode.getEventType())) {\r
+ fTypeCombo.setText(eventTypeEntry.getKey());\r
+ }\r
+ }\r
+ }\r
+ }\r
+ fTypeCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- for (Entry <String, Entry<String, String>> eventTypeEntry : EVENT_TYPES_MAP.entrySet()) {\r
- if (eventTypeEntry.getKey().equals(fTypeCombo.getText())) {\r
- fNode.setEventType(eventTypeEntry.getValue().getValue());\r
- fNode.setName(eventTypeEntry.getValue().getKey());\r
- fViewer.refresh(fNode);\r
- break;\r
- }\r
- }\r
- }\r
- });\r
- }\r
- }\r
- \r
- private class FilterAndNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterAndNode fNode;\r
- Button fNotButton;\r
- \r
- FilterAndNodeComposite(Composite parent, TmfFilterAndNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- }\r
- }\r
+ for (Entry <String, Object> eventTypeEntry : fEventsTypeMap.entrySet()) {\r
+ if (eventTypeEntry.getKey().equals(fTypeCombo.getText())) {\r
+ Object value = eventTypeEntry.getValue();\r
+ if (value instanceof IConfigurationElement) {\r
+ IConfigurationElement ce = (IConfigurationElement) value;\r
+ fNode.setEventType(ce.getAttribute(TmfTraceType.EVENT_TYPE_ATTR));\r
+ fNode.setName(ce.getAttribute(TmfTraceType.NAME_ATTR));\r
+ } else if (value instanceof CustomTxtTraceDefinition) {\r
+ CustomTxtTraceDefinition def = (CustomTxtTraceDefinition) value;\r
+ fNode.setEventType(CustomTxtEvent.class.getCanonicalName() + ":" + def.definitionName); //$NON-NLS-1$\r
+ fNode.setName(def.definitionName);\r
+ } else if (value instanceof CustomXmlTraceDefinition) {\r
+ CustomXmlTraceDefinition def = (CustomXmlTraceDefinition) value;\r
+ fNode.setEventType(CustomXmlEvent.class.getCanonicalName() + ":" + def.definitionName); //$NON-NLS-1$\r
+ fNode.setName(def.definitionName);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ });\r
+ }\r
+\r
+ protected Map<String, Object> getEventsTypeMap() {\r
+ Map<String, Object> eventsTypeMap = new LinkedHashMap<String, Object>();\r
+ for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {\r
+ String categoryName = TmfTraceType.getCategoryName(ce.getAttribute(TmfTraceType.CATEGORY_ATTR));\r
+ String text = categoryName + " : " + ce.getAttribute(TmfTraceType.NAME_ATTR); //$NON-NLS-1$\r
+ eventsTypeMap.put(text, ce);\r
+ }\r
+ for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) {\r
+ String text = CUSTOM_TXT_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$\r
+ eventsTypeMap.put(text, def);\r
+ }\r
+ for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) {\r
+ String text = CUSTOM_XML_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$\r
+ eventsTypeMap.put(text, def);\r
+ }\r
+ return eventsTypeMap;\r
+ }\r
+ }\r
+ \r
+ private class FilterAndNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterAndNode fNode;\r
+ Button fNotButton;\r
+ \r
+ FilterAndNodeComposite(Composite parent, TmfFilterAndNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterOrNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterOrNode fNode;\r
- Button fNotButton;\r
- \r
- FilterOrNodeComposite(Composite parent, TmfFilterOrNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- }\r
- }\r
- \r
- private class FilterContainsNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterContainsNode fNode;\r
- Button fNotButton;\r
- Combo fFieldCombo;\r
- Text fValueText;\r
- Button fIgnoreCaseButton;\r
- \r
- FilterContainsNodeComposite(Composite parent, TmfFilterContainsNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_FieldLabel);\r
- \r
- fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
- fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fFieldCombo.setItems(getFieldsList(fNode));\r
- if (fNode.getField() != null) {\r
- fFieldCombo.setText(fNode.getField());\r
- }\r
- fFieldCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ private class FilterOrNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterOrNode fNode;\r
+ Button fNotButton;\r
+ \r
+ FilterOrNodeComposite(Composite parent, TmfFilterOrNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ }\r
+ }\r
+ \r
+ private class FilterContainsNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterContainsNode fNode;\r
+ Button fNotButton;\r
+ Combo fFieldCombo;\r
+ Text fValueText;\r
+ Button fIgnoreCaseButton;\r
+ \r
+ FilterContainsNodeComposite(Composite parent, TmfFilterContainsNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_FieldLabel);\r
+ \r
+ fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
+ fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fFieldCombo.setItems(getFieldsList(fNode));\r
+ if (fNode.getField() != null) {\r
+ fFieldCombo.setText(fNode.getField());\r
+ }\r
+ fFieldCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- fNode.setField(fFieldCombo.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_ValueLabel);\r
- \r
- fValueText = new Text(this, SWT.BORDER);\r
- fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getValue() != null && node.getValue().length() > 0) {\r
- fValueText.setText(node.getValue());\r
- } else {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- fValueText.addFocusListener(new FocusListener() {\r
- @Override\r
+ fNode.setField(fFieldCombo.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_ValueLabel);\r
+ \r
+ fValueText = new Text(this, SWT.BORDER);\r
+ fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getValue() != null && node.getValue().length() > 0) {\r
+ fValueText.setText(node.getValue());\r
+ } else {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ fValueText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fValueText.setText(""); //$NON-NLS-1$\r
- }\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fValueText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fValueText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fValueText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setValue(fValueText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- \r
- fIgnoreCaseButton = new Button(this, SWT.CHECK);\r
- fIgnoreCaseButton.setSelection(fNode.isIgnoreCase());\r
- fIgnoreCaseButton.setText(Messages.FilterViewer_IgnoreCaseButtonText);\r
- fIgnoreCaseButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fIgnoreCaseButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setIgnoreCase(fIgnoreCaseButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- }\r
- }\r
+ if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setValue(fValueText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ \r
+ fIgnoreCaseButton = new Button(this, SWT.CHECK);\r
+ fIgnoreCaseButton.setSelection(fNode.isIgnoreCase());\r
+ fIgnoreCaseButton.setText(Messages.FilterViewer_IgnoreCaseButtonText);\r
+ fIgnoreCaseButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fIgnoreCaseButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setIgnoreCase(fIgnoreCaseButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterEqualsNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterEqualsNode fNode;\r
- Button fNotButton;\r
- Combo fFieldCombo;\r
- Text fValueText;\r
- Button fIgnoreCaseButton;\r
- \r
- FilterEqualsNodeComposite(Composite parent, TmfFilterEqualsNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_FieldLabel);\r
- \r
- fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
- fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fFieldCombo.setItems(getFieldsList(fNode));\r
- if (fNode.getField() != null) {\r
- fFieldCombo.setText(fNode.getField());\r
- }\r
- fFieldCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ private class FilterEqualsNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterEqualsNode fNode;\r
+ Button fNotButton;\r
+ Combo fFieldCombo;\r
+ Text fValueText;\r
+ Button fIgnoreCaseButton;\r
+ \r
+ FilterEqualsNodeComposite(Composite parent, TmfFilterEqualsNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_FieldLabel);\r
+ \r
+ fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
+ fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fFieldCombo.setItems(getFieldsList(fNode));\r
+ if (fNode.getField() != null) {\r
+ fFieldCombo.setText(fNode.getField());\r
+ }\r
+ fFieldCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- fNode.setField(fFieldCombo.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_ValueLabel);\r
- \r
- fValueText = new Text(this, SWT.BORDER);\r
- fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getValue() != null && node.getValue().length() > 0) {\r
- fValueText.setText(node.getValue());\r
- } else {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- fValueText.addFocusListener(new FocusListener() {\r
- @Override\r
+ fNode.setField(fFieldCombo.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_ValueLabel);\r
+ \r
+ fValueText = new Text(this, SWT.BORDER);\r
+ fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getValue() != null && node.getValue().length() > 0) {\r
+ fValueText.setText(node.getValue());\r
+ } else {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ fValueText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fValueText.setText(""); //$NON-NLS-1$\r
- }\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fValueText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fValueText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fValueText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setValue(fValueText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- \r
- fIgnoreCaseButton = new Button(this, SWT.CHECK);\r
- fIgnoreCaseButton.setSelection(fNode.isIgnoreCase());\r
- fIgnoreCaseButton.setText(Messages.FilterViewer_IgnoreCaseButtonText);\r
- fIgnoreCaseButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fIgnoreCaseButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setIgnoreCase(fIgnoreCaseButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- }\r
- }\r
+ if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setValue(fValueText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ \r
+ fIgnoreCaseButton = new Button(this, SWT.CHECK);\r
+ fIgnoreCaseButton.setSelection(fNode.isIgnoreCase());\r
+ fIgnoreCaseButton.setText(Messages.FilterViewer_IgnoreCaseButtonText);\r
+ fIgnoreCaseButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fIgnoreCaseButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setIgnoreCase(fIgnoreCaseButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterMatchesNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterMatchesNode fNode;\r
- Button fNotButton;\r
- Combo fFieldCombo;\r
- Text fRegexText;\r
- \r
- FilterMatchesNodeComposite(Composite parent, TmfFilterMatchesNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_FieldLabel);\r
- \r
- fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
- fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fFieldCombo.setItems(getFieldsList(fNode));\r
- if (fNode.getField() != null) {\r
- fFieldCombo.setText(fNode.getField());\r
- }\r
- fFieldCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ private class FilterMatchesNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterMatchesNode fNode;\r
+ Button fNotButton;\r
+ Combo fFieldCombo;\r
+ Text fRegexText;\r
+ \r
+ FilterMatchesNodeComposite(Composite parent, TmfFilterMatchesNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_FieldLabel);\r
+ \r
+ fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
+ fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fFieldCombo.setItems(getFieldsList(fNode));\r
+ if (fNode.getField() != null) {\r
+ fFieldCombo.setText(fNode.getField());\r
+ }\r
+ fFieldCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- fNode.setField(fFieldCombo.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_RegexLabel);\r
- \r
- fRegexText = new Text(this, SWT.BORDER);\r
- fRegexText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getRegex() != null && node.getRegex().length() > 0) {\r
- fRegexText.setText(node.getRegex());\r
- } else {\r
- fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fRegexText.setText(Messages.FilterViewer_RegexHint);\r
- }\r
- fRegexText.addFocusListener(new FocusListener() {\r
- @Override\r
+ fNode.setField(fFieldCombo.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_RegexLabel);\r
+ \r
+ fRegexText = new Text(this, SWT.BORDER);\r
+ fRegexText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getRegex() != null && node.getRegex().length() > 0) {\r
+ fRegexText.setText(node.getRegex());\r
+ } else {\r
+ fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fRegexText.setText(Messages.FilterViewer_RegexHint);\r
+ }\r
+ fRegexText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getRegex() == null || fNode.getRegex().length() == 0) {\r
- fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fRegexText.setText(Messages.FilterViewer_RegexHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getRegex() == null || fNode.getRegex().length() == 0) {\r
+ fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fRegexText.setText(Messages.FilterViewer_RegexHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fRegexText.setText(""); //$NON-NLS-1$\r
- }\r
- fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fRegexText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fRegexText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fRegexText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setRegex(fRegexText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- }\r
- }\r
+ if (! fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setRegex(fRegexText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
- private class FilterCompareNodeComposite extends FilterBaseNodeComposite {\r
- TmfFilterCompareNode fNode;\r
- Button fNotButton;\r
- Combo fFieldCombo;\r
- Text fValueText;\r
- Button fLTButton;\r
- Button fEQButton;\r
- Button fGTButton;\r
- Button fNumButton;\r
- Button fAlphaButton;\r
- Button fTimestampButton;\r
- \r
- FilterCompareNodeComposite(Composite parent, TmfFilterCompareNode node) {\r
- super(parent);\r
- fNode = node;\r
- \r
- Label label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_NotLabel);\r
- \r
- fNotButton = new Button(this, SWT.CHECK);\r
- fNotButton.setSelection(fNode.isNot());\r
- fNotButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- fNode.setNot(fNotButton.getSelection());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_FieldLabel);\r
- \r
- fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
- fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- fFieldCombo.setItems(getFieldsList(fNode));\r
- if (fNode.getField() != null) {\r
- fFieldCombo.setText(fNode.getField());\r
- }\r
- fFieldCombo.addModifyListener(new ModifyListener() {\r
- @Override\r
+ private class FilterCompareNodeComposite extends FilterBaseNodeComposite {\r
+ TmfFilterCompareNode fNode;\r
+ Button fNotButton;\r
+ Combo fFieldCombo;\r
+ Text fValueText;\r
+ Button fLTButton;\r
+ Button fEQButton;\r
+ Button fGTButton;\r
+ Button fNumButton;\r
+ Button fAlphaButton;\r
+ Button fTimestampButton;\r
+ \r
+ FilterCompareNodeComposite(Composite parent, TmfFilterCompareNode node) {\r
+ super(parent);\r
+ fNode = node;\r
+ \r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_NotLabel);\r
+ \r
+ fNotButton = new Button(this, SWT.CHECK);\r
+ fNotButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNotButton.setSelection(fNode.isNot());\r
+ fNotButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ fNode.setNot(fNotButton.getSelection());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_FieldLabel);\r
+ \r
+ fFieldCombo = new Combo(this, SWT.DROP_DOWN);\r
+ fFieldCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ fFieldCombo.setItems(getFieldsList(fNode));\r
+ if (fNode.getField() != null) {\r
+ fFieldCombo.setText(fNode.getField());\r
+ }\r
+ fFieldCombo.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- fNode.setField(fFieldCombo.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_ResultLabel);\r
- \r
- Composite resultGroup = new Composite(this, SWT.NONE);\r
- GridLayout rggl = new GridLayout(3, true);\r
- rggl.marginHeight = 0;\r
- rggl.marginWidth = 0;\r
- resultGroup.setLayout(rggl);\r
- resultGroup.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- \r
- fLTButton = new Button(resultGroup, SWT.RADIO);\r
- fLTButton.setSelection(fNode.getResult() < 0);\r
- fLTButton.setText("<"); //$NON-NLS-1$\r
- fLTButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fLTButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fLTButton.getSelection()) {\r
- fNode.setResult(-1);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- fEQButton = new Button(resultGroup, SWT.RADIO);\r
- fEQButton.setSelection(fNode.getResult() == 0);\r
- fEQButton.setText("="); //$NON-NLS-1$\r
- fEQButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fEQButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fEQButton.getSelection()) {\r
- fNode.setResult(0);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- fGTButton = new Button(resultGroup, SWT.RADIO);\r
- fGTButton.setSelection(fNode.getResult() > 0);\r
- fGTButton.setText(">"); //$NON-NLS-1$\r
- fGTButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fGTButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fGTButton.getSelection()) {\r
- fNode.setResult(1);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_TypeLabel);\r
- \r
- Composite typeGroup = new Composite(this, SWT.NONE);\r
- GridLayout tggl = new GridLayout(3, false);\r
- tggl.marginHeight = 0;\r
- tggl.marginWidth = 0;\r
- typeGroup.setLayout(tggl);\r
- typeGroup.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- \r
- fNumButton = new Button(typeGroup, SWT.RADIO);\r
- fNumButton.setSelection(fNode.getType() == Type.NUM);\r
- fNumButton.setText(Messages.FilterViewer_NumButtonText);\r
- fNumButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fNumButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fNumButton.getSelection()) {\r
- fNode.setType(Type.NUM);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- fAlphaButton = new Button(typeGroup, SWT.RADIO);\r
- fAlphaButton.setSelection(fNode.getType() == Type.ALPHA);\r
- fAlphaButton.setText(Messages.FilterViewer_AlphaButtonText);\r
- fAlphaButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fAlphaButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fAlphaButton.getSelection()) {\r
- fNode.setType(Type.ALPHA);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- fTimestampButton = new Button(typeGroup, SWT.RADIO);\r
- fTimestampButton.setSelection(fNode.getType() == Type.TIMESTAMP);\r
- fTimestampButton.setText(Messages.FilterViewer_TimestampButtonText);\r
- fTimestampButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- fTimestampButton.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (fTimestampButton.getSelection()) {\r
- fNode.setType(Type.TIMESTAMP);\r
- }\r
- fViewer.refresh(fNode);\r
- }\r
- });\r
- \r
- label = new Label(this, SWT.NONE);\r
- label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
- label.setText(Messages.FilterViewer_ValueLabel);\r
- \r
- fValueText = new Text(this, SWT.BORDER);\r
- fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- if (node.getValue() != null && node.getValue().length() > 0) {\r
- fValueText.setText(node.getValue());\r
- } else {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- fValueText.addFocusListener(new FocusListener() {\r
- @Override\r
+ fNode.setField(fFieldCombo.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_ResultLabel);\r
+ \r
+ Composite resultGroup = new Composite(this, SWT.NONE);\r
+ GridLayout rggl = new GridLayout(3, true);\r
+ rggl.marginHeight = 0;\r
+ rggl.marginWidth = 0;\r
+ resultGroup.setLayout(rggl);\r
+ resultGroup.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ \r
+ fLTButton = new Button(resultGroup, SWT.RADIO);\r
+ fLTButton.setSelection(fNode.getResult() < 0);\r
+ fLTButton.setText("<"); //$NON-NLS-1$\r
+ fLTButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fLTButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fLTButton.getSelection()) {\r
+ fNode.setResult(-1);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ fEQButton = new Button(resultGroup, SWT.RADIO);\r
+ fEQButton.setSelection(fNode.getResult() == 0);\r
+ fEQButton.setText("="); //$NON-NLS-1$\r
+ fEQButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fEQButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fEQButton.getSelection()) {\r
+ fNode.setResult(0);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ fGTButton = new Button(resultGroup, SWT.RADIO);\r
+ fGTButton.setSelection(fNode.getResult() > 0);\r
+ fGTButton.setText(">"); //$NON-NLS-1$\r
+ fGTButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fGTButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fGTButton.getSelection()) {\r
+ fNode.setResult(1);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_TypeLabel);\r
+ \r
+ Composite typeGroup = new Composite(this, SWT.NONE);\r
+ GridLayout tggl = new GridLayout(3, false);\r
+ tggl.marginHeight = 0;\r
+ tggl.marginWidth = 0;\r
+ typeGroup.setLayout(tggl);\r
+ typeGroup.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ \r
+ fNumButton = new Button(typeGroup, SWT.RADIO);\r
+ fNumButton.setSelection(fNode.getType() == Type.NUM);\r
+ fNumButton.setText(Messages.FilterViewer_NumButtonText);\r
+ fNumButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fNumButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fNumButton.getSelection()) {\r
+ fNode.setType(Type.NUM);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ fAlphaButton = new Button(typeGroup, SWT.RADIO);\r
+ fAlphaButton.setSelection(fNode.getType() == Type.ALPHA);\r
+ fAlphaButton.setText(Messages.FilterViewer_AlphaButtonText);\r
+ fAlphaButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fAlphaButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fAlphaButton.getSelection()) {\r
+ fNode.setType(Type.ALPHA);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ fTimestampButton = new Button(typeGroup, SWT.RADIO);\r
+ fTimestampButton.setSelection(fNode.getType() == Type.TIMESTAMP);\r
+ fTimestampButton.setText(Messages.FilterViewer_TimestampButtonText);\r
+ fTimestampButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ fTimestampButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if (fTimestampButton.getSelection()) {\r
+ fNode.setType(Type.TIMESTAMP);\r
+ }\r
+ fViewer.refresh(fNode);\r
+ }\r
+ });\r
+ \r
+ label = new Label(this, SWT.NONE);\r
+ label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));\r
+ label.setText(Messages.FilterViewer_ValueLabel);\r
+ \r
+ fValueText = new Text(this, SWT.BORDER);\r
+ fValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
+ if (node.getValue() != null && node.getValue().length() > 0) {\r
+ fValueText.setText(node.getValue());\r
+ } else {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ fValueText.addFocusListener(new FocusListener() {\r
+ @Override\r
public void focusLost(FocusEvent e) {\r
- if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
- fValueText.setText(Messages.FilterViewer_ValueHint);\r
- }\r
- }\r
- @Override\r
+ if (fNode.getValue() == null || fNode.getValue().length() == 0) {\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));\r
+ fValueText.setText(Messages.FilterViewer_ValueHint);\r
+ }\r
+ }\r
+ @Override\r
public void focusGained(FocusEvent e) {\r
- if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fValueText.setText(""); //$NON-NLS-1$\r
- }\r
- fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
- }\r
- });\r
- fValueText.addModifyListener(new ModifyListener() {\r
- @Override\r
+ if (fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fValueText.setText(""); //$NON-NLS-1$\r
+ }\r
+ fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));\r
+ }\r
+ });\r
+ fValueText.addModifyListener(new ModifyListener() {\r
+ @Override\r
public void modifyText(ModifyEvent e) {\r
- if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
- fNode.setValue(fValueText.getText());\r
- fViewer.refresh(fNode);\r
- }\r
- }\r
- });\r
- }\r
- }\r
+ if (! fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {\r
+ fNode.setValue(fValueText.getText());\r
+ fViewer.refresh(fNode);\r
+ }\r
+ }\r
+ });\r
+ }\r
+ }\r
\r
}\r