--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java Thu Feb 11 11:48:46 2010 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java Thu Feb 11 13:39:38 2010 -0600
@@ -517,6 +517,7 @@
public ISelectedConnectionInfo ensureConnection(String id, IService service) throws CoreException {
Check.checkArg(service);
+ final boolean wasCurrentConnection = id.equals(CURRENT_CONNECTION_ID);
final IConnection[] connectionHolder = { findConnection(id) };
final String[] storableIdHolder = { id };
if (!isCompatibleConnection(connectionHolder[0], service)) {
@@ -526,6 +527,10 @@
Logging.newStatus(RemoteConnectionsActivator.getDefault(), IStatus.ERROR,
Messages.getString("Registry.NoCompatibleConnectionMsg"))); //$NON-NLS-1$
}
+ else if (wasCurrentConnection && !connectionHolder[0].getIdentifier().equals(CURRENT_CONNECTION_ID)) {
+ setCurrentConnection(connectionHolder[0]);
+ storableIdHolder[0] = CURRENT_CONNECTION_ID;
+ }
}
return new ISelectedConnectionInfo() {
public String getStorableId() {