Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/icons/ovr16/redirect_ovr.gifbin0 -> 832 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.xml56
-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/dialogs/AgentSelectionDialog.java36
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectAgentSelectionDialog.java71
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteCommandHandler.java)13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RedirectHandler.java153
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshCommandHandler.java)2
-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.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/navigator/images/PeerImageDescriptor.java9
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java11
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties11
14 files changed, 358 insertions, 31 deletions
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
new file mode 100644
index 000000000..24c52d1e1
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/icons/ovr16/redirect_ovr.gif
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 1c30e47ec..a19184ab0 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
@@ -31,7 +31,6 @@ NodePropertiesEditorPage.name=General
preference.page.name = Logging
# ***** Command Contributions *****
-command.category.name=Target Explorer Commands
command.refresh.name=Refresh Command
command.refresh.label=Re&fresh
@@ -39,3 +38,7 @@ command.refresh.tooltip=Refresh
command.delete.label=&Delete
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
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 fbd589be8..dad73523f 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
@@ -46,7 +46,6 @@
</extension>
<!-- New target wizard contributions -->
-
<extension point="org.eclipse.tcf.te.ui.newWizards">
<category
id="org.eclipse.tcf.te.tcf.ui.newWizards.category"
@@ -144,26 +143,51 @@
</visibleWhen>
</command>
</menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.TargetExplorer#Popup?after=group.redirect">
+ <command
+ commandId="org.eclipse.tcf.te.tcf.ui.command.redirect"
+ helpContextId="org.eclipse.tcf.te.tcf.ui.command_Redirect"
+ id="org.eclipse.tcf.te.tcf.ui.commands.redirect"
+ label="%command.redirect.label"
+ style="push"
+ tooltip="%command.redirect.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>
+ <separator name="operationsGroupMarker" visible="true"/>
+ </menuContribution>
</extension>
<!-- Command contributions -->
<extension point="org.eclipse.ui.commands">
- <category
- id="org.eclipse.tcf.te.tcf.ui.commands.category"
- name="%command.category.name">
- </category>
<command
- categoryId="org.eclipse.tcf.te.tcf.ui.commands.category"
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
helpContextId="org.eclipse.tcf.te.tcf.ui.command_Refresh"
id="org.eclipse.tcf.te.tcf.ui.command.refresh"
name="%command.refresh.name">
</command>
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.tcf.ui.command_Redirect"
+ id="org.eclipse.tcf.te.tcf.ui.command.redirect"
+ name="%command.redirect.name">
+ </command>
</extension>
<!-- Handler contributions -->
<extension point="org.eclipse.ui.handlers">
<handler
- class="org.eclipse.tcf.te.tcf.ui.handler.RefreshCommandHandler"
+ class="org.eclipse.tcf.te.tcf.ui.handler.RefreshHandler"
commandId="org.eclipse.tcf.te.tcf.ui.command.refresh">
<activeWhen>
<reference definitionId="te.expressions.tcf.peerModel.handlerActivation"/>
@@ -171,12 +195,28 @@
</handler>
<handler
- class="org.eclipse.tcf.te.tcf.ui.handler.DeleteCommandHandler"
+ class="org.eclipse.tcf.te.tcf.ui.handler.DeleteHandler"
commandId="org.eclipse.ui.edit.delete">
<activeWhen>
<reference definitionId="te.expressions.tcf.peerModel.handlerActivation"/>
</activeWhen>
</handler>
+
+ <handler
+ class="org.eclipse.tcf.te.tcf.ui.handler.RedirectHandler"
+ commandId="org.eclipse.tcf.te.tcf.ui.command.redirect">
+ <activeWhen>
+ <reference definitionId="te.expressions.tcf.peerModel.handlerActivation"/>
+ </activeWhen>
+ <enabledWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
</extension>
<!-- Reusable core expression fragments -->
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 0c0879b5e..59b229ef5 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,6 +112,8 @@ 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/dialogs/AgentSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java
index ef853a8fa..241a7b41e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AgentSelectionDialog.java
@@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -31,13 +32,13 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.tcf.protocol.Protocol;
-import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
-import org.eclipse.tcf.te.tcf.ui.navigator.LabelProviderDelegate;
-import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.ILocatorModelLookupService;
import org.eclipse.tcf.te.tcf.locator.model.Model;
+import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.ui.navigator.LabelProviderDelegate;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
@@ -83,6 +84,17 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog {
return true;
}
+ /**
+ * Returns whether the dialog shall support multi selection or not.
+ * <p>
+ * The default implementation returns <code>true</code>.
+ *
+ * @return <code>True</code> if multi selection is supported, <code>false</code> otherwise.
+ */
+ protected boolean supportsMultiSelection() {
+ return true;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@@ -95,7 +107,7 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog {
setDefaultMessage(getDefaultMessage(), IMessageProvider.NONE);
// Create the table viewer
- viewer = new TableViewer(top, SWT.MULTI | SWT.BORDER);
+ viewer = new TableViewer(top, (supportsMultiSelection() ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER);
// Configure the table
Table table = viewer.getTable();
@@ -122,6 +134,9 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog {
};
viewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, labelProvider));
+ // Subclasses may customize the viewer before setting the input
+ configureTableViewer(viewer);
+
// The content to show is static. Do the filtering manually so that
// we can disable the OK Button if the dialog would not show any content.
final ILocatorModelLookupService service = getModel().getService(ILocatorModelLookupService.class);
@@ -152,6 +167,19 @@ public class AgentSelectionDialog extends CustomTitleAreaDialog {
return buttonBar;
}
+
+ /**
+ * Configure the table viewer.
+ * <p>
+ * The default implementation does nothing. Subclasses may overwrite this
+ * method to customize the table viewer before the input gets set.
+ *
+ * @param viewer The table viewer. Must not be <code>null</code>.
+ */
+ protected void configureTableViewer(TableViewer viewer) {
+ Assert.isNotNull(viewer);
+ }
+
/**
* Returns the dialog title.
*
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectAgentSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectAgentSelectionDialog.java
new file mode 100644
index 000000000..6e0d0d12c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectAgentSelectionDialog.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.dialogs;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+
+
+/**
+ * Agent selection dialog implementation to choose the proxy to redirect the communication through.
+ */
+public class RedirectAgentSelectionDialog extends AgentSelectionDialog {
+
+ /**
+ * Constructor.
+ *
+ * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>.
+ */
+ public RedirectAgentSelectionDialog(String[] services) {
+ super(services);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param parent The parent shell used to view the dialog, or <code>null</code>.
+ * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>.
+ */
+ public RedirectAgentSelectionDialog(Shell parent, String[] services) {
+ super(parent, services);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.dialogs.AgentSelectionDialog#getDialogTitle()
+ */
+ @Override
+ protected String getDialogTitle() {
+ return Messages.RedirectAgentSelectionDialog_dialogTitle;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.dialogs.AgentSelectionDialog#getTitle()
+ */
+ @Override
+ protected String getTitle() {
+ return Messages.RedirectAgentSelectionDialog_title;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.dialogs.AgentSelectionDialog#getDefaultMessage()
+ */
+ @Override
+ protected String getDefaultMessage() {
+ return Messages.RedirectAgentSelectionDialog_message;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.ui.dialogs.AgentSelectionDialog#supportsMultiSelection()
+ */
+ @Override
+ protected boolean supportsMultiSelection() {
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java
index d364266aa..bc65d0e4c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteCommandHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DeleteHandler.java
@@ -20,9 +20,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.tcf.protocol.Protocol;
-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.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceService;
import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
@@ -34,12 +31,15 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.ILocatorModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
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.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;
/**
* TCF static peers delete command handler implementation.
*/
-public class DeleteCommandHandler extends AbstractHandler {
+public class DeleteHandler extends AbstractHandler {
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
@@ -59,13 +59,12 @@ public class DeleteCommandHandler extends AbstractHandler {
} catch (IOException e) {
// Create the status
IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
- Messages.DeleteCommandHandler_error_deleteFailed, e);
+ Messages.DeleteHandler_error_deleteFailed, e);
// Fill in the status handler custom data
IPropertiesContainer data = new PropertiesContainer();
- data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.DeleteCommandHandler_error_title);
+ data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, Messages.DeleteHandler_error_title);
data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, IContextHelpIds.MESSAGE_DELETE_FAILED);
- data.setProperty(IStatusHandlerConstants.PROPERTY_DONT_ASK_AGAIN_ID, IContextHelpIds.MESSAGE_DELETE_FAILED);
data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, this);
// Get the status handler
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
new file mode 100644
index 000000000..b203bf26c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RedirectHandler.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * 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.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+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.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+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.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.ui.handlers.HandlerUtil;
+
+/**
+ * Redirect peer command handler implementation.
+ */
+public class RedirectHandler 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;
+
+ // Create the agent selection dialog
+ RedirectAgentSelectionDialog dialog = new RedirectAgentSelectionDialog(HandlerUtil.getActiveShell(event), null) {
+ @Override
+ protected void configureTableViewer(TableViewer viewer) {
+ Assert.isNotNull(viewer);
+
+ List<ViewerFilter> filter = new ArrayList<ViewerFilter>();
+ if (viewer.getFilters() != null && viewer.getFilters().length > 0) {
+ filter.addAll(Arrays.asList(viewer.getFilters()));
+ }
+
+ filter.add(new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (peerModel.equals(element)) return false;
+ return true;
+ }
+ });
+
+ viewer.setFilters(filter.toArray(new ViewerFilter[filter.size()]));
+ }
+ };
+
+ // Open the dialog
+ if (dialog.open() == Window.OK) {
+ // Get the selected proxy from the dialog
+ selection = dialog.getSelection();
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ candidate = ((IStructuredSelection)selection).getFirstElement();
+ if (candidate instanceof IPeerModel) {
+ final IPeerModel proxy = (IPeerModel)candidate;
+
+ 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();
+ }
+ });
+ } 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);
+ }
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+
+
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshCommandHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java
index 3cc5155e7..f80bdb7be 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshCommandHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/RefreshHandler.java
@@ -28,7 +28,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
/**
* TCF refresh command handler.
*/
-public class RefreshCommandHandler extends AbstractHandler {
+public class RefreshHandler extends AbstractHandler {
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
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 0a85973a2..f73c0b440 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
@@ -48,4 +48,9 @@ public interface IContextHelpIds {
* Delete command handler: Delete operation failed.
*/
public final static String MESSAGE_DELETE_FAILED = PREFIX + ".status.messageDeleteFailed"; //$NON-NLS-1$
+
+ /**
+ * Redirect command handler: Redirect operation failed.
+ */
+ public final static String MESSAGE_REDIRECT_FAILED = PREFIX + ".status.messageRedirectFailed"; //$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 2d6ef5ca7..5a705b4e9 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
@@ -71,31 +71,36 @@ public interface ImageConsts {
public static final String DISCOVERY_ROOT = "RemotePeerDiscoverRootNodeObject"; //$NON-NLS-1$
/**
- * The key to access the target object gold overlay image.
+ * The key to access the peer object gold overlay image.
*/
public static final String GOLD_OVR = "GoldOverlay"; //$NON-NLS-1$
/**
- * The key to access the target object green overlay image.
+ * The key to access the peer object green overlay image.
*/
public static final String GREEN_OVR = "GreenOverlay"; //$NON-NLS-1$
/**
- * The key to access the target object grey overlay image.
+ * The key to access the peer object grey overlay image.
*/
public static final String GREY_OVR = "GreyOverlay"; //$NON-NLS-1$
/**
- * The key to access the target object red overlay image.
+ * The key to access the peer object red overlay image.
*/
public static final String RED_OVR = "RedOverlay"; //$NON-NLS-1$
/**
- * The key to access the target object red X overlay image.
+ * The key to access the peer object red X overlay image.
*/
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/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 d99905b67..863044d89 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,6 +31,7 @@ public class PeerImageDescriptor extends AbstractImageDescriptor {
// Flags representing the object states to decorate
private int state;
+ private boolean redirected;
/**
* Constructor.
@@ -67,12 +68,14 @@ public class PeerImageDescriptor extends AbstractImageDescriptor {
Assert.isTrue(Protocol.isDispatchThread());
state = node.getIntProperty(IPeerModelProperties.PROP_STATE);
+ redirected = node.getPeer().getAttributes().get(IPeerModelProperties.PROP_REDIRECT_PROXY) != null;
}
protected void defineKey(int hashCode) {
String key = "PMID:" + //$NON-NLS-1$
hashCode + ":" + //$NON-NLS-1$
- state;
+ state + ":" + //$NON-NLS-1$
+ redirected;
setDecriptorKey(key);
}
@@ -93,6 +96,10 @@ 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/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
index bfd912ee5..e13c8e637 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
@@ -129,13 +129,20 @@ public class Messages extends NLS {
public static String PeerAttributesTablePart_edit_title;
public static String PeerAttributesTablePart_edit_message;
- public static String DeleteCommandHandler_error_title;
- public static String DeleteCommandHandler_error_deleteFailed;
+ public static String DeleteHandler_error_title;
+ public static String DeleteHandler_error_deleteFailed;
public static String AgentSelectionDialog_dialogTitle;
public static String AgentSelectionDialog_title;
public static String AgentSelectionDialog_message;
+ public static String RedirectHandler_error_title;
+ public static String RedirectHandler_error_deleteFailed;
+
+ public static String RedirectAgentSelectionDialog_dialogTitle;
+ public static String RedirectAgentSelectionDialog_title;
+ public static String RedirectAgentSelectionDialog_message;
+
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 0a84ca5d5..de76fd794 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
@@ -63,13 +63,20 @@ PeerAttributesTablePart_edit_dialogTitle=Edit
PeerAttributesTablePart_edit_title=Edit Attribute
PeerAttributesTablePart_edit_message=Edit the selected peer attribute.
-DeleteCommandHandler_error_title=Error
-DeleteCommandHandler_error_deleteFailed=Failed to delete static peer.
+DeleteHandler_error_title=Error
+DeleteHandler_error_deleteFailed=Failed to delete static peer.
AgentSelectionDialog_dialogTitle=Select Agent(s)
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.
+
+RedirectAgentSelectionDialog_dialogTitle=Redirect
+RedirectAgentSelectionDialog_title=Select Proxy
+RedirectAgentSelectionDialog_message=Select the proxy to redirect the communication through.
+
# ***** Preference Pages *****
LoggingPreferencePage_label=Logging settings for agent communication:

Back to the top