Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-02-23 02:26:31 -0500
committerWilliam Chen2012-02-23 02:26:31 -0500
commit4c241386867caaa80b65abfb5c4a64cf87b74dfd (patch)
tree998153c92a842500522f1d7eddad3e5655a457d6
parentcd340d15a8669d3c1b2d92e6053dfa926ebc9c44 (diff)
downloadorg.eclipse.tcf-4c241386867caaa80b65abfb5c4a64cf87b74dfd.tar.gz
org.eclipse.tcf-4c241386867caaa80b65abfb5c4a64cf87b74dfd.tar.xz
org.eclipse.tcf-4c241386867caaa80b65abfb5c4a64cf87b74dfd.zip
Target Explorer: Merge two process property testers.
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml27
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java20
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/PropertyTester.java47
3 files changed, 28 insertions, 66 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
index d5f3fbe7a..ac8974184 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
@@ -240,7 +240,7 @@
</instanceof>
<not>
<test
- property="org.eclipse.tcf.te.tcf.processes.ui.propertytester.process.isSystemRoot">
+ property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
</test>
</not>
</and>
@@ -270,7 +270,7 @@
</instanceof>
<not>
<test
- property="org.eclipse.tcf.te.tcf.processes.ui.propertytester.process.isSystemRoot">
+ property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
</test>
</not>
</and>
@@ -349,7 +349,7 @@
<count value="+"/>
<iterate operator="and" ifEmpty="false">
<adapt type="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
- <test property="org.eclipse.tcf.te.tcf.processes.model.isAttached" value="false"/>
+ <test property="org.eclipse.tcf.te.tcf.processes.ui.model.isAttached" value="false"/>
</adapt>
</iterate>
</with>
@@ -379,7 +379,7 @@
<count value="+"/>
<iterate operator="and" ifEmpty="false">
<adapt type="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
- <test property="org.eclipse.tcf.te.tcf.processes.model.isAttached" value="true"/>
+ <test property="org.eclipse.tcf.te.tcf.processes.ui.model.isAttached" value="true"/>
</adapt>
</iterate>
</with>
@@ -450,15 +450,6 @@
</extension>
<!-- Eclipse core expressions property tester -->
- <extension point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.tcf.te.tcf.processes.ui.model.PropertyTester"
- id="org.eclipse.tcf.te.tcf.processes.ui.model.PropertyTester"
- namespace="org.eclipse.tcf.te.tcf.processes.model"
- properties="isAttached"
- type="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
- </propertyTester>
- </extension>
<extension point="org.eclipse.tcf.te.ui.viewers">
<viewer
@@ -684,7 +675,7 @@
</instanceof>
<not>
<test
- property="org.eclipse.tcf.te.tcf.processes.ui.propertytester.process.isSystemRoot">
+ property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
</test>
</not>
</and>
@@ -701,7 +692,7 @@
</instanceof>
<not>
<test
- property="org.eclipse.tcf.te.tcf.processes.ui.propertytester.process.isSystemRoot">
+ property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
</test>
</not>
</and>
@@ -718,7 +709,7 @@
</instanceof>
<not>
<test
- property="org.eclipse.tcf.te.tcf.processes.ui.propertytester.process.isSystemRoot">
+ property="org.eclipse.tcf.te.tcf.processes.ui.model.isSystemRoot">
</test>
</not>
</and>
@@ -730,8 +721,8 @@
<propertyTester
class="org.eclipse.tcf.te.tcf.processes.ui.internal.testers.ProcessPropertyTester"
id="org.eclipse.tcf.te.tcf.processes.ui.propertytester.process"
- namespace="org.eclipse.tcf.te.tcf.processes.ui.propertytester.process"
- properties="isSystemRoot"
+ namespace="org.eclipse.tcf.te.tcf.processes.ui.model"
+ properties="isSystemRoot, isAttached"
type="org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode">
</propertyTester>
</extension>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java
index 8d954fccd..8ddb69258 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/testers/ProcessPropertyTester.java
@@ -9,7 +9,10 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.processes.ui.internal.testers;
+import java.util.concurrent.atomic.AtomicBoolean;
+
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.tcf.processes.ui.model.ProcessTreeNode;
/**
@@ -24,10 +27,25 @@ public class ProcessPropertyTester extends PropertyTester {
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if(receiver instanceof ProcessTreeNode) {
- ProcessTreeNode node = (ProcessTreeNode) receiver;
+ final ProcessTreeNode node = (ProcessTreeNode) receiver;
if(property.equals("isSystemRoot")) { //$NON-NLS-1$
return "ProcRootNode".equals(node.type); //$NON-NLS-1$
}
+ else 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.pContext != null) {
+ isAttached.set(node.pContext.isAttached());
+ }
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return ((Boolean)expectedValue).booleanValue() == isAttached.get();
+ }
}
return false;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/PropertyTester.java
deleted file mode 100644
index 5071f410f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/model/PropertyTester.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.ui.model;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.tcf.protocol.Protocol;
-
-/**
- * Processes service model property tester.
- */
-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(final Object receiver, String property, Object[] args, Object expectedValue) {
-
- if (receiver instanceof ProcessTreeNode) {
- if ("isAttached".equals(property) && expectedValue instanceof Boolean) { //$NON-NLS-1$
- final AtomicBoolean isAttached = new AtomicBoolean();
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- final ProcessTreeNode node = (ProcessTreeNode)receiver;
- if (node.pContext != null) {
- isAttached.set(node.pContext.isAttached());
- }
- }
- };
- if (Protocol.isDispatchThread()) runnable.run();
- else Protocol.invokeAndWait(runnable);
-
- return ((Boolean)expectedValue).booleanValue() == isAttached.get();
- }
- }
- return false;
- }
-}

Back to the top