merge RCL_2_4
authordadubrow
Thu, 01 Jul 2010 13:28:31 -0500
branchRCL_2_4
changeset 1566 ab85ee3ba586
parent 1565 c4e41d93d2ed (current diff)
parent 1563 f078617f9037 (diff)
child 1571 b1641b8ccefb
merge
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionsManager.java	Thu Jul 01 13:27:31 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionsManager.java	Thu Jul 01 13:28:31 2010 -0500
@@ -177,11 +177,13 @@
 	IConnection getCurrentConnection();
 	
 	/**
-	 * Returns the IClientServiceSiteUI2 for a service. Filters connection types to those that
-	 * are supported by the service. Connection list UI as well as new and edit wizards are filtered.
+	 * Returns the IClientServiceSiteUI2 for selecting a connection.  
 	 * Allows selecting a "current" connection which maps to #getCurrentConnection()
-	 * when you use #ensureConenction().
-	 * @param service IService
+	 * when you use #ensureConnection().
+	 * <p>
+	 * Optionally filters connection types to those that are supported by the 
+	 * service. Connection list UI as well as new and edit wizards are filtered.
+	 * @param service IService or <code>null</code>
 	 * @return IClientServiceSiteUI2
 	 * @since 2.5
 	 */
@@ -189,7 +191,7 @@
 	
 	/**
 	 * Can be called by specific service implementors (e.g., debugger) to ensure some connection
-	 * exists and supports this service. If the connection does not exist or does not support
+	 * exists and optionally supports this service.  If the connection does not exist or does not support
 	 * the service, a CoreException may be thrown after the framework attempts to allow the user
 	 * to correct the situation by showing a connection selection dialog. 
 	 * If an ISelectedConnectionInfo is returned, {@link ISelectedConnectionInfo#getConnection()} 
@@ -197,7 +199,7 @@
 	 * and {@link ISelectedConnectionInfo#getStorableId()} is the id that can
  	 * be stored by the caller that represents the user's selection.
 	 * @param connectionId String
-	 * @param service IService
+	 * @param service IService or <code>null</code>
 	 * @return ISelectedConnectionInfo
 	 * @throws CoreException
 	 * @since 2.5
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Thu Jul 01 13:27:31 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Thu Jul 01 13:28:31 2010 -0500
@@ -301,7 +301,11 @@
 		if (listeners == null)
 			return;
 		for (IConnectionsManagerListener listener : listeners) {
-			listener.connectionStoreChanged();
+			try {
+				listener.connectionStoreChanged();
+			} catch (Throwable t) {
+				RemoteConnectionsActivator.logError(t);	
+			}
 		}
 	}
 
@@ -451,7 +455,11 @@
 		if (listeners == null)
 			return;
 		for (IConnectionsManagerListener listener : listeners) {
-			listener.displayChanged();
+			try {
+				listener.displayChanged();
+			} catch (Throwable t) {
+				RemoteConnectionsActivator.logError(t);	
+			}
 		}
 	}
 	
@@ -494,7 +502,11 @@
 		if (connectionListeners == null)
 			return;
 		for (IConnectionListener listener : connectionListeners) {
-			listener.connectionAdded(connection);
+			try {
+				listener.connectionAdded(connection);
+			} catch (Throwable t) {
+				RemoteConnectionsActivator.logError(t);	
+			}
 		}
 	}
 	
@@ -502,7 +514,11 @@
 		if (connectionListeners == null)
 			return;
 		for (IConnectionListener listener : connectionListeners) {
-			listener.connectionRemoved(connection);
+			try {
+				listener.connectionRemoved(connection);
+			} catch (Throwable t) {
+				RemoteConnectionsActivator.logError(t);	
+			}
 		}
 	}
 	
@@ -510,12 +526,15 @@
 		if (connectionListeners == null)
 			return;
 		for (IConnectionListener listener : connectionListeners) {
-			listener.currentConnectionSet(connection);
+			try {
+				listener.currentConnectionSet(connection);
+			} catch (Throwable t) {
+				RemoteConnectionsActivator.logError(t);	
+			}
 		}
 	}
 	
 	public ISelectedConnectionInfo ensureConnection(String id, IService service) throws CoreException {
-		Check.checkArg(service);
 		final boolean wasCurrentConnection = CURRENT_CONNECTION_ID.equals(id);
 		final IConnection[] connectionHolder = { findConnection(id) };
 		final String[] storableIdHolder = { id };
@@ -566,7 +585,7 @@
 	private boolean isCompatibleConnection(IConnection connection, IService service) {
 		if (connection == null)
 			return false;
-		return getCompatibleServices(connection.getConnectionType()).contains(service);
+		return service == null || getCompatibleServices(connection.getConnectionType()).contains(service);
 	}
 
 	public void setCurrentConnection(IConnection connection) {
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java	Thu Jul 01 13:27:31 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java	Thu Jul 01 13:28:31 2010 -0500
@@ -66,7 +66,6 @@
 	private Map<String, String> connectionNames;
 
 	public ClientServiceSiteUI2(IService service) {
-		Check.checkArg(service);
 		this.service = service;
 	}
 	
@@ -297,11 +296,15 @@
 
 	private void getCompatibleConnectionTypes() {
 		compatibleConnectionTypes = new HashSet<IConnectionType>();
-		Collection<String> compatibleTypeIds =
-			Registry.instance().getCompatibleConnectionTypeIds(service);
-		for (String typeId : compatibleTypeIds) {
-			compatibleConnectionTypes.add(
-					Registry.instance().getConnectionType(typeId));
+		if (service != null) {
+			Collection<String> compatibleTypeIds =
+				Registry.instance().getCompatibleConnectionTypeIds(service);
+			for (String typeId : compatibleTypeIds) {
+				compatibleConnectionTypes.add(
+						Registry.instance().getConnectionType(typeId));
+			}
+		} else {
+			compatibleConnectionTypes.addAll(Registry.instance().getConnectionTypes());
 		}
 	}
 
@@ -317,12 +320,15 @@
 	public IStatus getSelectionStatus() {
 		String requiredConnectionTypes = getAllowedConnectionTypesString();
 		
+		String serviceName = service != null ? service.getDisplayName() 
+				: Messages.getString("ClientServiceSiteUI2.NoConnectionErrorPlaceholderForNoServiceName"); //$NON-NLS-1$
+		
 		// no selection yet...?
 		if (connection == null) {
 			return new Status(IStatus.ERROR, RemoteConnectionsActivator.PLUGIN_ID,
 					MessageFormat.format(
 							Messages.getString("ClientServiceSiteUI2.NoConnectionError"), //$NON-NLS-1$
-							service.getDisplayName(),
+							serviceName,
 							requiredConnectionTypes));
 		}
 		
@@ -333,26 +339,28 @@
 				return new Status(IStatus.ERROR, RemoteConnectionsActivator.PLUGIN_ID,
 						MessageFormat.format(
 							Messages.getString("ClientServiceSiteUI2.NoCurrentConnection"), //$NON-NLS-1$
-							service.getDisplayName(),
+							serviceName,
 							requiredConnectionTypes));
 			}
 			
-			// is the service supported?
-			boolean found = false;
-			for (IConnectedService aService : Registry.instance().getConnectedServices(actual)) {
-				if (service.getIdentifier().equals(aService.getService().getIdentifier())) {
-					found = true;
-					break;
+			if (service != null) {
+				// is the service supported?
+				boolean found = false;
+				for (IConnectedService aService : Registry.instance().getConnectedServices(actual)) {
+					if (service.getIdentifier().equals(aService.getService().getIdentifier())) {
+						found = true;
+						break;
+					}
 				}
-			}
-			if (!found) {
-				return new Status(IStatus.WARNING, RemoteConnectionsActivator.PLUGIN_ID,
-						MessageFormat.format(
-								Messages.getString("ClientServiceSiteUI2.IncompatibleCurrentConnectionService") //$NON-NLS-1$
-								+ "\n"  //$NON-NLS-1$
-								+ Messages.getString("ClientServiceSiteUI2.IncompatibleCurrentConnectionFixupAdvice"), //$NON-NLS-1$
-								actual.getDisplayName(),
-								service.getDisplayName()));
+				if (!found) {
+					return new Status(IStatus.WARNING, RemoteConnectionsActivator.PLUGIN_ID,
+							MessageFormat.format(
+									Messages.getString("ClientServiceSiteUI2.IncompatibleCurrentConnectionService") //$NON-NLS-1$
+									+ "\n"  //$NON-NLS-1$
+									+ Messages.getString("ClientServiceSiteUI2.IncompatibleCurrentConnectionFixupAdvice"), //$NON-NLS-1$
+									actual.getDisplayName(),
+									serviceName));
+				}
 			}
 			
 			// is the hardware type supported by the service?
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Thu Jul 01 13:27:31 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Thu Jul 01 13:28:31 2010 -0500
@@ -16,6 +16,7 @@
 ClientServiceSiteUI2.NewButtonLabel=New...
 ClientServiceSiteUI2.UseConnectionGroupLabel=Use connection
 ClientServiceSiteUI2.NoConnectionError=A valid remote connection must be selected.  If none exist, connect a device or create a connection one supporting {0} via {1}.
+ClientServiceSiteUI2.NoConnectionErrorPlaceholderForNoServiceName=connecting
 ClientServiceSiteUI2.NoCurrentConnection=No current connection is available.  Connect a device or create a connection supporting {0} via {1}.
 ClientServiceSiteUI2.IncompatibleCurrentConnectionType=The current connection ''{0}'' does not support connection type: ''{1}''.
 ClientServiceSiteUI2.IncompatibleCurrentConnectionService=The current connection ''{0}'' does not support the service: ''{1}''.
--- a/connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCAPIConnection.java	Thu Jul 01 13:27:31 2010 -0500
+++ b/connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCAPIConnection.java	Thu Jul 01 13:28:31 2010 -0500
@@ -501,9 +501,13 @@
 				settings = new String[1];
 			} else {
 				// Add other connections here
+				return new Status(Status.ERROR, Activator.PLUGIN_ID, (int)TCErrorConstants.TCAPI_ERR_MEDIA_NOT_SUPPORTED, 
+						"Unknown connection type: " + type, null); 
 			}
+			return finishConnect(type, settings, inConnection, inMessageOptions, inMessageIds);
+		} else {
+			return status;
 		}
-		return finishConnect(type, settings, inConnection, inMessageOptions, inMessageIds);
 	}
 	protected void ensureWritableFile(String filePath) throws IOException {
 		// ensure file path points to a writable regular file