Fix for bug334572
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / TracePropertyTester.java
1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.ui;
14
15 import org.eclipse.core.expressions.PropertyTester;
16 import org.eclipse.linuxtools.tmf.ui.project.model.TmfExperimentElement;
17 import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
18
19 /**
20 * <b><u>TracePropertyTester</u></b>
21 * <p>
22 */
23 public class TracePropertyTester extends PropertyTester {
24
25 // ------------------------------------------------------------------------
26 // Constants
27 // ------------------------------------------------------------------------
28
29 private static String isExperimentTrace = "isExperimentTrace"; //$NON-NLS-1$
30
31 // ------------------------------------------------------------------------
32 // Constructor
33 // ------------------------------------------------------------------------
34
35 /**
36 * Default constructor
37 */
38 public TracePropertyTester() {
39 }
40
41 // ------------------------------------------------------------------------
42 // IPropertyTester
43 // ------------------------------------------------------------------------
44
45 /* (non-Javadoc)
46 * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
47 */
48 @Override
49 public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
50
51 // Check if the parent of a trace element is an experiment
52 if (receiver != null && receiver instanceof TmfTraceElement) {
53 TmfTraceElement trace = (TmfTraceElement) receiver;
54 if (isExperimentTrace.equals(property)) {
55 return trace.getParent() instanceof TmfExperimentElement;
56 }
57 }
58
59 return false;
60 }
61
62 }
This page took 0.03214 seconds and 5 git commands to generate.