Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2011-11-23 08:27:24 +0000
committerUwe Stieber2011-11-23 08:27:24 +0000
commitda04cea420ccf86bc6edd0a21c0bd49d9a884528 (patch)
tree09cf5b74b25f0a322d29a83293cd8cd8e9f0da5f /target_explorer/plugins/org.eclipse.tcf.te.runtime.model
parent4b4ef663a2045fed330433d8cf74e6f115cfa1b5 (diff)
downloadorg.eclipse.tcf-da04cea420ccf86bc6edd0a21c0bd49d9a884528.tar.gz
org.eclipse.tcf-da04cea420ccf86bc6edd0a21c0bd49d9a884528.tar.xz
org.eclipse.tcf-da04cea420ccf86bc6edd0a21c0bd49d9a884528.zip
Target Explorer: Add isEmpty() to properties container and model nodes
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.runtime.model')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ContainerModelNode.java27
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ModelNode.java11
2 files changed, 21 insertions, 17 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ContainerModelNode.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ContainerModelNode.java
index b6d62466e..d9c21cc14 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ContainerModelNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ContainerModelNode.java
@@ -18,9 +18,9 @@ import java.util.concurrent.locks.ReentrantLock;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.tcf.te.runtime.events.EventManager;
import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.events.EventManager;
/**
* A common (data) model container node implementation.
@@ -212,7 +212,17 @@ public class ContainerModelNode extends ModelNode implements IContainerModelNode
*/
@Override
public int size() {
- return childList.size();
+ int size = 0;
+ try { childListLock.lock(); size = childList.size(); } finally { childListLock.unlock(); }
+ return size;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.properties.PropertiesContainer#isEmpty()
+ */
+ @Override
+ public boolean isEmpty() {
+ return super.isEmpty() && !hasChildren();
}
/* (non-Javadoc)
@@ -308,11 +318,16 @@ public class ContainerModelNode extends ModelNode implements IContainerModelNode
IModelNode find = super.find(uuid);
if (find != null) return find;
- for (IModelNode child : childList) {
- find = child.find(uuid);
- if (find != null) {
- return find;
+ try {
+ childListLock.lock();
+ for (IModelNode child : childList) {
+ find = child.find(uuid);
+ if (find != null) {
+ return find;
+ }
}
+ } finally {
+ childListLock.unlock();
}
return find;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ModelNode.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ModelNode.java
index db93a1c54..35ea1dfbd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ModelNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/ModelNode.java
@@ -137,17 +137,6 @@ public class ModelNode extends PropertiesContainer implements IModelNode, IModel
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.nodes.PropertiesContainer#getProperty(java.lang.String)
- */
- @Override
- public Object getProperty(String key) {
- if (PROPERTY_NAME.equals(key)) {
- return getName();
- }
- return super.getProperty(key);
- }
-
- /* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.interfaces.nodes.IModelNode#getDescription()
*/
@Override

Back to the top