Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-11-24 04:52:50 -0500
committerUwe Stieber2012-11-24 04:52:50 -0500
commit61c46ab31d6c8de42348c9b91cc46bf0df657bf0 (patch)
treee606901e9f0f5ad961da1abcb0e409b631982e17
parent3986b8ce15734d5e249d278bbeb9dbe9f8a26c1b (diff)
downloadorg.eclipse.tcf-61c46ab31d6c8de42348c9b91cc46bf0df657bf0.tar.gz
org.eclipse.tcf-61c46ab31d6c8de42348c9b91cc46bf0df657bf0.tar.xz
org.eclipse.tcf-61c46ab31d6c8de42348c9b91cc46bf0df657bf0.zip
Target Explorer: Added IPeerModel.isRemote()
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModel.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nodes/InvalidPeerModel.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerModel.java16
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java4
7 files changed, 43 insertions, 14 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModel.java
index 45c4e408c..45b88afce 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModel.java
@@ -69,8 +69,19 @@ public interface IPeerModel extends IContainerModelNode {
/**
* Returns if or if not the peer model node represents a static peer.
+ * <p>
+ * <b>Note:</b> A peer model node can be both static and remote at the same time.
*
- * @return <code>True</code> if it represents a static peer, <code>false</code> otherwise.
+ * @return <code>True</code> if the node represents a static peer, <code>false</code> otherwise.
*/
public boolean isStatic();
+
+ /**
+ * Returns if or if not the peer model node represents a remote/discovered peer.
+ * <p>
+ * <b>Note:</b> A peer model node can be both static and remote at the same time.
+ *
+ * @return <code>True</code> if the node represents a remote peer, <code>false</code> otherwise.
+ */
+ public boolean isRemote();
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nodes/InvalidPeerModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nodes/InvalidPeerModel.java
index e727c4357..431592035 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nodes/InvalidPeerModel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/nodes/InvalidPeerModel.java
@@ -513,6 +513,14 @@ public final class InvalidPeerModel implements IPeerModel {
}
/* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel#isRemote()
+ */
+ @Override
+ public boolean isRemote() {
+ throw new IllegalStateException();
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer#addProperties(java.util.Map)
*/
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerModel.java
index 4da2c0b31..e5715be63 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerModel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerModel.java
@@ -170,6 +170,22 @@ public class PeerModel extends ContainerModelNode implements IPeerModel {
}
/* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel#isRemote()
+ */
+ @Override
+ public boolean isRemote() {
+ Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$
+
+ // Determine the "remote" flag
+ String value = getPeer().getAttributes().get("remote.transient"); //$NON-NLS-1$
+ boolean isRemote = value != null ? Boolean.parseBoolean(value) : false;
+
+ // The peer model node is considered to be remote if it is a remote peer
+ // or the "remote" flag is set.
+ return "RemotePeer".equals(getPeer().getClass().getSimpleName()) || isRemote; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
*/
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java
index f0b6ecec2..96f6f292c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelPeerNodeQueryService.java
@@ -71,9 +71,9 @@ public class LocatorModelPeerNodeQueryService extends AbstractLocatorModelServic
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- // If the peer is a RemotePeer or has the "remote.transient" property set
+ // If the peer is a remote peer
// --> an agent is running and has been associated with the peer model.
- if ("RemotePeer".equals(node.getPeer().getClass().getSimpleName()) || Boolean.valueOf(node.getPeer().getAttributes().get("remote.transient")).booleanValue()) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (node.isRemote()) {
queryServicesAsync(node, new DoneQueryServices() {
@Override
public void doneQueryServices(Throwable error) {
@@ -137,9 +137,9 @@ public class LocatorModelPeerNodeQueryService extends AbstractLocatorModelServic
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- // If the peer is a RemotePeer or has the "remote.transient" property set
+ // If the peer is a remote peer
// --> an agent is running and has been associated with the peer model.
- if ("RemotePeer".equals(node.getPeer().getClass().getSimpleName()) || Boolean.valueOf(node.getPeer().getAttributes().get("remote.transient")).booleanValue()) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (node.isRemote()) {
queryServicesAsync(node, new DoneQueryServices() {
@Override
public void doneQueryServices(Throwable error) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java
index c9e14ce33..7ed0d0627 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/AttributesSection.java
@@ -372,9 +372,7 @@ public class AttributesSection extends AbstractSection {
public void run() {
if (input instanceof IPeerModel) {
isStatic.set(((IPeerModel)input).isStatic());
-
- String value = ((IPeerModel)input).getPeer().getAttributes().get("remote.transient"); //$NON-NLS-1$
- isRemote.set(value != null && Boolean.parseBoolean(value.trim()));
+ isRemote.set(((IPeerModel)input).isRemote());
}
}
};
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
index 850e0e165..ba2d1007f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/GeneralInformationSection.java
@@ -440,9 +440,7 @@ public class GeneralInformationSection extends AbstractSection {
public void run() {
if (input instanceof IPeerModel) {
isStatic.set(((IPeerModel)input).isStatic());
-
- String value = ((IPeerModel)input).getPeer().getAttributes().get("remote.transient"); //$NON-NLS-1$
- isRemote.set(value != null && Boolean.parseBoolean(value.trim()));
+ isRemote.set(((IPeerModel)input).isRemote());
}
}
};
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
index d3bf8a81d..f5e1dd5c6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/sections/TransportSection.java
@@ -446,9 +446,7 @@ public class TransportSection extends AbstractSection {
public void run() {
if (input instanceof IPeerModel) {
isStatic.set(((IPeerModel)input).isStatic());
-
- String value = ((IPeerModel)input).getPeer().getAttributes().get("remote.transient"); //$NON-NLS-1$
- isRemote.set(value != null && Boolean.parseBoolean(value.trim()));
+ isRemote.set(((IPeerModel)input).isRemote());
}
}
};

Back to the top