connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java
changeset 699 fe13162b76cf
parent 698 9162f4cfad65
child 700 9441b6037cb6
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Thu Dec 17 11:28:11 2009 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Thu Dec 17 15:43:43 2009 -0600
@@ -250,19 +250,26 @@
 		return null;
 	}
 
-	/* (non-Javadoc)
-	 * @see com.nokia.carbide.remoteconnections.registry.IConnectionStore#storeConnections()
-	 */
 	public void storeConnections() {
 		try {
 			OutputStream os = new FileOutputStream(getConnectionStorageFile());
-			Writer.writeToXML(os, connectionToConnectedServices.keySet());
+			Writer.writeToXML(os, getNonDynamicConnections());
 		} 
 		catch (Exception e) {
 			RemoteConnectionsActivator.log(Messages.getString("Registry.ConnectionStoreError"), e); //$NON-NLS-1$
 		}
 	}
 	
+	private Collection<IConnection> getNonDynamicConnections() {
+		List<IConnection> nonDynamicConnections = new ArrayList<IConnection>();
+		for (IConnection connection : connectionToConnectedServices.keySet()) {
+			if (!(connection instanceof IConnection2) ||
+					!((IConnection2) connection).isDynamic())
+				nonDynamicConnections.add(connection);
+		}
+		return nonDynamicConnections;
+	}
+
 	public void addConnectionStoreChangedListener(IConnectionsManagerListener listener) {
 		if (listeners == null)
 			listeners = new ListenerList<IConnectionsManagerListener>();
@@ -522,6 +529,8 @@
 	}
 
 	public IConnection getDefaultConnection() {
+		if (defaultConnection == null)
+			pickNewDefaultConnection();
 		return defaultConnection;
 	}