Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-06-13 04:58:16 -0400
committerUwe Stieber2013-06-13 04:58:16 -0400
commit442a2c185e22c34b4d1d81a58fca716fd79b8346 (patch)
treed6de76d8a09ebc985a1c71d94b52bc47831642f1 /target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core
parentddb494b3ef3a182a643af2d09a016374da31d386 (diff)
downloadorg.eclipse.tcf-442a2c185e22c34b4d1d81a58fca716fd79b8346.tar.gz
org.eclipse.tcf-442a2c185e22c34b4d1d81a58fca716fd79b8346.tar.xz
org.eclipse.tcf-442a2c185e22c34b4d1d81a58fca716fd79b8346.zip
Target Explorer: Disable attach action if property "CanAttach" is set to false
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, 22 insertions, 1 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 fe752833b..f9fddd657 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
@@ -31,7 +31,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"
+ properties="isAttached,canAttach,hasProcessContext"
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 88b4503b2..1419b2367 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
@@ -47,6 +47,27 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
Runnable runnable = new Runnable() {
@Override
public void run() {
+ if (node.getProcessContext() != null) {
+ if (node.getProcessContext().getProperties().containsKey("CanAttach")) { //$NON-NLS-1$
+ Boolean value = (Boolean)node.getProcessContext().getProperties().get("CanAttach"); //$NON-NLS-1$
+ canAttach.set(value != null && value.booleanValue());
+ } else {
+ canAttach.set(true);
+ }
+ }
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return ((Boolean) expectedValue).booleanValue() == canAttach.get();
+ }
+
+ if ("hasProcessContext".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
+ final AtomicBoolean canAttach = new AtomicBoolean();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
canAttach.set(node.getProcessContext() != null);
}
};

Back to the top