[Bug 9392] Filter connection types with no compatible services from settings wizard (unless editing a connection of that type)
--- 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<IConnectionType> getConnectionTypes() {
- Collection<IConnectionType> connectionTypes =
- RemoteConnectionsActivator.getConnectionTypeProvider().getConnectionTypes();
+ Collection<IConnectionType> connectionTypes = getValidConnectionTypes();
IService serviceToRestrict = settingsWizard.getServiceToRestrict();
if (serviceToRestrict != null) {
List<IConnectionType> restrictedConnectionTypes = new ArrayList<IConnectionType>();
@@ -193,6 +192,21 @@
return connectionTypes;
}
+ private Collection<IConnectionType> 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<IConnectionType> allConnectionTypes =
+ RemoteConnectionsActivator.getConnectionTypeProvider().getConnectionTypes();
+ Collection<IConnectionType> connectionTypes = new ArrayList<IConnectionType>();
+ 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();