Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-12-18 08:56:42 -0500
committerTobias Schwarz2013-12-18 08:56:42 -0500
commit7fb8b83faf758f57321cbb70b52b813abe69aa69 (patch)
tree175c657e26ea8f1d171db530b07804a8501dbee6 /target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf
parentafed0c66f7a21348d7e6009cb16d60303a1778d9 (diff)
downloadorg.eclipse.tcf-7fb8b83faf758f57321cbb70b52b813abe69aa69.tar.gz
org.eclipse.tcf-7fb8b83faf758f57321cbb70b52b813abe69aa69.tar.xz
org.eclipse.tcf-7fb8b83faf758f57321cbb70b52b813abe69aa69.zip
Target Explorer: peer and peer ndoe selection dialogs
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/ToolbarAction.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AbstractArraySelectionDialog.java218
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerNodeSelectionDialog.java127
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java231
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectPeerSelectionDialog.java71
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.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
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java7
10 files changed, 386 insertions, 328 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java
index f8535aa55..313d6c3fb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/AbstractPeerTypeToolbarAction.java
@@ -25,7 +25,6 @@ import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
@@ -44,10 +43,9 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
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.ui.dialogs.PeerSelectionDialog;
+import org.eclipse.tcf.te.tcf.ui.dialogs.PeerNodeSelectionDialog;
import org.eclipse.tcf.te.ui.views.editor.EditorInput;
import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants;
-import org.eclipse.tcf.te.ui.views.navigator.ViewerSorter;
import org.eclipse.tcf.te.ui.wizards.newWizard.NewWizardRegistry;
import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IEditorInput;
@@ -89,7 +87,6 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA
protected abstract ImageDescriptor getSelectExistingActionImageDescriptor();
protected abstract String getSelectExistingDialogTitle();
protected abstract String getSelectExistingDialogDescription();
- protected abstract String getSelectExistingDialogReachableOnlyLabel();
protected abstract ViewerFilter getSelectExistingDialogViewerFilter();
/* (non-Javadoc)
@@ -283,7 +280,7 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA
// Get the active page
IWorkbenchPage page = window.getActivePage();
// Create the agent selection dialog
- PeerSelectionDialog dialog = new PeerSelectionDialog(null) {
+ PeerNodeSelectionDialog dialog = new PeerNodeSelectionDialog(null) {
@Override
protected String getTitle() {
return getSelectExistingDialogTitle();
@@ -293,18 +290,8 @@ public abstract class AbstractPeerTypeToolbarAction extends Action implements IA
return getSelectExistingDialogDescription();
}
@Override
- protected String getShowOnlyReachableLabel() {
- return getSelectExistingDialogReachableOnlyLabel();
- }
- @Override
- protected boolean supportsMultiSelection() {
- return false;
- }
- @Override
- protected void configureTableViewer(TableViewer viewer) {
- super.configureTableViewer(viewer);
- viewer.addFilter(getSelectExistingDialogViewerFilter());
- viewer.setSorter(new ViewerSorter());
+ protected String getType() {
+ return getPeerTypeId();
}
};
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/ToolbarAction.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/ToolbarAction.java
index 03357c335..02353c780 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/ToolbarAction.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/actions/ToolbarAction.java
@@ -65,14 +65,6 @@ public class ToolbarAction extends AbstractPeerTypeToolbarAction {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.actions.AbstractPeerTypeToolbarAction#getSelectExistingDialogReachableOnlyLabel()
- */
- @Override
- protected String getSelectExistingDialogReachableOnlyLabel() {
- return Messages.ToolbarAction_selectionDialog_button_showOnlyReachable;
- }
-
- /* (non-Javadoc)
* @see org.eclipse.tcf.te.tcf.ui.actions.AbstractPeerTypeToolbarAction#getSelectExistingDialogViewerFilter()
*/
@Override
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AbstractArraySelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AbstractArraySelectionDialog.java
new file mode 100644
index 000000000..a4d487a5a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/AbstractArraySelectionDialog.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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.core.runtime.Assert;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider;
+import org.eclipse.tcf.te.ui.views.navigator.ViewerSorter;
+
+/**
+ * Selection dialog implementation.
+ */
+public abstract class AbstractArraySelectionDialog extends CustomTitleAreaDialog {
+ // The table viewer
+ /* default */ TableViewer viewer;
+
+ // The selection. Will be filled in if "OK" is pressed
+ private ISelection selection;
+
+ /**
+ * 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 AbstractArraySelectionDialog(Shell shell, String contextHelpId) {
+ super(shell, contextHelpId);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#isResizable()
+ */
+ @Override
+ protected boolean isResizable() {
+ 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 false;
+ }
+
+ /**
+ * Returns the table viewer instance.
+ *
+ * @return The table viewer instance or <code>null</code>.
+ */
+ protected final TableViewer getViewer() {
+ return viewer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void createDialogAreaContent(Composite parent) {
+ super.createDialogAreaContent(parent);
+
+ setDialogTitle(getDialogTitle());
+ setTitle(getTitle());
+ setDefaultMessage(getDefaultMessage(), IMessageProvider.NONE);
+
+ // Create the table viewer
+ viewer = new TableViewer(parent, (supportsMultiSelection() ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER);
+
+ // Configure the table
+ Table table = viewer.getTable();
+
+ @SuppressWarnings("unused")
+ TableColumn column = new TableColumn(table, SWT.LEFT);
+
+ TableLayout tableLayout = new TableLayout();
+ tableLayout.addColumnData(new ColumnWeightData(100));
+ table.setLayout(tableLayout);
+
+ GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ table.setLayoutData(layoutData);
+
+ viewer.setContentProvider(new ArrayContentProvider());
+ DelegatingLabelProvider labelProvider = new DelegatingLabelProvider();
+ viewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, labelProvider));
+
+ // Subclasses may customize the viewer before setting the input
+ configureTableViewer(viewer);
+
+ viewer.setInput(getInput());
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ if (!viewer.getSelection().isEmpty()) {
+ okPressed();
+ }
+ }
+ });
+
+ viewer.refresh();
+ updateEnablement(viewer);
+ }
+
+ protected abstract Object[] getInput();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Control buttonBar = super.createButtonBar(parent);
+ updateEnablement(viewer);
+ return buttonBar;
+ }
+
+ /**
+ * Update the enablement of the dialog widgets.
+ *
+ * @param viewer The table viewer. Must not be <code>null</code>.
+ */
+ protected void updateEnablement(TableViewer viewer) {
+ Assert.isNotNull(viewer);
+
+ // Adjust the OK button enablement
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ SWTControlUtil.setEnabled(okButton, viewer.getTable().getItems().length > 0);
+ }
+
+ /**
+ * 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);
+ viewer.setSorter(new ViewerSorter());
+ }
+
+ /**
+ * Returns the dialog title.
+ *
+ * @return The dialog title.
+ */
+ protected abstract String getDialogTitle();
+
+ /**
+ * Returns the title.
+ *
+ * @return The title.
+ */
+ protected abstract String getTitle();
+
+ /**
+ * Returns the default message.
+ *
+ * @return The default message.
+ */
+ protected abstract String getDefaultMessage();
+
+ /**
+ * Returns the selection which had been set to the viewer at
+ * the time of closing the dialog with either "OK" or "Cancel".
+ *
+ * @return The selection or <code>null</code>.
+ */
+ public ISelection getSelection() {
+ return selection;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ selection = viewer.getSelection();
+ super.okPressed();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+ */
+ @Override
+ protected void cancelPressed() {
+ selection = null;
+ super.cancelPressed();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerNodeSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerNodeSelectionDialog.java
new file mode 100644
index 000000000..1b98b4bff
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerNodeSelectionDialog.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 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 java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.protocol.Protocol;
+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.model.ModelManager;
+import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
+import org.eclipse.tcf.te.tcf.ui.nls.Messages;
+
+/**
+ * Peer selection dialog implementation.
+ */
+public class PeerNodeSelectionDialog extends AbstractArraySelectionDialog {
+
+ final String[] services;
+
+ /**
+ * Constructor.
+ *
+ * @param shell The shell used to view the dialog, or <code>null</code>.
+ */
+ public PeerNodeSelectionDialog(Shell shell) {
+ super(shell, IContextHelpIds.PEER_NODE_SELECTION_DIALOG);
+
+ this.services = null;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param shell The shell used to view the dialog, or <code>null</code>.
+ */
+ public PeerNodeSelectionDialog(Shell shell, String[] services) {
+ super(shell, IContextHelpIds.PEER_NODE_SELECTION_DIALOG);
+
+ this.services = services;
+ }
+
+ @Override
+ protected Object[] getInput() {
+ List<IPeerNode> peerNodes = new ArrayList<IPeerNode>();
+ for (final IPeerNode peerNode : ModelManager.getPeerModel().getPeerNodes()) {
+ if (getType() == null || getType().equals(peerNode.getPeerType())) {
+ if (services != null && services.length > 0) {
+ final AtomicBoolean hasServices = new AtomicBoolean();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ String offlineServices = peerNode.getStringProperty(IPeerNodeProperties.PROP_OFFLINE_SERVICES);
+ String remoteServices = peerNode.getStringProperty(IPeerNodeProperties.PROP_REMOTE_SERVICES);
+ List<String> offline = offlineServices != null ? Arrays.asList(offlineServices.split(",\\s*")) : Collections.EMPTY_LIST; //$NON-NLS-1$
+ List<String> remote = remoteServices != null ? Arrays.asList(remoteServices.split(",\\s*")) : null; //$NON-NLS-1$
+ boolean hasOfflineService = true;
+ for (String service : services) {
+ hasOfflineService &= (remote == null) ? offline.contains(service) : remote.contains(service);
+ if (!hasOfflineService) {
+ break;
+ }
+ }
+ hasServices.set(hasOfflineService);
+ }
+ });
+ if (!hasServices.get()) {
+ continue;
+ }
+ }
+ peerNodes.add(peerNode);
+ }
+ }
+
+ return peerNodes.toArray();
+ }
+
+ /**
+ * Get the peer node type to filter.
+ * @return The peer type id or <code>null</code> for all peer nodes.
+ */
+ protected String getType() {
+ return null;
+ }
+
+ /**
+ * Returns the dialog title.
+ *
+ * @return The dialog title.
+ */
+ @Override
+ protected String getDialogTitle() {
+ return Messages.PeerNodeSelectionDialog_dialogTitle;
+ }
+
+ /**
+ * Returns the title.
+ *
+ * @return The title.
+ */
+ @Override
+ protected String getTitle() {
+ return Messages.PeerNodeSelectionDialog_title;
+ }
+
+ /**
+ * Returns the default message.
+ *
+ * @return The default message.
+ */
+ @Override
+ protected String getDefaultMessage() {
+ return Messages.PeerNodeSelectionDialog_message;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java
index 9898b03a7..e5b3b9199 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/PeerSelectionDialog.java
@@ -9,194 +9,28 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.ui.dialogs;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.model.ModelManager;
import org.eclipse.tcf.te.tcf.ui.help.IContextHelpIds;
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;
-import org.eclipse.tcf.te.ui.views.navigator.DelegatingLabelProvider;
/**
- * TCF agent selection dialog implementation.
+ * Peer selection dialog implementation.
*/
-public class PeerSelectionDialog extends CustomTitleAreaDialog {
- // The list of remote services the agents must provide to be included
- /* default */ final String[] services;
-
- // The table viewer
- /* default */ TableViewer viewer;
-
- // The selection. Will be filled in if either "OK" or "Cancel" is pressed
- private ISelection selection;
-
- /**
- * Constructor.
- *
- * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>.
- */
- public PeerSelectionDialog(String[] services) {
- this(null, services);
- }
+public class PeerSelectionDialog extends AbstractArraySelectionDialog {
/**
* 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>.
+ * @param shell The shell used to view the dialog, or <code>null</code>.
*/
- public PeerSelectionDialog(Shell parent, String[] services) {
- super(parent, IContextHelpIds.AGENT_SELECTION_DIALOG);
-
- this.services = services != null && services.length > 0 ? services : null;
+ public PeerSelectionDialog(Shell shell) {
+ super(shell, IContextHelpIds.PEER_SELECTION_DIALOG);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#isResizable()
- */
@Override
- protected boolean isResizable() {
- 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;
- }
-
- /**
- * Returns the table viewer instance.
- *
- * @return The table viewer instance or <code>null</code>.
- */
- protected final TableViewer getViewer() {
- return viewer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected void createDialogAreaContent(Composite parent) {
- super.createDialogAreaContent(parent);
-
- setDialogTitle(getDialogTitle());
- setTitle(getTitle());
- setDefaultMessage(getDefaultMessage(), IMessageProvider.NONE);
-
- // Create the table viewer
- viewer = new TableViewer(parent, (supportsMultiSelection() ? SWT.MULTI : SWT.SINGLE) | SWT.BORDER);
-
- // Configure the table
- Table table = viewer.getTable();
-
- @SuppressWarnings("unused")
- TableColumn column = new TableColumn(table, SWT.LEFT);
-
- TableLayout tableLayout = new TableLayout();
- tableLayout.addColumnData(new ColumnWeightData(100));
- table.setLayout(tableLayout);
-
- GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- table.setLayoutData(layoutData);
-
- viewer.setContentProvider(new ArrayContentProvider());
- DelegatingLabelProvider labelProvider = new DelegatingLabelProvider() {
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.navigator.LabelProviderDelegate#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
- */
- @Override
- public Image decorateImage(Image image, Object element) {
- return image;
- }
- };
- viewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, labelProvider));
-
- // Subclasses may customize the viewer before setting the input
- configureTableViewer(viewer);
-
- viewer.setInput(ModelManager.getLocatorModel().getPeers());
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- if (!viewer.getSelection().isEmpty()) {
- okPressed();
- }
- }
- });
-
- viewer.refresh();
- updateEnablement(viewer);
- }
-
- /**
- * Returns the label of the "Show only reachable targets" filter button.
- *
- * @return The label.
- */
- protected String getShowOnlyReachableLabel() {
- return Messages.AgentSelectionDialog_button_showOnlyReachable;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createButtonBar(Composite parent) {
- Control buttonBar = super.createButtonBar(parent);
- updateEnablement(viewer);
- return buttonBar;
- }
-
- /**
- * Update the enablement of the dialog widgets.
- *
- * @param viewer The table viewer. Must not be <code>null</code>.
- */
- protected void updateEnablement(TableViewer viewer) {
- Assert.isNotNull(viewer);
-
- // Adjust the OK button enablement
- Button okButton = getButton(IDialogConstants.OK_ID);
- SWTControlUtil.setEnabled(okButton, viewer.getTable().getItems().length > 0);
- }
-
- /**
- * 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);
+ protected Object[] getInput() {
+ return ModelManager.getLocatorModel().getPeers();
}
/**
@@ -204,8 +38,9 @@ public class PeerSelectionDialog extends CustomTitleAreaDialog {
*
* @return The dialog title.
*/
- protected String getDialogTitle() {
- return Messages.AgentSelectionDialog_dialogTitle;
+ @Override
+ protected String getDialogTitle() {
+ return Messages.PeerSelectionDialog_dialogTitle;
}
/**
@@ -213,8 +48,9 @@ public class PeerSelectionDialog extends CustomTitleAreaDialog {
*
* @return The title.
*/
- protected String getTitle() {
- return Messages.AgentSelectionDialog_title;
+ @Override
+ protected String getTitle() {
+ return Messages.PeerSelectionDialog_title;
}
/**
@@ -222,45 +58,8 @@ public class PeerSelectionDialog extends CustomTitleAreaDialog {
*
* @return The default message.
*/
- protected String getDefaultMessage() {
- return Messages.AgentSelectionDialog_message;
- }
-
- /**
- * Returns the locator model instance to use for determining
- * the dialogs input.
- *
- * @return The locator model instance.
- */
- protected IPeerModel getModel() {
- return ModelManager.getPeerModel();
- }
-
- /**
- * Returns the selection which had been set to the viewer at
- * the time of closing the dialog with either "OK" or "Cancel".
- *
- * @return The selection or <code>null</code>.
- */
- public ISelection getSelection() {
- return selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog#okPressed()
- */
- @Override
- protected void okPressed() {
- selection = viewer.getSelection();
- super.okPressed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
- */
@Override
- protected void cancelPressed() {
- selection = null;
- super.cancelPressed();
+ protected String getDefaultMessage() {
+ return Messages.PeerSelectionDialog_message;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectPeerSelectionDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectPeerSelectionDialog.java
deleted file mode 100644
index fb3c1125b..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/dialogs/RedirectPeerSelectionDialog.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * 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 RedirectPeerSelectionDialog extends PeerSelectionDialog {
-
- /**
- * Constructor.
- *
- * @param services The list of (remote) services the agents must provide to be selectable, or <code>null</code>.
- */
- public RedirectPeerSelectionDialog(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 RedirectPeerSelectionDialog(Shell parent, String[] services) {
- super(parent, services);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog#getDialogTitle()
- */
- @Override
- protected String getDialogTitle() {
- return Messages.RedirectAgentSelectionDialog_dialogTitle;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog#getTitle()
- */
- @Override
- protected String getTitle() {
- return Messages.RedirectAgentSelectionDialog_title;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog#getDefaultMessage()
- */
- @Override
- protected String getDefaultMessage() {
- return Messages.RedirectAgentSelectionDialog_message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.tcf.ui.dialogs.PeerSelectionDialog#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/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/help/IContextHelpIds.java
index 4869fb75b..257c7bacb 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
@@ -43,9 +43,14 @@ public interface IContextHelpIds {
// ***** Dialogs and Dialog Pages *****
/**
- * TCF agent selection dialog.
+ * Peer selection dialog.
*/
- public final static String AGENT_SELECTION_DIALOG = PREFIX + "PeerSelectionDialog"; //$NON-NLS-1$
+ public final static String PEER_SELECTION_DIALOG = PREFIX + "PeerSelectionDialog"; //$NON-NLS-1$
+
+ /**
+ * Peer node selection dialog.
+ */
+ public final static String PEER_NODE_SELECTION_DIALOG = PREFIX + "PeerNodeSelectionDialog"; //$NON-NLS-1$
// ***** Message dialog boxes *****
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 d473cfca1..bde661eba 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
@@ -150,10 +150,13 @@ public class Messages extends NLS {
public static String DeleteHandlerDelegate_MsgDeleteOnePeer;
- public static String AgentSelectionDialog_dialogTitle;
- public static String AgentSelectionDialog_title;
- public static String AgentSelectionDialog_message;
- public static String AgentSelectionDialog_button_showOnlyReachable;
+ public static String PeerSelectionDialog_dialogTitle;
+ public static String PeerSelectionDialog_title;
+ public static String PeerSelectionDialog_message;
+
+ public static String PeerNodeSelectionDialog_dialogTitle;
+ public static String PeerNodeSelectionDialog_title;
+ public static String PeerNodeSelectionDialog_message;
public static String RedirectHandler_error_title;
public static String RedirectHandler_error_redirectFailed;
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 1b96b383f..7040ca8d6 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
@@ -106,10 +106,13 @@ DeleteHandlerDelegate_DialogTitle=Confirm Delete
DeleteHandlerDelegate_MsgDeleteMultiplePeers=Are you sure you want to delete these {0} targets?
DeleteHandlerDelegate_MsgDeleteOnePeer=Are you sure you want to delete target ''{0}''?
-AgentSelectionDialog_dialogTitle=Select Agent(s)
-AgentSelectionDialog_title=Select Agent(s)
-AgentSelectionDialog_message=Select the agent(s) for the operation to perform.
-AgentSelectionDialog_button_showOnlyReachable=Show only reachable targets
+PeerSelectionDialog_dialogTitle=Select
+PeerSelectionDialog_title=Select Peer
+PeerSelectionDialog_message=Select the discovered peer for the operation to perform.
+
+PeerNodeSelectionDialog_dialogTitle=Select
+PeerNodeSelectionDialog_title=Select Configuration
+PeerNodeSelectionDialog_message=Select the configuration for the operation to perform.
RedirectHandler_error_title=Error
RedirectHandler_error_redirectFailed=Failed to redirect target communication.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java
index bcc6713f9..8f73ac015 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/SimulatorTypeSelectionSection.java
@@ -154,12 +154,7 @@ public class SimulatorTypeSelectionSection extends AbstractSection implements ID
}
@Override
protected void onButtonControlSelected() {
- PeerSelectionDialog dialog = new PeerSelectionDialog(null) {
- @Override
- protected boolean supportsMultiSelection() {
- return false;
- }
- };
+ PeerSelectionDialog dialog = new PeerSelectionDialog(null);
// Open the dialog
if (dialog.open() == Window.OK) {

Back to the top