# HG changeset patch # User dadubrow # Date 1246465877 18000 # Node ID c44c75698736d7b13adeacd235f73a847cf0b1fc # Parent 0bdee354f078ec6e5b9c9790eb928b7a82586320 [Bug 9392] Filter connection types with no compatible services from settings wizard (unless editing a connection of that type) diff -r 0bdee354f078 -r c44c75698736 connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionTypePage.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionTypePage.java Wed Jul 01 10:48:15 2009 -0500 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionTypePage.java Wed Jul 01 11:31:17 2009 -0500 @@ -174,8 +174,7 @@ } private Collection getConnectionTypes() { - Collection connectionTypes = - RemoteConnectionsActivator.getConnectionTypeProvider().getConnectionTypes(); + Collection connectionTypes = getValidConnectionTypes(); IService serviceToRestrict = settingsWizard.getServiceToRestrict(); if (serviceToRestrict != null) { List restrictedConnectionTypes = new ArrayList(); @@ -193,6 +192,21 @@ return connectionTypes; } + private Collection getValidConnectionTypes() { + // valid connection types have at least one compatible service, or are the actual connection type of the connection being edited + IConnection connectionToEdit = settingsWizard.getConnectionToEdit(); + IConnectionType connectionTypeToEdit = connectionToEdit != null ? connectionToEdit.getConnectionType() : null; + Collection allConnectionTypes = + RemoteConnectionsActivator.getConnectionTypeProvider().getConnectionTypes(); + Collection connectionTypes = new ArrayList(); + for (IConnectionType connectionType : allConnectionTypes) { + if (!RemoteConnectionsActivator.getConnectionTypeProvider().getCompatibleServices(connectionType).isEmpty() || + connectionType.equals(connectionTypeToEdit)) + connectionTypes.add(connectionType); + } + return connectionTypes; + } + private boolean validatePage() { setErrorMessage(null); String name = getName();