Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-06-02 04:42:12 -0400
committerUwe Stieber2013-06-02 04:42:12 -0400
commit041774ced1bf2f5770502905f3950272ba415d5a (patch)
tree727d9e5c513c2a7bb13d4d951b71c780df7538e6 /target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core
parentc0a5d7ac4101f3f89e256435f7abb840d54e3250 (diff)
downloadorg.eclipse.tcf-041774ced1bf2f5770502905f3950272ba415d5a.tar.gz
org.eclipse.tcf-041774ced1bf2f5770502905f3950272ba415d5a.tar.xz
org.eclipse.tcf-041774ced1bf2f5770502905f3950272ba415d5a.zip
Target Explorer: Fix attach action enabled while there is no process context to attach too
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/META-INF/MANIFEST.MF4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml11
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java61
3 files changed, 75 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
index d87a84bc5..acd2d1892 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@ Bundle-SymbolicName: org.eclipse.tcf.te.tcf.processes.core;singleton:=true
Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.tcf.te.tcf.processes.core.activator.CoreBundleActivator
Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
+Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
+ org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.tcf.core;bundle-version="1.1.0",
org.eclipse.tcf.te.core;bundle-version="1.1.0",
org.eclipse.tcf.te.runtime;bundle-version="1.1.0",
@@ -31,6 +32,7 @@ Export-Package: org.eclipse.tcf.te.tcf.processes.core.activator;x-internal:=true
org.eclipse.tcf.te.tcf.processes.core.model.internal.factory;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.core.model.internal.services;x-internal:=true,
org.eclipse.tcf.te.tcf.processes.core.model.nodes,
+ org.eclipse.tcf.te.tcf.processes.core.model.properties,
org.eclipse.tcf.te.tcf.processes.core.model.runtime,
org.eclipse.tcf.te.tcf.processes.core.model.runtime.listener,
org.eclipse.tcf.te.tcf.processes.core.model.runtime.services,
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 f1839a5de..fe752833b 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
@@ -25,6 +25,17 @@
</service>
</extension>
+<!-- Eclipse core expressions property tester -->
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ 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"
+ type="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode">
+ </propertyTester>
+ </extension>
+
<!-- Launch Step contributions -->
<extension point="org.eclipse.tcf.te.runtime.stepper.steps">
<step
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
new file mode 100644
index 000000000..88b4503b2
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/properties/PropertyTester.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.processes.core.model.properties;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+
+/**
+ * The property tester for a process tree node.
+ */
+public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
+
+ /* (non-Javadoc)
+ * @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) {
+ if (receiver instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode) receiver;
+ if ("isAttached".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
+ final AtomicBoolean isAttached = new AtomicBoolean();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ if (node.getProcessContext() != null) {
+ isAttached.set(node.getProcessContext().isAttached());
+ }
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return ((Boolean) expectedValue).booleanValue() == isAttached.get();
+ }
+
+ if ("canAttach".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);
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return ((Boolean) expectedValue).booleanValue() == canAttach.get();
+ }
+ }
+ return false;
+ }
+}

Back to the top