Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2011-12-26 05:46:14 -0500
committerUwe Stieber2011-12-26 05:47:03 -0500
commitd2d9c47b965acf3c6af8e3ff484f9817f197a9a1 (patch)
tree02084c5a49083dd07df603164c961e99bd092f23
parent7df63aad1e7b25c140d9701d03da3bca4c4af570 (diff)
downloadorg.eclipse.tcf-d2d9c47b965acf3c6af8e3ff484f9817f197a9a1.tar.gz
org.eclipse.tcf-d2d9c47b965acf3c6af8e3ff484f9817f197a9a1.tar.xz
org.eclipse.tcf-d2d9c47b965acf3c6af8e3ff484f9817f197a9a1.zip
Target Explorer: Added reset redirection command handler and clean up content provisioning with redirections set
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/MyPropertyTester.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelRefreshService.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/icons/ovr16/redirect_ovr.gifbin832 -> 0 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml63
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/RedirectPeersFilter.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RedirectHandler.java111
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ResetRedirectHandler.java132
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProviderDelegate.java73
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/LabelProviderDelegate.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/nodes/PeerRedirectorGroupNode.java48
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tables/NodePropertiesLabelProvider.java4
20 files changed, 444 insertions, 117 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
index 2f7918d5f..525a72695 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/plugin.xml
@@ -14,7 +14,7 @@
class="org.eclipse.tcf.te.tcf.locator.internal.MyPropertyTester"
id="org.eclipse.tcf.te.tcf.locator.LocatorModelPropertyTester"
namespace="org.eclipse.tcf.te.tcf.locator"
- properties="name,hasLocalService,hasRemoteService,isStaticPeer"
+ properties="name,hasLocalService,hasRemoteService,isStaticPeer,isRedirected"
type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
</propertyTester>
</extension>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/MyPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/MyPropertyTester.java
index eacbb86a7..64303f894 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/MyPropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/internal/MyPropertyTester.java
@@ -14,6 +14,7 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector;
@@ -87,6 +88,11 @@ public class MyPropertyTester extends PropertyTester {
if (expectedValue instanceof Boolean) return ((Boolean)expectedValue).booleanValue() == isStaticPeer;
}
+ if ("isRedirected".equals(property)) { //$NON-NLS-1$
+ boolean isRedirected = node.getPeer() instanceof PeerRedirector;
+ if (expectedValue instanceof Boolean) return ((Boolean)expectedValue).booleanValue() == isRedirected;
+ }
+
return false;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelRefreshService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelRefreshService.java
index 1385fb1ba..cd66e8680 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelRefreshService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/LocatorModelRefreshService.java
@@ -278,6 +278,24 @@ public class LocatorModelRefreshService extends AbstractLocatorModelService impl
// Process the read peers
if (!peers.isEmpty()) processPeers(peers, oldChildren, model);
+
+ // Scan the peers for redirected ones ... and set up the peer model association
+ for (String peerId : peers.keySet()) {
+ IPeer peer = peers.get(peerId);
+ if (!(peer instanceof PeerRedirector)) continue;
+
+ // Get the peers peer model object
+ IPeerModel peerModel = model.getService(ILocatorModelLookupService.class).lkupPeerModelById(peerId);
+ Assert.isNotNull(peerModel);
+
+ // The peer is a peer redirector -> get the proxy peer id and proxy peer model
+ String proxyPeerId = ((PeerRedirector)peer).getParent().getID();
+ IPeerModel proxy = model.getService(ILocatorModelLookupService.class).lkupPeerModelById(proxyPeerId);
+ Assert.isNotNull(proxy);
+
+ peerModel.setParentNode(proxy);
+ model.getService(ILocatorModelUpdateService.class).addChild(peerModel);
+ }
}
}
@@ -292,8 +310,8 @@ public class LocatorModelRefreshService extends AbstractLocatorModelService impl
// Check on the peers root locations preference setting
String roots = Platform.getPreferencesService().getString(CoreBundleActivator.getUniqueIdentifier(),
- IPreferenceKeys.PREF_STATIC_PEERS_ROOT_LOCATIONS,
- null, null);
+ IPreferenceKeys.PREF_STATIC_PEERS_ROOT_LOCATIONS,
+ null, null);
// If set, split it in its single components
if (roots != null) {
String[] candidates = roots.split(File.pathSeparator);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF
index 2ae663906..446cd70bd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/META-INF/MANIFEST.MF
@@ -35,6 +35,7 @@ Export-Package: org.eclipse.tcf.te.tcf.ui.activator;x-internal:=true,
org.eclipse.tcf.te.tcf.ui.internal;x-internal:=true,
org.eclipse.tcf.te.tcf.ui.navigator,
org.eclipse.tcf.te.tcf.ui.navigator.images,
+ org.eclipse.tcf.te.tcf.ui.navigator.nodes,
org.eclipse.tcf.te.tcf.ui.nls,
org.eclipse.tcf.te.tcf.ui.preferences,
org.eclipse.tcf.te.tcf.ui.tables,
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/icons/ovr16/redirect_ovr.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/icons/ovr16/redirect_ovr.gif
deleted file mode 100644
index 24c52d1e1..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/icons/ovr16/redirect_ovr.gif
+++ /dev/null
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
index a19184ab0..8d06aa8d6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
@@ -14,6 +14,7 @@ providerName = Eclipse.org
# ***** Filter *****
UnreachablePeersFilter.name=Unreachable Peers
+RedirectPeersFilter.name=Redirected Peers (Root Level)
# ***** Wizards *****
@@ -42,3 +43,7 @@ command.delete.tooltip=Delete
command.redirect.name=Redirect Command
command.redirect.label=Re&direct...
command.redirect.tooltip=Redirect communication to this peer through a proxy
+
+command.resetredirect.name=Reset Redirect Command
+command.resetredirect.label=Re&set Redirect
+command.resetredirect.tooltip=Reset communication redirection of this peer
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
index dad73523f..7cd29371c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
@@ -23,7 +23,10 @@
name="Dynamic Target Discovery"
priority="normal">
<enablement>
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <or>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <instanceof value="org.eclipse.tcf.te.tcf.ui.navigator.nodes.PeerRedirectorGroupNode"/>
+ </or>
</enablement>
<commonSorter
class="org.eclipse.tcf.te.ui.trees.TreeViewerSorter"
@@ -43,6 +46,13 @@
name="%UnreachablePeersFilter.name"
visibleInUI="true">
</commonFilter>
+ <commonFilter
+ activeByDefault="true"
+ class="org.eclipse.tcf.te.tcf.ui.filter.RedirectPeersFilter"
+ id="org.eclipse.tcf.te.tcf.ui.navigator.RedirectPeersFilter"
+ name="%RedirectPeersFilter.name"
+ visibleInUI="false">
+ </commonFilter>
</extension>
<!-- New target wizard contributions -->
@@ -164,7 +174,26 @@
</with>
</visibleWhen>
</command>
- <separator name="operationsGroupMarker" visible="true"/>
+
+ <command
+ commandId="org.eclipse.tcf.te.tcf.ui.command.resetredirect"
+ helpContextId="org.eclipse.tcf.te.tcf.ui.command_ResetRedirect"
+ id="org.eclipse.tcf.te.tcf.ui.commands.resetredirect"
+ label="%command.resetredirect.label"
+ style="push"
+ tooltip="%command.resetredirect.tooltip">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <count value="+"/>
+ <iterate operator="and" ifEmpty="false">
+ <and>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.isStaticPeer" value="true"/>
+ </and>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
</menuContribution>
</extension>
@@ -182,6 +211,12 @@
id="org.eclipse.tcf.te.tcf.ui.command.redirect"
name="%command.redirect.name">
</command>
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.tcf.ui.command_ResetRedirect"
+ id="org.eclipse.tcf.te.tcf.ui.command.resetredirect"
+ name="%command.resetredirect.name">
+ </command>
</extension>
<!-- Handler contributions -->
@@ -212,7 +247,29 @@
<with variable="selection">
<count value="1"/>
<iterate operator="and" ifEmpty="false">
- <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <and>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.isRedirected" value="false"/>
+ </and>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+
+ <handler
+ class="org.eclipse.tcf.te.tcf.ui.handler.ResetRedirectHandler"
+ commandId="org.eclipse.tcf.te.tcf.ui.command.resetredirect">
+ <activeWhen>
+ <reference definitionId="te.expressions.tcf.peerModel.handlerActivation"/>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <and>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.isRedirected" value="true"/>
+ </and>
</iterate>
</with>
</enabledWhen>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java
index 59b229ef5..0c0879b5e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/activator/UIPlugin.java
@@ -112,8 +112,6 @@ public class UIPlugin extends AbstractUIPlugin {
registry.put(ImageConsts.RED_OVR, ImageDescriptor.createFromURL(url));
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OVR + "redX_ovr.gif"); //$NON-NLS-1$
registry.put(ImageConsts.RED_X_OVR, ImageDescriptor.createFromURL(url));
- url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OVR + "redirect_ovr.gif"); //$NON-NLS-1$
- registry.put(ImageConsts.REDIRECT_OVR, ImageDescriptor.createFromURL(url));
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_DTOOL + "run_exc.gif"); //$NON-NLS-1$
registry.put(ImageConsts.RUN_DISABLED, ImageDescriptor.createFromURL(url));
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/RedirectPeersFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/RedirectPeersFilter.java
new file mode 100644
index 000000000..61d162a97
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/filter/RedirectPeersFilter.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.ui.filter;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.ui.views.interfaces.IRoot;
+
+/**
+ * Filter implementation filtering redirected peers from the root level.
+ */
+public class RedirectPeersFilter extends ViewerFilter {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
+ if (element instanceof IPeerModel && parentElement instanceof IRoot) {
+ final AtomicReference<IPeerModel> parent = new AtomicReference<IPeerModel>();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ parent.set(((IPeerModel)element).getParentNode());
+ }
+ };
+ Assert.isTrue(!Protocol.isDispatchThread());
+ Protocol.invokeAndWait(runnable);
+
+ return parent.get() == null;
+ }
+
+ return true;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RedirectHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RedirectHandler.java
index b203bf26c..0bc7c1514 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RedirectHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RedirectHandler.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
@@ -39,13 +40,17 @@ import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstan
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService;
import org.eclipse.tcf.te.tcf.locator.model.Model;
import org.eclipse.tcf.te.tcf.locator.nodes.PeerRedirector;
import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.ui.dialogs.RedirectAgentSelectionDialog;
import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.swt.DisplayUtil;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.navigator.CommonNavigator;
/**
* Redirect peer command handler implementation.
@@ -56,7 +61,7 @@ public class RedirectHandler extends AbstractHandler {
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
// Determine the peer selected in Target Explorer tree
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
@@ -100,44 +105,18 @@ public class RedirectHandler extends AbstractHandler {
Protocol.invokeLater(new Runnable() {
@Override
public void run() {
- // Get the peer attributes
- Map<String, String> attributes = new HashMap<String, String>();
- attributes.putAll(peerModel.getPeer().getAttributes());
- // Set the redirection
- attributes.put(IPeerModelProperties.PROP_REDIRECT_PROXY, proxy.getPeerId());
-
- try {
- IPersistenceService persistenceService = ServiceManager.getInstance().getService(IPersistenceService.class);
- if (persistenceService == null) throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$
- persistenceService.write(attributes);
-
- // Create a peer redirector
- PeerRedirector redirector = new PeerRedirector(proxy.getPeer(), attributes);
- // And update the instance
- peerModel.setProperty(IPeerModelProperties.PROP_INSTANCE, redirector);
-
- // Trigger a refresh of the locator model in a later dispatch cycle
- Protocol.invokeLater(new Runnable() {
- @Override
- public void run() {
- Model.getModel().getService(ILocatorModelRefreshService.class).refresh();
+ redirect(peerModel, proxy);
+
+ DisplayUtil.safeAsyncExec(new Runnable() {
+ @Override
+ public void run() {
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ if (part instanceof CommonNavigator) {
+ CommonNavigator navigator = (CommonNavigator)part;
+ navigator.selectReveal(new StructuredSelection(peerModel));
}
- });
- } catch (IOException e) {
- // Create the status
- IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- Messages.RedirectHandler_error_deleteFailed, e);
-
- // Fill in the status handler custom data
- IPropertiesContainer data = new PropertiesContainer();
- data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.RedirectHandler_error_title);
- data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_DELETE_FAILED);
- data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
-
- // Get the status handler
- IStatusHandler[] handler = StatusHandlerManager.getInstance().getHandler(peerModel);
- if (handler.length > 0) handler[0].handleStatus(status, data, null);
- }
+ }
+ });
}
});
}
@@ -150,4 +129,60 @@ public class RedirectHandler extends AbstractHandler {
return null;
}
+ /**
+ * Redirect the communication to the given peer through the given proxy.
+ * <p>
+ * The method must be called from within the TCF dispatch thread.
+ *
+ * @param peerModel The peer to redirect. Must not be <code>null</code>.
+ * @param proxy The proxy. Must not be <code>null</code>
+ */
+ public void redirect(IPeerModel peerModel, IPeerModel proxy) {
+ Assert.isNotNull(peerModel);
+ Assert.isNotNull(proxy);
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+
+ // Get the peer attributes
+ Map<String, String> attributes = new HashMap<String, String>();
+ attributes.putAll(peerModel.getPeer().getAttributes());
+ // Set the redirection
+ attributes.put(IPeerModelProperties.PROP_REDIRECT_PROXY, proxy.getPeerId());
+
+ try {
+ IPersistenceService persistenceService = ServiceManager.getInstance().getService(IPersistenceService.class);
+ if (persistenceService == null) throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$
+ persistenceService.write(attributes);
+
+ // Create a peer redirector
+ PeerRedirector redirector = new PeerRedirector(proxy.getPeer(), attributes);
+ // And update the instance
+ peerModel.setProperty(IPeerModelProperties.PROP_INSTANCE, redirector);
+
+ // Associate proxy (parent) and peer model (child)
+ peerModel.setParentNode(proxy);
+ Model.getModel().getService(ILocatorModelUpdateService.class).addChild(peerModel);
+
+ // Trigger a refresh of the locator model in a later dispatch cycle
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ Model.getModel().getService(ILocatorModelRefreshService.class).refresh();
+ }
+ });
+ } catch (IOException e) {
+ // Create the status
+ IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
+ Messages.RedirectHandler_error_redirectFailed, e);
+
+ // Fill in the status handler custom data
+ IPropertiesContainer data = new PropertiesContainer();
+ data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.RedirectHandler_error_title);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_REDIRECT_FAILED);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
+
+ // Get the status handler
+ IStatusHandler[] handler = StatusHandlerManager.getInstance().getHandler(peerModel);
+ if (handler.length > 0) handler[0].handleStatus(status, data, null);
+ }
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ResetRedirectHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ResetRedirectHandler.java
new file mode 100644
index 000000000..f81ef4ef6
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/ResetRedirectHandler.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.ui.handler;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tcf.core.TransientPeer;
+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.runtime.persistence.interfaces.IPersistenceService;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.statushandler.StatusHandlerManager;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelUpdateService;
+import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Reset peer redirection command handler.
+ */
+public class ResetRedirectHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ // Determine the peer selected in Target Explorer tree
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ // Redirect is supporting single selection only
+ Object candidate = ((IStructuredSelection)selection).getFirstElement();
+ if (candidate instanceof IPeerModel) {
+ final IPeerModel peerModel = (IPeerModel)candidate;
+
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ resetRedirect(peerModel);
+ }
+ });
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Reset the communication redirection for the given peer.
+ * <p>
+ * The method must be called from within the TCF dispatch thread.
+ *
+ * @param peerModel The peer to reset. Must not be <code>null</code>.
+ */
+ public void resetRedirect(IPeerModel peerModel) {
+ Assert.isNotNull(peerModel);
+ Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+
+ // Get the peer attributes
+ Map<String, String> attributes = new HashMap<String, String>();
+ attributes.putAll(peerModel.getPeer().getAttributes());
+ // Redirection set?
+ if (attributes.get(IPeerModelProperties.PROP_REDIRECT_PROXY) != null) {
+ // Remove the redirection
+ attributes.remove(IPeerModelProperties.PROP_REDIRECT_PROXY);
+
+ try {
+ // Save it
+ IPersistenceService persistenceService = ServiceManager.getInstance().getService(IPersistenceService.class);
+ if (persistenceService == null) throw new IOException("Persistence service instance unavailable."); //$NON-NLS-1$
+ persistenceService.write(attributes);
+
+ // Create a peer
+ IPeer peer = new TransientPeer(attributes);
+ // And update the instance
+ peerModel.setProperty(IPeerModelProperties.PROP_INSTANCE, peer);
+
+ // Reset proxy (parent) and peer model (child) association
+ Model.getModel().getService(ILocatorModelUpdateService.class).removeChild(peerModel);
+ peerModel.setParentNode(null);
+
+ // Trigger a refresh of the locator model in a later dispatch cycle
+ Protocol.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ Model.getModel().getService(ILocatorModelRefreshService.class).refresh();
+ }
+ });
+ } catch (IOException e) {
+ // Create the status
+ IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
+ Messages.ResetRedirectHandler_error_resetRedirectFailed, e);
+
+ // Fill in the status handler custom data
+ IPropertiesContainer data = new PropertiesContainer();
+ data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.ResetRedirectHandler_error_title);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_RESET_REDIRECT_FAILED);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
+
+ // Get the status handler
+ IStatusHandler[] handler = StatusHandlerManager.getInstance().getHandler(peerModel);
+ if (handler.length > 0) handler[0].handleStatus(status, data, null);
+ }
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java
index f73c0b440..b38a4437b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java
@@ -53,4 +53,9 @@ public interface IContextHelpIds {
* Redirect command handler: Redirect operation failed.
*/
public final static String MESSAGE_REDIRECT_FAILED = PREFIX + ".status.messageRedirectFailed"; //$NON-NLS-1$
+
+ /**
+ * Reset redirect command handler: Reset redirect operation failed.
+ */
+ public final static String MESSAGE_RESET_REDIRECT_FAILED = PREFIX + ".status.messageResetRedirectFailed"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java
index 5a705b4e9..67f8c4c8a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/ImageConsts.java
@@ -96,11 +96,6 @@ public interface ImageConsts {
public static final String RED_X_OVR = "RedXOverlay"; //$NON-NLS-1$
/**
- * The key to access the peer object redirect overlay image.
- */
- public static final String REDIRECT_OVR = "RedirectOverlay"; //$NON-NLS-1$
-
- /**
* The key to access the base run action image.
*/
public static final String RUN_ENABLED = "RunEnabled"; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProviderDelegate.java
index cf6d8f98b..24ccdb348 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProviderDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/ContentProviderDelegate.java
@@ -12,8 +12,8 @@ package org.eclipse.tcf.te.tcf.ui.navigator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.tcf.protocol.IPeer;
@@ -25,6 +25,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerRedirector;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelRefreshService;
import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.ui.navigator.nodes.PeerRedirectorGroupNode;
import org.eclipse.tcf.te.ui.views.interfaces.IRoot;
import org.eclipse.ui.navigator.CommonViewer;
@@ -38,43 +39,8 @@ public class ContentProviderDelegate implements ITreeContentProvider {
// The locator model listener instance
/* default */ IModelListener modelListener = null;
- /**
- * Internal helper class representing the root node of remotely
- * discovered peers.
- */
- protected static class RemotePeerDiscoveryRootNode {
- final String peerId;
-
- /**
- * Constructor.
- */
- public RemotePeerDiscoveryRootNode(String peerId) {
- Assert.isNotNull(peerId);
- this.peerId = peerId;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof RemotePeerDiscoveryRootNode) {
- return peerId.equals(((RemotePeerDiscoveryRootNode)obj).peerId);
- }
- return super.equals(obj);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return peerId.hashCode();
- }
- }
-
// Internal map of RemotePeerDiscoverRootNodes per peer id
- private final Map<String, RemotePeerDiscoveryRootNode> roots = new HashMap<String, RemotePeerDiscoveryRootNode>();
+ private final Map<String, PeerRedirectorGroupNode> roots = new HashMap<String, PeerRedirectorGroupNode>();
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
@@ -97,9 +63,9 @@ public class ContentProviderDelegate implements ITreeContentProvider {
String parentPeerId = ((IPeerModel)parentElement).getPeerId();
List<IPeerModel> candidates = Model.getModel().getChildren(parentPeerId);
if (candidates != null && candidates.size() > 0) {
- RemotePeerDiscoveryRootNode rootNode = roots.get(parentPeerId);
+ PeerRedirectorGroupNode rootNode = roots.get(parentPeerId);
if (rootNode == null) {
- rootNode = new RemotePeerDiscoveryRootNode(parentPeerId);
+ rootNode = new PeerRedirectorGroupNode(parentPeerId);
roots.put(parentPeerId, rootNode);
}
children = new Object[] { rootNode };
@@ -109,8 +75,8 @@ public class ContentProviderDelegate implements ITreeContentProvider {
}
// If it is a remote peer discover root node, return the children
// for the associated peer id.
- else if (parentElement instanceof RemotePeerDiscoveryRootNode) {
- List<IPeerModel> candidates = Model.getModel().getChildren(((RemotePeerDiscoveryRootNode)parentElement).peerId);
+ else if (parentElement instanceof PeerRedirectorGroupNode) {
+ List<IPeerModel> candidates = Model.getModel().getChildren(((PeerRedirectorGroupNode)parentElement).peerId);
if (candidates != null && candidates.size() > 0) {
children = candidates.toArray();
}
@@ -123,18 +89,29 @@ public class ContentProviderDelegate implements ITreeContentProvider {
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
*/
@Override
- public Object getParent(Object element) {
+ public Object getParent(final Object element) {
// If it is a peer model node, return the parent locator model
if (element instanceof IPeerModel) {
// If it is a peer redirector, return the parent remote peer discover root node
if (((IPeerModel)element).getPeer() instanceof IPeerRedirector) {
IPeer parentPeer = ((IPeerRedirector)((IPeerModel)element).getPeer()).getParent();
- return roots.get(parentPeer.getID());
+ String parentPeerId = parentPeer.getID();
+ if (!roots.containsKey(parentPeerId)) roots.put(parentPeer.getID(), new PeerRedirectorGroupNode(parentPeerId));
+ return roots.get(parentPeerId);
}
- return ((IPeerModel)element).getModel();
- } else if (element instanceof RemotePeerDiscoveryRootNode) {
+ } else if (element instanceof PeerRedirectorGroupNode) {
// Return the parent peer model node
- return Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(((RemotePeerDiscoveryRootNode)element).peerId);
+ final AtomicReference<IPeerModel> parent = new AtomicReference<IPeerModel>();
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ parent.set(Model.getModel().getService(ILocatorModelLookupService.class).lkupPeerModelById(((PeerRedirectorGroupNode)element).peerId));
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+
+ return parent.get();
}
return null;
}
@@ -153,8 +130,8 @@ public class ContentProviderDelegate implements ITreeContentProvider {
List<IPeerModel> children = Model.getModel().getChildren(((IPeerModel)element).getPeerId());
hasChildren = children != null && children.size() > 0;
}
- else if (element instanceof RemotePeerDiscoveryRootNode) {
- List<IPeerModel> children = Model.getModel().getChildren(((RemotePeerDiscoveryRootNode)element).peerId);
+ else if (element instanceof PeerRedirectorGroupNode) {
+ List<IPeerModel> children = Model.getModel().getChildren(((PeerRedirectorGroupNode)element).peerId);
hasChildren = children != null && children.size() > 0;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/LabelProviderDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/LabelProviderDelegate.java
index 8f1933ba7..d265b5fe6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/LabelProviderDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/LabelProviderDelegate.java
@@ -18,8 +18,8 @@ import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
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.ContentProviderDelegate.RemotePeerDiscoveryRootNode;
import org.eclipse.tcf.te.tcf.ui.navigator.images.PeerImageDescriptor;
+import org.eclipse.tcf.te.tcf.ui.navigator.nodes.PeerRedirectorGroupNode;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
@@ -54,7 +54,7 @@ public class LabelProviderDelegate extends LabelProvider implements ILabelDecora
if (label != null && !"".equals(label.trim())) { //$NON-NLS-1$
return label;
}
- } else if (element instanceof RemotePeerDiscoveryRootNode) {
+ } else if (element instanceof PeerRedirectorGroupNode) {
return Messages.RemotePeerDiscoveryRootNode_label;
}
@@ -69,7 +69,7 @@ public class LabelProviderDelegate extends LabelProvider implements ILabelDecora
if (element instanceof IPeerModel) {
return UIPlugin.getImage(ImageConsts.PEER);
}
- if (element instanceof RemotePeerDiscoveryRootNode) {
+ if (element instanceof PeerRedirectorGroupNode) {
return UIPlugin.getImage(ImageConsts.DISCOVERY_ROOT);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java
index 2344ff791..5d5908702 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java
@@ -31,7 +31,6 @@ public class PeerImageDescriptor extends AbstractImageDescriptor {
// Flags representing the object states to decorate
private int state;
- private boolean redirected;
/**
* Constructor.
@@ -68,10 +67,6 @@ public class PeerImageDescriptor extends AbstractImageDescriptor {
Assert.isTrue(Protocol.isDispatchThread());
state = node.getIntProperty(IPeerModelProperties.PROP_STATE);
-
- String value = node.getPeer().getAttributes().get("static.transient"); //$NON-NLS-1$
- boolean isStaticPeer = value != null && Boolean.parseBoolean(value.trim());
- redirected = isStaticPeer ? node.getPeer().getAttributes().get(IPeerModelProperties.PROP_REDIRECT_PROXY) != null : false;
}
/**
@@ -82,8 +77,7 @@ public class PeerImageDescriptor extends AbstractImageDescriptor {
protected void defineKey(int hashCode) {
String key = "PMID:" + //$NON-NLS-1$
hashCode + ":" + //$NON-NLS-1$
- state + ":" + //$NON-NLS-1$
- redirected;
+ state;
setDecriptorKey(key);
}
@@ -104,10 +98,6 @@ public class PeerImageDescriptor extends AbstractImageDescriptor {
else if (state == IPeerModelProperties.STATE_ERROR) { /* not connected, error */
drawBottomRight(ImageConsts.RED_X_OVR);
}
-
- if (redirected) {
- drawTopRight(ImageConsts.REDIRECT_OVR);
- }
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/nodes/PeerRedirectorGroupNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/nodes/PeerRedirectorGroupNode.java
new file mode 100644
index 000000000..b096f9dbb
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/nodes/PeerRedirectorGroupNode.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.ui.navigator.nodes;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * A node grouping discovered child peers of a proxy peer.
+ * <p>
+ * Instances of this class are immutable.
+ */
+public class PeerRedirectorGroupNode {
+ public final String peerId;
+
+ /**
+ * Constructor.
+ */
+ public PeerRedirectorGroupNode(String peerId) {
+ Assert.isNotNull(peerId);
+ this.peerId = peerId;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof PeerRedirectorGroupNode) {
+ return peerId.equals(((PeerRedirectorGroupNode)obj).peerId);
+ }
+ return super.equals(obj);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return peerId.hashCode();
+ }
+} \ No newline at end of file
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 e13c8e637..9e03bce04 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
@@ -83,6 +83,8 @@ public class Messages extends NLS {
public static String NodePropertiesLabelProvider_services_local;
public static String NodePropertiesLabelProvider_services_remote;
+ public static String NodePropertiesLabelProvider_redirect_proxy;
+
public static String NewTargetWizard_windowTitle;
public static String NewTargetWizard_error_savePeer;
@@ -137,12 +139,15 @@ public class Messages extends NLS {
public static String AgentSelectionDialog_message;
public static String RedirectHandler_error_title;
- public static String RedirectHandler_error_deleteFailed;
+ public static String RedirectHandler_error_redirectFailed;
public static String RedirectAgentSelectionDialog_dialogTitle;
public static String RedirectAgentSelectionDialog_title;
public static String RedirectAgentSelectionDialog_message;
+ public static String ResetRedirectHandler_error_title;
+ public static String ResetRedirectHandler_error_resetRedirectFailed;
+
public static String LoggingPreferencePage_label;
public static String LoggingPreferencePage_enabled_label;
public static String LoggingPreferencePage_monitorEnabled_label;
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 de76fd794..0cfce4514 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
@@ -17,6 +17,8 @@ NodePropertiesLabelProvider_lastScannerError=Communication failed. Possible caus
NodePropertiesLabelProvider_services_local=Local Services
NodePropertiesLabelProvider_services_remote=Remote Services
+NodePropertiesLabelProvider_redirect_proxy=Redirected via
+
NewTargetWizard_windowTitle=New Peer
NewTargetWizard_error_savePeer=Failed to save peer: {0}
@@ -25,7 +27,7 @@ NewTargetWizardPage_description=Define the properties of the new peer.
NewTargetWizardPage_section_transportType=Specify the transport type and properties:
NewTargetWizardPage_section_attributes=Specify additional peer attributes:
-RemotePeerDiscoveryRootNode_label=Remote Peers
+RemotePeerDiscoveryRootNode_label=Peers Discovered
PeerIdControl_label=Peer ID:
PeerNameControl_label=Peer Name:
@@ -71,12 +73,15 @@ AgentSelectionDialog_title=Select Agent(s)
AgentSelectionDialog_message=Select the agent(s) for the operation to perform.
RedirectHandler_error_title=Error
-RedirectHandler_error_deleteFailed=Failed to redirect peer communication.
+RedirectHandler_error_redirectFailed=Failed to redirect peer communication.
RedirectAgentSelectionDialog_dialogTitle=Redirect
RedirectAgentSelectionDialog_title=Select Proxy
RedirectAgentSelectionDialog_message=Select the proxy to redirect the communication through.
+ResetRedirectHandler_error_title=Error
+ResetRedirectHandler_error_resetRedirectFailed=Failed to reset peer communication redirect.
+
# ***** Preference Pages *****
LoggingPreferencePage_label=Logging settings for agent communication:
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tables/NodePropertiesLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tables/NodePropertiesLabelProvider.java
index 6441efc99..54b6e1482 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tables/NodePropertiesLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/tables/NodePropertiesLabelProvider.java
@@ -17,8 +17,8 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.tables.properties.NodePropertiesTableTableNode;
@@ -76,6 +76,8 @@ public class NodePropertiesLabelProvider extends LabelProvider implements ITable
label = Messages.NodePropertiesLabelProvider_services_local;
} else if (IPeerModelProperties.PROP_REMOTE_SERVICES.equals(label)) {
label = Messages.NodePropertiesLabelProvider_services_remote;
+ } else if (IPeerModelProperties.PROP_REDIRECT_PROXY.equals(label)) {
+ label = Messages.NodePropertiesLabelProvider_redirect_proxy;
} else if (columnIndex == 1 && IPeerModelProperties.PROP_STATE.equals(((NodePropertiesTableTableNode)element).name)) {
label = Messages.getString("NodePropertiesLabelProvider_state_" + label.replace('-', '_')); //$NON-NLS-1$
}

Back to the top