Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-09-26 08:45:16 -0400
committerTobias Schwarz2013-09-26 08:48:49 -0400
commite127a75a3f1ae649e40a1e5afd41e6b29e1e13ac (patch)
tree3e26ddbe2035a931d66ffd6bf41ac1a03eca6b15 /target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core
parent69c0e3941c8c363eb6f7ddf676cd47db3012ac63 (diff)
downloadorg.eclipse.tcf-e127a75a3f1ae649e40a1e5afd41e6b29e1e13ac.tar.gz
org.eclipse.tcf-e127a75a3f1ae649e40a1e5afd41e6b29e1e13ac.tar.xz
org.eclipse.tcf-e127a75a3f1ae649e40a1e5afd41e6b29e1e13ac.zip
Traget Explorer: add property tester "hasCapability"
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java21
2 files changed, 21 insertions, 2 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml
index d7914f7bd..14a717bee 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml
@@ -34,7 +34,7 @@
class="org.eclipse.tcf.te.tcf.processes.core.model.properties.PropertyTester"
id="org.eclipse.tcf.te.tcf.processes.core.model.properties"
namespace="org.eclipse.tcf.te.tcf.processes.core"
- properties="isAttached,canAttach,hasProcessContext,canTerminate"
+ properties="isAttached,canAttach,hasProcessContext,canTerminate,hasCapability"
type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode">
</propertyTester>
</extension>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java
index cebb0b3a3..a16793d56 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java
@@ -9,10 +9,12 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.processes.core.model.properties;
+import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNodeProperties;
/**
* The property tester for a process tree node.
@@ -23,7 +25,7 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
*/
@Override
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ public boolean test(Object receiver, String property, Object[] args, final Object expectedValue) {
if (receiver instanceof IProcessContextNode) {
final IProcessContextNode node = (IProcessContextNode) receiver;
if ("isAttached".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
@@ -92,6 +94,23 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
return ((Boolean) expectedValue).booleanValue() == canTerminate.get();
}
+
+ if ("hasCapability".equals(property) && expectedValue instanceof String) { //$NON-NLS-1$
+ final AtomicBoolean hasCapability = new AtomicBoolean();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ Map<String, Object> caps = (Map<String, Object>)node.getProperty(IProcessContextNodeProperties.PROPERTY_CAPABILITIES);
+ if (caps != null) {
+ hasCapability.set(caps.containsKey(expectedValue) && Boolean.parseBoolean(caps.get(expectedValue).toString()));
+ }
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return hasCapability.get();
+ }
}
return false;
}

Back to the top