# HG changeset patch # User Ed Swartz # Date 1263310784 21600 # Node ID dfe9c76b4eb2d86bfb377387d6a0c586eb4a0be3 # Parent 218edd9d77f10cefdb40477cfca68969148db3c2 Select the default connection when opening the Remote Connections view from the selector widget. diff -r 218edd9d77f1 -r dfe9c76b4eb2 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionStatusSelectorContribution.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionStatusSelectorContribution.java Tue Jan 12 09:37:50 2010 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ConnectionStatusSelectorContribution.java Tue Jan 12 09:39:44 2010 -0600 @@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; import org.eclipse.swt.widgets.ToolTip; +import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; @@ -400,7 +401,10 @@ */ protected void openConnectionsView() { try { - WorkbenchUtils.getView(ConnectionsView.VIEW_ID); + IViewPart view = WorkbenchUtils.getView(ConnectionsView.VIEW_ID); + if (defaultConnection != null && view instanceof ConnectionsView) { + ((ConnectionsView) view).setSelectedConnection(defaultConnection); + } } catch (PartInitException e) { RemoteConnectionsActivator.logError(e); diff -r 218edd9d77f1 -r dfe9c76b4eb2 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/ConnectionsView.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/ConnectionsView.java Tue Jan 12 09:37:50 2010 -0600 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/view/ConnectionsView.java Tue Jan 12 09:39:44 2010 -0600 @@ -48,6 +48,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.jface.viewers.TreeColumnViewerLabelProvider; import org.eclipse.jface.viewers.TreeNode; @@ -909,6 +910,16 @@ } return null; } - + + public void setSelectedConnection(IConnection connection) { + if (viewer != null && !viewer.getControl().isDisposed()) { + if (connection != null) { + TreeNode node = new TreeNode(connection); + viewer.setSelection(new StructuredSelection(node)); + } else { + viewer.setSelection(null); + } + } + } }