Select the default connection when opening the Remote Connections view from the selector widget.
--- 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);
--- 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);
+ }
+ }
+ }
}