Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2014-11-20 03:48:17 -0500
committerTobias Schwarz2014-11-20 03:48:17 -0500
commitccf4486ca1ae034508226605517d59ee29c921a8 (patch)
tree40d64ccdd93d5672338a3c80f90bdf863ede511b
parentc085de15965dfd4e3246be3ce652642acd753e7b (diff)
downloadorg.eclipse.tcf-ccf4486ca1ae034508226605517d59ee29c921a8.tar.gz
org.eclipse.tcf-ccf4486ca1ae034508226605517d59ee29c921a8.tar.xz
org.eclipse.tcf-ccf4486ca1ae034508226605517d59ee29c921a8.zip
SM: add peer node error and warnings handling and decoration
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java80
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/delegates/NodePropertiesTableUIDelegate.java25
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java36
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java20
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerNodeImageDescriptor.java19
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties1
13 files changed, 243 insertions, 22 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java
index 219663d8b..fa6780b14 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java
@@ -38,12 +38,22 @@ public interface IPeerNodeProperties {
public static final String PROPERTY_REMOTE_SERVICES = "RemoteServices"; //$NON-NLS-1$
/**
- * Property: Peer ID of selected real target.
+ * Property: Peer ID.
*/
public static final String PROPERTY_PEER_ID = "PeerId"; //$NON-NLS-1$
/**
- * Property: The peer valid state. This is not a property itself, just used to fire change events on valid state change.
+ * Property: The peer node valid state. This is not a property itself, just used to fire change events on valid state change.
*/
public static final String PROPERTY_IS_VALID = "isValid"; //$NON-NLS-1$
+
+ /**
+ * Property: Error if peer node is not valid (String)
+ */
+ public static final String PROPERTY_ERROR = "Error"; //$NON-NLS-1$
+
+ /**
+ * Property: Container for warnings (Map<String,String)
+ */
+ public static final String PROPERTY_WARNINGS = "Warnings"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java
index dec6a1696..0a6649324 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/nodes/PeerNode.java
@@ -364,6 +364,9 @@ public class PeerNode extends ContainerModelNode implements IPeerNode, IPeerNode
@Override
public void run() {
result.set(setProperty(IPeerNodeProperties.PROPERTY_CONNECT_STATE, newState));
+ if (newState != IConnectable.STATE_CONNECTED) {
+ setProperty(IPeerNodeProperties.PROPERTY_WARNINGS, null);
+ }
}
});
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java
index 4e6924f10..293c65257 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java
@@ -11,12 +11,17 @@ package org.eclipse.tcf.te.tcf.locator.utils;
import java.io.IOException;
import java.net.ServerSocket;
+import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.tcf.core.interfaces.IPeerProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
/**
* Common utils
@@ -99,4 +104,79 @@ public final class CommonUtils {
return port;
}
+
+ public static boolean setPeerError(final IPeerNode peerNode, final String error) {
+ final AtomicBoolean changed = new AtomicBoolean();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ changed.set(peerNode.setProperty(IPeerNodeProperties.PROPERTY_ERROR, error));
+ }
+ });
+ return changed.get();
+ }
+
+ public static String getPeerError(final IPeerNode peerNode) {
+ final AtomicReference<String> error = new AtomicReference<String>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ error.set(peerNode.getStringProperty(IPeerNodeProperties.PROPERTY_ERROR));
+ }
+ });
+
+ if (error.get() != null && error.get().trim().length() > 0) {
+ return error.get();
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Map<String,String> getPeerWarnings(final IPeerNode peerNode) {
+ final AtomicReference<Object> warnings = new AtomicReference<Object>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ warnings.set(peerNode.getProperty(IPeerNodeProperties.PROPERTY_WARNINGS));
+ }
+ });
+
+ if (warnings.get() != null && warnings.get() instanceof Map<?,?>) {
+ return (Map<String,String>)warnings.get();
+ }
+ return null;
+ }
+
+ public static boolean setPeerWarning(final IPeerNode peerNode, final String key, final String value) {
+ final AtomicBoolean changed = new AtomicBoolean();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ @SuppressWarnings("unchecked")
+ Map<String,String> warnings = (Map<String,String>)peerNode.getProperty(IPeerNodeProperties.PROPERTY_WARNINGS);
+ if (warnings == null) {
+ if (value == null) {
+ return;
+ }
+ warnings = new HashMap<String,String>();
+ }
+ if (value != null) {
+ changed.set(!value.equals(warnings.get(key)));
+ warnings.put(key, value);
+ }
+ else {
+ changed.set(warnings.get(key) != null);
+ warnings.remove(key);
+ if (warnings.isEmpty()) {
+ warnings = null;
+ }
+ }
+ peerNode.setChangeEventsEnabled(false);
+ peerNode.setProperty(IPeerNodeProperties.PROPERTY_WARNINGS, warnings);
+ peerNode.setChangeEventsEnabled(true);
+ }
+ });
+ peerNode.fireChangeEvent(IPeerNodeProperties.PROPERTY_WARNINGS, null, null);
+ return changed.get();
+ }
}
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 1afc97e10..12e8e5130 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
@@ -705,12 +705,22 @@
class="org.eclipse.tcf.te.tcf.processes.ui.handler.RefreshHandler"
commandId="org.eclipse.tcf.te.ui.command.refresh">
<activeWhen>
- <with variable="activePartId">
- <or>
- <equals value="org.eclipse.tcf.te.ui.views.View"/>
- <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
- </or>
- </with>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <or>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.runtime.IRuntimeModel"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </or>
+ </iterate>
+ </with>
+ </and>
</activeWhen>
<enabledWhen>
<with variable="selection">
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/delegates/NodePropertiesTableUIDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/delegates/NodePropertiesTableUIDelegate.java
index 26851eb2d..84869e58c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/delegates/NodePropertiesTableUIDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/delegates/NodePropertiesTableUIDelegate.java
@@ -55,7 +55,26 @@ public class NodePropertiesTableUIDelegate implements INodePropertiesTableUIDele
*/
@Override
public void expandNodesAfterSort(Object context, List<NodePropertiesTableTableNode> sortedNodes) {
- String[] keysToExpand = new String[]{IPeerProperties.PROP_SIM_PROPERTIES, IPeerProperties.PROP_MODE_PROPERTIES};
+ String[] keysToExpand = new String[]{IPeerNodeProperties.PROPERTY_WARNINGS};
+ for (String key : keysToExpand) {
+ int i = sortedNodes.indexOf(new NodePropertiesTableTableNode(key, "")); //$NON-NLS-1$
+ if (i >= 0) {
+ NodePropertiesTableTableNode node = sortedNodes.get(i);
+ IPropertiesContainer data = DataHelper.decodePropertiesContainer(node.value);
+ if (data != null && !data.isEmpty()) {
+ sortedNodes.remove(i);
+ boolean firstDone = false;
+ for (Entry<String,Object> entry : data.getProperties().entrySet()) {
+ if (entry.getValue() != null) {
+ sortedNodes.add(i++, new NodePropertiesTableTableNode(firstDone ? "" : key, entry.getValue().toString())); //$NON-NLS-1$
+ firstDone = true;
+ }
+ }
+ }
+ }
+ }
+
+ keysToExpand = new String[]{IPeerProperties.PROP_SIM_PROPERTIES, IPeerProperties.PROP_MODE_PROPERTIES};
for (String key : keysToExpand) {
int i = sortedNodes.indexOf(new NodePropertiesTableTableNode(key, "")); //$NON-NLS-1$
if (i >= 0) {
@@ -66,9 +85,7 @@ public class NodePropertiesTableUIDelegate implements INodePropertiesTableUIDele
sortedNodes.add(i++, new NodePropertiesTableTableNode(key, "")); //$NON-NLS-1$
for (Entry<String,Object> entry : data.getProperties().entrySet()) {
if (entry.getValue() != null) {
- if (!isFiltered(context, entry.getKey(), entry.getValue())) {
- sortedNodes.add(i++, new NodePropertiesTableTableNode(" " + entry.getKey(), entry.getValue().toString())); //$NON-NLS-1$
- }
+ sortedNodes.add(i++, new NodePropertiesTableTableNode(" " + entry.getKey(), entry.getValue().toString())); //$NON-NLS-1$
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java
index 69beb2970..677609daa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/AbstractConfigurationEditorPage.java
@@ -66,7 +66,8 @@ public abstract class AbstractConfigurationEditorPage extends AbstractCustomForm
public void eventFired(EventObject event) {
ChangeEvent changeEvent = (ChangeEvent)event;
if ((IPeerNodeProperties.PROPERTY_CONNECT_STATE.equals(changeEvent.getEventId()) ||
- IPeerNodeProperties.PROPERTY_IS_VALID.equals(changeEvent.getEventId())) &&
+ IPeerNodeProperties.PROPERTY_IS_VALID.equals(changeEvent.getEventId()) ||
+ IPeerNodeProperties.PROPERTY_WARNINGS.equals(changeEvent.getEventId())) &&
event.getSource() == getEditorInputNode()) {
ExecutorsUtil.executeInUI(new Runnable() {
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java
index 2284cb234..b537f4077 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/editor/OverviewEditorPage.java
@@ -75,7 +75,8 @@ public class OverviewEditorPage extends AbstractCustomFormToolkitEditorPage {
public void eventFired(EventObject event) {
ChangeEvent changeEvent = (ChangeEvent)event;
if ((IPeerNodeProperties.PROPERTY_CONNECT_STATE.equals(changeEvent.getEventId()) ||
- IPeerNodeProperties.PROPERTY_IS_VALID.equals(changeEvent.getEventId())) &&
+ IPeerNodeProperties.PROPERTY_IS_VALID.equals(changeEvent.getEventId()) ||
+ IPeerNodeProperties.PROPERTY_WARNINGS.equals(changeEvent.getEventId())) &&
event.getSource() == getEditorInputNode()) {
ExecutorsUtil.executeInUI(new Runnable() {
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java
index 5818e01bf..6c348c11c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java
@@ -14,6 +14,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.EventObject;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.Platform;
@@ -39,6 +40,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.tcf.te.core.interfaces.IConnectable;
import org.eclipse.tcf.te.runtime.concurrent.util.ExecutorsUtil;
import org.eclipse.tcf.te.runtime.events.ChangeEvent;
import org.eclipse.tcf.te.runtime.events.EventManager;
@@ -50,6 +52,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IDefaultContextService;
import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
+import org.eclipse.tcf.te.tcf.locator.utils.CommonUtils;
import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
import org.eclipse.tcf.te.tcf.ui.internal.preferences.IPreferenceKeys;
@@ -250,9 +253,35 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
}
text.setText(name);
- image.setToolTipText(!fullName.equals(name) ? fullName : Messages.DefaultContextSelectorToolbarContribution_tooltip_button);
- text.setToolTipText(!fullName.equals(name) ? fullName : Messages.DefaultContextSelectorToolbarContribution_tooltip_button);
- button.setToolTipText(Messages.DefaultContextSelectorToolbarContribution_tooltip_button);
+ String tooltipMessage = Messages.DefaultContextSelectorToolbarContribution_tooltip_button;
+ String tooltip = !fullName.equals(name) ? fullName : tooltipMessage;
+ if (!peerNode.isValid()) {
+ String error = CommonUtils.getPeerError(peerNode);
+ tooltip = !fullName.equals(name) ? fullName+"\n" : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ if (error != null) {
+ tooltip += error;
+ }
+ else {
+ tooltip += Messages.PeerLabelProviderDelegate_description_invalid;
+ }
+ }
+ else if (peerNode.getConnectState() == IConnectable.STATE_CONNECTED) {
+ Map<String,String> warnings = CommonUtils.getPeerWarnings(peerNode);
+ if (warnings != null && !warnings.isEmpty()) {
+ tooltip = !fullName.equals(name) ? fullName : ""; //$NON-NLS-1$
+ for (String warning : warnings.values()) {
+ if (tooltip.trim().length() > 0) {
+ tooltip += "\n"; //$NON-NLS-1$
+ }
+ tooltip += warning;
+ }
+ }
+ }
+
+ image.setToolTipText(tooltip);
+ text.setToolTipText(tooltip);
+
+ button.setToolTipText(tooltipMessage);
}
else {
image.setImage(UIPlugin.getImage(ImageConsts.NEW_CONFIG));
@@ -388,6 +417,7 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
(changeEvent.getSource() == peerNode &&
(IPeerNodeProperties.PROPERTY_CONNECT_STATE.equals(changeEvent.getEventId()) ||
IPeerNodeProperties.PROPERTY_IS_VALID.equals(changeEvent.getEventId()) ||
+ IPeerNodeProperties.PROPERTY_WARNINGS.equals(changeEvent.getEventId()) ||
"properties".equals(changeEvent.getEventId())))) { //$NON-NLS-1$
if (menuMgr != null) menuMgr.markDirty();
ExecutorsUtil.executeInUI(new Runnable() {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java
index b65711d27..95afabcb8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/tabbed/PeerNodePropertiesSectionContentProvider.java
@@ -29,10 +29,14 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.core.interfaces.IConnectable;
import org.eclipse.tcf.te.core.utils.ConnectStateHelper;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.persistence.utils.DataHelper;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
import org.eclipse.tcf.te.runtime.services.ServiceManager;
import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProperties;
+import org.eclipse.tcf.te.tcf.locator.utils.CommonUtils;
import org.eclipse.tcf.te.ui.interfaces.services.INodePropertiesTableUIDelegate;
import org.eclipse.tcf.te.ui.tables.properties.NodePropertiesTableTableNode;
import org.eclipse.tcf.te.ui.views.extensions.LabelProviderDelegateExtensionPointManager;
@@ -83,6 +87,16 @@ public class PeerNodePropertiesSectionContentProvider implements IStructuredCont
IPeerNode peerNode = (IPeerNode)inputElement;
properties.putAll(peerNode.getPeer().getAttributes());
properties.put(IPeerNodeProperties.PROPERTY_CONNECT_STATE, ConnectStateHelper.getConnectState(peerNode.getConnectState()));
+ String error = CommonUtils.getPeerError(peerNode);
+ if (error != null) {
+ properties.put(IPeerNodeProperties.PROPERTY_ERROR, error);
+ }
+ Map<String,String> warnings = CommonUtils.getPeerWarnings(peerNode);
+ if (warnings != null && !warnings.isEmpty()) {
+ IPropertiesContainer container = new PropertiesContainer();
+ container.addProperties(warnings);
+ properties.put(IPeerNodeProperties.PROPERTY_WARNINGS, DataHelper.encodePropertiesContainer(container));
+ }
if (peerNode.getConnectState() == IConnectable.STATE_CONNECTED) {
properties.put(IPeerNodeProperties.PROPERTY_LOCAL_SERVICES, peerNode.getStringProperty(IPeerNodeProperties.PROPERTY_LOCAL_SERVICES));
properties.put(IPeerNodeProperties.PROPERTY_REMOTE_SERVICES, peerNode.getStringProperty(IPeerNodeProperties.PROPERTY_REMOTE_SERVICES));
@@ -144,7 +158,11 @@ public class PeerNodePropertiesSectionContentProvider implements IStructuredCont
nodes.clear();
for (Entry<String, Object> entry : debugProperties.entrySet()) {
String name = entry.getKey();
- if (!name.equals(IPeerNodeProperties.PROPERTY_CONNECT_STATE) && !name.equals(IPeerNodeProperties.PROPERTY_LOCAL_SERVICES) && !name.equals(IPeerNodeProperties.PROPERTY_REMOTE_SERVICES)) {
+ if (!name.equals(IPeerNodeProperties.PROPERTY_CONNECT_STATE) &&
+ !name.equals(IPeerNodeProperties.PROPERTY_ERROR) &&
+ !name.equals(IPeerNodeProperties.PROPERTY_WARNINGS) &&
+ !name.equals(IPeerNodeProperties.PROPERTY_LOCAL_SERVICES) &&
+ !name.equals(IPeerNodeProperties.PROPERTY_REMOTE_SERVICES)) {
nodes.add(new NodePropertiesTableTableNode(name, entry.getValue() != null ? entry.getValue().toString() : "")); //$NON-NLS-1$
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java
index ab1bcb5e1..9f67d8be7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/PeerLabelProviderDelegate.java
@@ -29,6 +29,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IPeerModelLookupService;
import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
+import org.eclipse.tcf.te.tcf.locator.utils.CommonUtils;
import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
import org.eclipse.tcf.te.tcf.ui.navigator.images.PeerNodeImageDescriptor;
@@ -36,11 +37,12 @@ import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.controls.interfaces.ISimulatorServiceUIDelegate;
import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
import org.eclipse.tcf.te.ui.tables.properties.NodePropertiesTableTableNode;
+import org.eclipse.ui.navigator.IDescriptionProvider;
/**
* Label provider implementation.
*/
-public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDecorator, ILabelProviderDelegate {
+public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDecorator, ILabelProviderDelegate, IDescriptionProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
@@ -140,7 +142,39 @@ public class PeerLabelProviderDelegate extends LabelProvider implements ILabelDe
return null;
}
- /**
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object)
+ */
+ @Override
+ public String getDescription(Object element) {
+ if (element instanceof IPeerNode) {
+ IPeerNode peerNode = (IPeerNode)element;
+
+ if (!peerNode.isValid()) {
+ String error = CommonUtils.getPeerError(peerNode);
+ if (error != null) {
+ return error;
+ }
+ return Messages.PeerLabelProviderDelegate_description_invalid;
+ }
+
+ Map<String,String> warnings = CommonUtils.getPeerWarnings(peerNode);
+ if (warnings != null && !warnings.isEmpty()) {
+ String desc = ""; //$NON-NLS-1$
+ for (String warning : warnings.values()) {
+ if (desc.trim().length() > 0) {
+ desc += "; "; //$NON-NLS-1$
+ }
+ desc += warning.replaceAll("\n", "").replaceAll("\t", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ return desc;
+ }
+ }
+ return null;
+ }
+
+ /**
* Determines if the IP-address and port needs to be appended
* to the given label.
* <p>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerNodeImageDescriptor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerNodeImageDescriptor.java
index 8c10a6ace..d95b237fd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerNodeImageDescriptor.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerNodeImageDescriptor.java
@@ -9,12 +9,15 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.ui.navigator.images;
+import java.util.Map;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.tcf.te.core.interfaces.IConnectable;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode;
+import org.eclipse.tcf.te.tcf.locator.utils.CommonUtils;
import org.eclipse.tcf.te.tcf.ui.internal.ImageConsts;
import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
@@ -34,6 +37,9 @@ public class PeerNodeImageDescriptor extends AbstractImageDescriptor {
// Flags representing the valid state to decorate
private boolean valid;
+ // Flags representing the warning state to decorate
+ private boolean warning;
+
/**
* Constructor.
@@ -63,6 +69,9 @@ public class PeerNodeImageDescriptor extends AbstractImageDescriptor {
// deadlock if the initialize(...) where called as a result of an activity
// state change event.
valid = node.isValid();
+
+ Map<String,String> warnings = CommonUtils.getPeerWarnings(node);
+ warning = warnings != null && !warnings.isEmpty();
}
/**
@@ -74,7 +83,8 @@ public class PeerNodeImageDescriptor extends AbstractImageDescriptor {
String key = "PNID:" + //$NON-NLS-1$
hashCode + ":" + //$NON-NLS-1$
connectState + ":" + //$NON-NLS-1$
- valid;
+ valid + ":" + //$NON-NLS-1$
+ warning;
setDecriptorKey(key);
}
@@ -95,7 +105,12 @@ public class PeerNodeImageDescriptor extends AbstractImageDescriptor {
}
if (connectState == IConnectable.STATE_CONNECTED) {
- drawBottomRight(ImageConsts.GREEN_OVR);
+ if (warning) {
+ drawBottomRight(ImageConsts.GOLD_OVR);
+ }
+ else {
+ drawBottomRight(ImageConsts.GREEN_OVR);
+ }
}
else if (connectState == IConnectable.STATE_CONNECTING || connectState == IConnectable.STATE_DISCONNECTING ||
connectState == IConnectable.STATE_CONNECTION_LOST || connectState == IConnectable.STATE_CONNECTION_RECOVERING) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
index 7e25d9679..68da3ba0f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
@@ -294,4 +294,5 @@ public class Messages extends NLS {
public static String PeerLabelProviderDelegate_NodePropertiesTable_SubType_real;
public static String PeerLabelProviderDelegate_NodePropertiesTable_SubType_sim;
public static String PeerLabelProviderDelegate_NodePropertiesTable_Port_0;
+ public static String PeerLabelProviderDelegate_description_invalid;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
index db5f18ce7..ed330fb83 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
@@ -236,3 +236,4 @@ PeerLabelProviderDelegate_NodePropertiesTable_Mode_stop=Stop Mode
PeerLabelProviderDelegate_NodePropertiesTable_SubType_real=Running Target
PeerLabelProviderDelegate_NodePropertiesTable_SubType_sim=Simulator/Virtual Platform
PeerLabelProviderDelegate_NodePropertiesTable_Port_0=<auto>
+PeerLabelProviderDelegate_description_invalid=Connection not valid, open connection details for further information. \ No newline at end of file

Back to the top