ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / filter / FilterTreeLabelProvider.java
CommitLineData
be222f56 1/*******************************************************************************
11252342 2 * Copyright (c) 2010, 2013 Ericsson
be222f56
PT
3 *
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
8 *
9 * Contributors:
10 * Yuriy Vashchuk - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.tmf.ui.views.filter;
14
15import org.eclipse.jface.viewers.ILabelProvider;
16import org.eclipse.jface.viewers.ILabelProviderListener;
17import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterAndNode;
18import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterCompareNode;
19import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterCompareNode.Type;
20import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterContainsNode;
21import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterEqualsNode;
22import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterEventTypeNode;
23import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterMatchesNode;
24import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterNode;
25import org.eclipse.linuxtools.tmf.core.filter.model.TmfFilterOrNode;
26import org.eclipse.swt.graphics.Image;
27
28/**
29 * This is the Label Provider for our Filter Tree
30 *
31 * @version 1.0
32 * @author Yuriy Vashchuk
33 */
34public class FilterTreeLabelProvider implements ILabelProvider {
35
11252342 36 @Override
be222f56 37 public void addListener(ILabelProviderListener listener) {
11252342
AM
38 // TODO Auto-generated method stub
39 }
40
41 @Override
be222f56 42 public void dispose() {
11252342
AM
43 // TODO Auto-generated method stub
44 }
45
46 @Override
be222f56 47 public boolean isLabelProperty(Object element, String property) {
11252342
AM
48 // TODO Auto-generated method stub
49 return false;
50 }
51
52 @Override
be222f56 53 public void removeListener(ILabelProviderListener listener) {
11252342
AM
54 // TODO Auto-generated method stub
55 }
56
57 @Override
be222f56 58 public Image getImage(Object element) {
11252342
AM
59 // TODO Auto-generated method stub
60 return null;
61 }
62
63 @Override
be222f56 64 public String getText(Object element) {
11252342 65 String label = null;
be222f56 66
11252342 67 if (element instanceof TmfFilterNode) {
be222f56 68
11252342
AM
69 TmfFilterNode node = (TmfFilterNode) element;
70 label = node.getNodeName() + " " + node.getFilterName(); //$NON-NLS-1$
be222f56 71
11252342 72 } else if (element instanceof TmfFilterEventTypeNode) {
be222f56 73
11252342
AM
74 TmfFilterEventTypeNode node = (TmfFilterEventTypeNode) element;
75 label = "WITH " + node.getNodeName() + (node.getName() != null ? " " + node.getName() : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
be222f56 76
11252342 77 } else if (element instanceof TmfFilterAndNode) {
be222f56 78
11252342
AM
79 TmfFilterAndNode node = (TmfFilterAndNode) element;
80 label = (node.isNot() ? "NOT " : "") + node.getNodeName(); //$NON-NLS-1$ //$NON-NLS-2$
be222f56 81
11252342 82 } else if (element instanceof TmfFilterOrNode) {
be222f56 83
11252342
AM
84 TmfFilterOrNode node = (TmfFilterOrNode) element;
85 label = (node.isNot() ? "NOT " : "") + node.getNodeName(); //$NON-NLS-1$ //$NON-NLS-2$
be222f56 86
11252342 87 } else if (element instanceof TmfFilterContainsNode) {
be222f56 88
11252342
AM
89 TmfFilterContainsNode node = (TmfFilterContainsNode) element;
90 label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$
91 (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$
92 node.getNodeName() +
93 (node.getValue() != null && node.getValue().length() > 0 ? " \"" + node.getValue() + "\"" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
be222f56 94
11252342 95 } else if (element instanceof TmfFilterEqualsNode) {
be222f56 96
11252342
AM
97 TmfFilterEqualsNode node = (TmfFilterEqualsNode) element;
98 label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$
99 (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$
100 node.getNodeName() +
101 (node.getValue() != null && node.getValue().length() > 0 ? " \"" + node.getValue() + "\"" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
be222f56 102
11252342 103 } else if (element instanceof TmfFilterMatchesNode) {
be222f56 104
11252342
AM
105 TmfFilterMatchesNode node = (TmfFilterMatchesNode) element;
106 label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$
107 (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$
108 node.getNodeName() +
109 (node.getRegex() != null && node.getRegex().length() > 0 ? " \"" + node.getRegex() + "\"" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
be222f56 110
11252342 111 } else if (element instanceof TmfFilterCompareNode) {
be222f56 112
11252342
AM
113 TmfFilterCompareNode node = (TmfFilterCompareNode) element;
114 label = (node.isNot() ? "NOT " : "") + //$NON-NLS-1$ //$NON-NLS-2$
115 (node.getField() != null ? node.getField() + " " : "") + //$NON-NLS-1$ //$NON-NLS-2$
116 (node.getResult() < 0 ? "<" : (node.getResult() > 0 ? ">" : "=")) + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
117 (node.getValue() != null && node.getValue().length() > 0 ?
118 (node.getType() == Type.ALPHA ? " \"" + node.getValue() + "\"" : //$NON-NLS-1$ //$NON-NLS-2$
119 (node.getType() == Type.TIMESTAMP ? " [" + node.getValue() + "]" : //$NON-NLS-1$ //$NON-NLS-2$
120 " " + node.getValue())) : ""); //$NON-NLS-1$//$NON-NLS-2$
be222f56 121
11252342
AM
122 }
123 return label;
124 }
be222f56
PT
125
126}
This page took 0.053466 seconds and 5 git commands to generate.