-/*******************************************************************************\r
- * Copyright (c) 2010 Ericsson\r
- *\r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * Yuriy Vashchuk - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.tmf.ui.views.filter;\r
-\r
-import org.eclipse.jface.viewers.ILabelProvider;\r
-import org.eclipse.jface.viewers.ILabelProviderListener;\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.TmfFilterCompareNode.Type;\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.swt.graphics.Image;\r
-\r
-/**\r
- * This is the Label Provider for our Filter Tree\r
- *\r
- * @version 1.0\r
- * @author Yuriy Vashchuk\r
- */\r
-public class FilterTreeLabelProvider implements ILabelProvider {\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)\r
- */\r
- @Override\r
- public void addListener(ILabelProviderListener listener) {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()\r
- */\r
- @Override\r
- public void dispose() {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)\r
- */\r
- @Override\r
- public boolean isLabelProperty(Object element, String property) {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)\r
- */\r
- @Override\r
- public void removeListener(ILabelProviderListener listener) {\r
- // TODO Auto-generated method stub\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)\r
- */\r
- @Override\r
- public Image getImage(Object element) {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- /*\r
- * (non-Javadoc)\r
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)\r
- */\r
- @Override\r
- public String getText(Object element) {\r
- String label = null;\r
-\r
- if (element instanceof TmfFilterNode) {\r
-\r
- TmfFilterNode node = (TmfFilterNode) element;\r
- label = node.getNodeName() + " " + node.getFilterName(); //$NON-NLS-1$\r
-\r
- } else if (element instanceof TmfFilterEventTypeNode) {\r
-\r
- TmfFilterEventTypeNode node = (TmfFilterEventTypeNode) element;\r
- label = "WITH " + node.getNodeName() + (node.getName() != null ? " " + node.getName() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-\r
- } else if (element instanceof TmfFilterAndNode) {\r
-\r
- TmfFilterAndNode node = (TmfFilterAndNode) element;\r
- label = (node.isNot() ? "NOT " : "") + node.getNodeName(); //$NON-NLS-1$ //$NON-NLS-2$\r
-\r
- } else if (element instanceof TmfFilterOrNode) {\r
-\r
- TmfFilterOrNode node = (TmfFilterOrNode) element;\r
- label = (node.isNot() ? "NOT " : "") + node.getNodeName(); //$NON-NLS-1$ //$NON-NLS-2$\r
-\r
- } else if (element instanceof TmfFilterContainsNode) {\r
-\r
- TmfFilterContainsNode node = (TmfFilterContainsNode) element;\r
- label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$\r
- (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$\r
- node.getNodeName() +\r
- (node.getValue() != null && node.getValue().length() > 0 ? " \"" + node.getValue() + "\"" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-\r
- } else if (element instanceof TmfFilterEqualsNode) {\r
-\r
- TmfFilterEqualsNode node = (TmfFilterEqualsNode) element;\r
- label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$\r
- (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$\r
- node.getNodeName() +\r
- (node.getValue() != null && node.getValue().length() > 0 ? " \"" + node.getValue() + "\"" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-\r
- } else if (element instanceof TmfFilterMatchesNode) {\r
-\r
- TmfFilterMatchesNode node = (TmfFilterMatchesNode) element;\r
- label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$\r
- (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$\r
- node.getNodeName() +\r
- (node.getRegex() != null && node.getRegex().length() > 0 ? " \"" + node.getRegex() + "\"" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
-\r
- } else if (element instanceof TmfFilterCompareNode) {\r
-\r
- TmfFilterCompareNode node = (TmfFilterCompareNode) element;\r
- label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$\r
- (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$\r
- (node.getResult() < 0 ? "<" : (node.getResult() > 0 ? ">" : "=")) + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\r
- (node.getValue() != null && node.getValue().length() > 0 ?\r
- (node.getType() == Type.ALPHA ? " \"" + node.getValue() + "\"" : //$NON-NLS-1$ //$NON-NLS-2$\r
- (node.getType() == Type.TIMESTAMP ? " [" + node.getValue() + "]" : //$NON-NLS-1$ //$NON-NLS-2$\r
- " " + node.getValue())) : ""); //$NON-NLS-1$//$NON-NLS-2$\r
-\r
- }\r
- return label;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Yuriy Vashchuk - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.views.filter;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterAndNode;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterCompareNode;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterCompareNode.Type;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterContainsNode;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterEqualsNode;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterEventTypeNode;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterMatchesNode;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterNode;
+import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterOrNode;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This is the Label Provider for our Filter Tree
+ *
+ * @version 1.0
+ * @author Yuriy Vashchuk
+ */
+public class FilterTreeLabelProvider implements ILabelProvider {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ */
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ String label = null;
+
+ if (element instanceof TmfFilterNode) {
+
+ TmfFilterNode node = (TmfFilterNode) element;
+ label = node.getNodeName() + " " + node.getFilterName(); //$NON-NLS-1$
+
+ } else if (element instanceof TmfFilterEventTypeNode) {
+
+ TmfFilterEventTypeNode node = (TmfFilterEventTypeNode) element;
+ label = "WITH " + node.getNodeName() + (node.getName() != null ? " " + node.getName() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ } else if (element instanceof TmfFilterAndNode) {
+
+ TmfFilterAndNode node = (TmfFilterAndNode) element;
+ label = (node.isNot() ? "NOT " : "") + node.getNodeName(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ } else if (element instanceof TmfFilterOrNode) {
+
+ TmfFilterOrNode node = (TmfFilterOrNode) element;
+ label = (node.isNot() ? "NOT " : "") + node.getNodeName(); //$NON-NLS-1$ //$NON-NLS-2$
+
+ } else if (element instanceof TmfFilterContainsNode) {
+
+ TmfFilterContainsNode node = (TmfFilterContainsNode) element;
+ label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ node.getNodeName() +
+ (node.getValue() != null && node.getValue().length() > 0 ? " \"" + node.getValue() + "\"" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ } else if (element instanceof TmfFilterEqualsNode) {
+
+ TmfFilterEqualsNode node = (TmfFilterEqualsNode) element;
+ label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ node.getNodeName() +
+ (node.getValue() != null && node.getValue().length() > 0 ? " \"" + node.getValue() + "\"" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ } else if (element instanceof TmfFilterMatchesNode) {
+
+ TmfFilterMatchesNode node = (TmfFilterMatchesNode) element;
+ label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ node.getNodeName() +
+ (node.getRegex() != null && node.getRegex().length() > 0 ? " \"" + node.getRegex() + "\"" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ } else if (element instanceof TmfFilterCompareNode) {
+
+ TmfFilterCompareNode node = (TmfFilterCompareNode) element;
+ label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$
+ (node.getResult() < 0 ? "<" : (node.getResult() > 0 ? ">" : "=")) + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ (node.getValue() != null && node.getValue().length() > 0 ?
+ (node.getType() == Type.ALPHA ? " \"" + node.getValue() + "\"" : //$NON-NLS-1$ //$NON-NLS-2$
+ (node.getType() == Type.TIMESTAMP ? " [" + node.getValue() + "]" : //$NON-NLS-1$ //$NON-NLS-2$
+ " " + node.getValue())) : ""); //$NON-NLS-1$//$NON-NLS-2$
+
+ }
+ return label;
+ }
+
+}