Updated remote connections wizard. RCL_2_4
authorstechong
Tue, 06 Apr 2010 15:10:31 -0500
branchRCL_2_4
changeset 1162 f19aaf545805
parent 1160 d7e46ce6d547
child 1164 a4892a66eacf
Updated remote connections wizard.
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionFactory.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionFactory2.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionFactory.java	Mon Apr 05 14:01:00 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionFactory.java	Tue Apr 06 15:10:31 2010 -0500
@@ -37,6 +37,7 @@
 	 * @param parent Composite
 	 * @param errorReporter IValidationErrorReporter
 	 * @param initialSettings Map may be <code>null</code>
+	 * @deprecated
 	 */
 	void createEditingUI(Composite parent, IValidationErrorReporter errorReporter, Map<String, String> initialSettings);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/IConnectionFactory2.java	Tue Apr 06 15:10:31 2010 -0500
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+package com.nokia.carbide.remoteconnections.interfaces;
+
+import java.util.Map;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An extended interface for a connection factory.
+ */
+public interface IConnectionFactory2 extends IConnectionFactory {
+
+	public static final String PREFERRED_CONNECTION_NAME = "preferred-connection-name"; //$NON-NLS-1$
+
+	public interface ISettingsChangedListener {
+		void settingsChanged();
+	}
+
+	public interface IEditingUI {
+		Map<String, String> getSettings();
+	}
+
+	/**
+	 * Creates a composite with UI for editing settings, optionally initialized with initialSettings.<br>
+	 * Can provide optional errorReporter and optional listener. Assumes parent has GridLayout
+	 * @param parent Composite
+	 * @param errorReporter IValidationErrorReporter
+	 * @param initialSettings Map may be <code>null</code>
+	 * @param settingsListener ISettingsChangedListener
+	 * @return IEditingUI
+	 */
+	IEditingUI createEditingUI(Composite parent, IValidationErrorReporter errorReporter, 
+			Map<String, String> initialSettings, ISettingsChangedListener settingsListener);
+	
+}
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Mon Apr 05 14:01:00 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Tue Apr 06 15:10:31 2010 -0500
@@ -20,7 +20,8 @@
 ClientServiceSiteUI2.IncompatibleCurrentConnectionService=The current connection ''{0}'' does not support the service: ''{1}''.
 ClientServiceSiteUI2.IncompatibleCurrentConnectionFixupAdvice=Either connect an appropriate device or select a compatible connection.
 ClientServiceSiteUI2.Or=or 
-ConnectionSettingsPage.AgentTestTabLabel=Set Connection Settings
+ConnectionSettingsPage.SetupTabLabel=Setup Connection
+ConnectionSettingsPage.AgentTestTabLabel=Test Connection
 ConnectionSettingsPage.ConnectionSettingsGroupLabel=Connection Settings
 ConnectionSettingsPage.ConnectionTestingLabel=Connection Testing
 ConnectionSettingsPage.DeviceOSComboToolTip=Used to determine which installer version to compare against the version reported by the remote agent
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java	Mon Apr 05 14:01:00 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/ConnectionSettingsPage.java	Tue Apr 06 15:10:31 2010 -0500
@@ -26,6 +26,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -38,6 +39,8 @@
 import org.eclipse.jface.layout.GridLayoutFactory;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.LabelProvider;
@@ -47,6 +50,8 @@
 import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.jface.viewers.TreeNodeContentProvider;
 import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
 import org.eclipse.jface.wizard.IWizardContainer2;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
@@ -54,6 +59,8 @@
 import org.eclipse.swt.custom.SashForm;
 import org.eclipse.swt.events.FocusAdapter;
 import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Image;
@@ -80,19 +87,22 @@
 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
 import com.nokia.carbide.remoteconnections.interfaces.AbstractConnectedService2;
 import com.nokia.carbide.remoteconnections.interfaces.IConnectedService;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatusChangedListener;
 import com.nokia.carbide.remoteconnections.interfaces.IConnection;
 import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory.IValidationErrorReporter;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory2;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory2.IEditingUI;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory2.ISettingsChangedListener;
 import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
 import com.nokia.carbide.remoteconnections.interfaces.IConnectionTypeProvider;
 import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider;
+import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller;
+import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller.IPackageContents;
 import com.nokia.carbide.remoteconnections.interfaces.IService;
 import com.nokia.carbide.remoteconnections.interfaces.IService2;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatusChangedListener;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectedService.IStatus.EStatus;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory.IValidationErrorReporter;
-import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller;
-import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider.IRemoteAgentInstaller.IPackageContents;
 import com.nokia.carbide.remoteconnections.internal.registry.Registry;
 import com.nokia.cpp.internal.api.utils.core.Check;
 import com.nokia.cpp.internal.api.utils.core.FileUtils;
@@ -100,7 +110,7 @@
 import com.nokia.cpp.internal.api.utils.core.Pair;
 import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils;
 
-public class ConnectionSettingsPage extends WizardPage {
+public class ConnectionSettingsPage extends WizardPage implements ISettingsChangedListener {
 	
 	public final class Tester extends Thread {
 		@Override
@@ -127,11 +137,17 @@
 	private final static Image FOLDER_ICON_IMG = 
 		PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
 				ISharedImages.IMG_OBJ_FOLDER).createImage();
+	private static final String INITIAL_NAME_FMT = "connection {0}"; //$NON-NLS-1$
 	private static final String UID = ".uid"; //$NON-NLS-1$
 	private final SettingsWizard settingsWizard;
 	private IConnectionType connectionType;
 	private ComboViewer deviceOSComboViewer;
 	private Group settingsGroup;
+	private Composite setupTabComposite;
+	private ComboViewer connectionTypeViewer;
+	private Text nameText;
+	private boolean modifiedName;
+	private boolean initialized;
 	private Composite agentTestTabComposite;
 	private ListViewer servicesListViewer;
 	private Text serviceTestInfo;
@@ -140,6 +156,7 @@
 	private Label statusLabel;
 	private Text statusText;
 	private IConnectionFactory connectionFactory;
+	private IEditingUI editingUI;
 	private IConnection connection;
 	private IService service;
 	private volatile IConnectedService connectedService;
@@ -166,6 +183,7 @@
 		tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
 		tabFolder.setData(UID, "ConnectionSettingsPage"); //$NON-NLS-1$
 		
+		createSetupTabComposite(tabFolder);
 		createAgentTestTabComposite(tabFolder);
 		createInstallTabComposite(tabFolder);
 		
@@ -173,7 +191,80 @@
 		
 		setControl(tabFolder);
 	}
-	
+
+	private void createSetupTabComposite(TabFolder tabFolder) {
+		TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
+		tabItem.setText(Messages.getString("ConnectionSettingsPage.SetupTabLabel")); //$NON-NLS-1$
+		tabItem.setData(UID, "setupTab"); //$NON-NLS-1$
+		setupTabComposite = new Composite(tabFolder, SWT.NONE);
+		setupTabComposite.setLayout(new GridLayout(2, false));
+		tabItem.setControl(setupTabComposite);
+		
+		boolean canEditConnection = !settingsWizard.isConnectionToEditDynamic();
+
+		Label viewerLabel = new Label(setupTabComposite, SWT.NONE);
+		viewerLabel.setText(Messages.getString("ConnectionTypePage.ViewerLabel")); //$NON-NLS-1$
+		
+		connectionTypeViewer = new ComboViewer(setupTabComposite, SWT.READ_ONLY);
+		connectionTypeViewer.setLabelProvider(new LabelProvider() {
+			@Override
+			public String getText(Object element) {
+				Check.checkState(element instanceof IConnectionType);
+				IConnectionType connectionType = (IConnectionType) element;
+				return connectionType.getDisplayName() + " (" + getServicesString(connectionType) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+		connectionTypeViewer.setContentProvider(new ArrayContentProvider());
+		connectionTypeViewer.setInput(getConnectionTypes());
+		GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+		connectionTypeViewer.getControl().setLayoutData(gd);
+		connectionTypeViewer.getControl().setData(UID, "viewer"); //$NON-NLS-1$
+		connectionTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+			private IConnectionType previousSelection;
+			public void selectionChanged(SelectionChangedEvent event) {
+				Object currentSelection = ((IStructuredSelection) event.getSelection()).getFirstElement();
+				if (!currentSelection.equals(previousSelection)) {
+					settingsWizard.connectionTypeChanged();
+					previousSelection = (IConnectionType) currentSelection;
+				}
+			}
+		});
+		connectionTypeViewer.addDoubleClickListener(new IDoubleClickListener() {
+			public void doubleClick(DoubleClickEvent event) {
+				getWizard().getContainer().showPage(getNextPage());
+			}
+		});
+		connectionTypeViewer.setSorter(new ViewerSorter() {
+			@Override
+			public int compare(Viewer viewer, Object e1, Object e2) {
+				IConnectionType t1 = (IConnectionType) e1;
+				IConnectionType t2 = (IConnectionType) e2;
+				return t1.getDisplayName().compareToIgnoreCase(t2.getDisplayName());
+			}
+		});
+		connectionTypeViewer.getCombo().select(getCurrentTypeIndex());
+		connectionTypeViewer.getCombo().setEnabled(canEditConnection);
+
+		Label nameLabel = new Label(setupTabComposite, SWT.NONE);
+		nameLabel.setText(Messages.getString("ConnectionTypePage.NameLabel")); //$NON-NLS-1$
+		nameText = new Text(setupTabComposite, SWT.BORDER);
+		gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+		nameText.setLayoutData(gd);
+		nameText.setToolTipText(Messages.getString("ConnectionTypePage.NameTextToolTip")); //$NON-NLS-1$
+		nameText.setData(UID, "nameText"); //$NON-NLS-1$
+		nameText.setText(getInitialNameText());
+		nameText.selectAll();
+		nameText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				modifiedName = true;
+				setPageComplete(validatePage());
+			}
+		});
+		nameText.setEnabled(canEditConnection);
+
+		createSettingsGroup(setupTabComposite);
+	}
+
 	private void createAgentTestTabComposite(TabFolder tabFolder) {
 		TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
 		tabItem.setText(Messages.getString("ConnectionSettingsPage.AgentTestTabLabel")); //$NON-NLS-1$
@@ -183,8 +274,6 @@
 		gridLayout.numColumns = 2;
 		agentTestTabComposite.setLayout(gridLayout);
 		tabItem.setControl(agentTestTabComposite);
-
-		createSettingsGroup(agentTestTabComposite);
 		
 		Group group = new Group(agentTestTabComposite, SWT.NONE);
 		group.setText(Messages.getString("ConnectionSettingsPage.ConnectionTestingLabel")); //$NON-NLS-1$
@@ -462,12 +551,18 @@
 	
 	public void setVisible(boolean visible) {
 		super.setVisible(visible);
-		if (visible)
-			updateDynamicUI();
+		if (visible) {
+			if (!initialized) {
+				initialized = true;
+				connectionTypeViewer.setSelection(connectionTypeViewer.getSelection());
+			}
+			settingsWizard.connectionTypeChanged();
+		}
 	}
 
+	@SuppressWarnings("deprecation")
 	public void updateDynamicUI() {
-		IConnectionType currentConnectionType = settingsWizard.getConnectionType();
+		IConnectionType currentConnectionType = getConnectionType();
 		if (currentConnectionType != null && !currentConnectionType.equals(connectionType)) {
 			setErrorMessage(null);
 			setPageComplete(true);
@@ -489,7 +584,7 @@
 			IConnection connectionToEdit = settingsWizard.getConnectionToEdit();
 			if (connectionToEdit != null && connectionToEdit.getConnectionType().equals(connectionType)) // show existing settings
 				initialSettings = connectionToEdit.getSettings();
-			connectionFactory.createEditingUI(settingsGroup, new IValidationErrorReporter() {
+			IValidationErrorReporter errorReporter = new IValidationErrorReporter() {
 				public void setErrorMessage(String newMessage) {
 					ConnectionSettingsPage.this.setErrorMessage(newMessage);
 					boolean noError = newMessage == null;
@@ -497,7 +592,19 @@
 					String buttonLabel = Messages.getString("ConnectionSettingsPage.StartServiceTestButtonLabel"); //$NON-NLS-1$
 					serviceTestButton.setText(buttonLabel);
 				}
-			}, initialSettings);
+			};
+			if (connectionFactory instanceof IConnectionFactory2) {
+				editingUI = ((IConnectionFactory2)connectionFactory).createEditingUI(
+						settingsGroup, errorReporter, initialSettings, this);
+				settingsChanged();
+			}
+			else {
+				connectionFactory.createEditingUI(settingsGroup, errorReporter, initialSettings);
+				if (!modifiedName) {
+					nameText.setText(getInitialNameText());
+					modifiedName = false;
+				}
+			}
 			settingsUI = settingsGroup.getChildren();
 			if (settingsUI.length == 0) {
 				CLabel label = new CLabel(settingsGroup, SWT.NONE);
@@ -508,7 +615,7 @@
 			else if (settingsWizard.isConnectionToEditDynamic()) {
 				disableControls(settingsUI);
 			}
-	
+
 			// update services list
 			Collection<IService> compatibleServices = 
 				Registry.instance().getCompatibleServices(connectionType);
@@ -532,13 +639,25 @@
 			t.start();
 		}
 		
-		if (getControl().isVisible())
+		if (getControl().isVisible()) {
+			setupTabComposite.layout(true, true);
 			agentTestTabComposite.layout(true, true);
+		}
 		
 		if (getControl().isVisible())
 			((IWizardContainer2) getWizard().getContainer()).updateSize();
 	}
 
+	public void settingsChanged() {
+		if (!modifiedName && editingUI != null) {
+			String preferredName = editingUI.getSettings().get(IConnectionFactory2.PREFERRED_CONNECTION_NAME);
+			if (preferredName != null) {
+				nameText.setText(preferredName);
+				modifiedName = false;
+			}
+		}
+	}
+
 	private void disableControls(Control[] controls) {
 		for (Control control : controls) {
 			if (control instanceof Composite)
@@ -647,7 +766,13 @@
 
 	@SuppressWarnings("unchecked")
 	protected void testService() {
-		Map<String, String> settings = connectionFactory.getSettingsFromUI();
+		Map<String, String> settings;
+		if (connectionFactory instanceof IConnectionFactory2 && editingUI != null) {
+			settings = editingUI.getSettings();
+		}
+		else {
+			settings = connectionFactory.getSettingsFromUI();
+		}
 		boolean newConnection = connection == null || !connectionType.equals(connection.getConnectionType());
 		if (newConnection) {
 			if (connection != null)
@@ -707,7 +832,7 @@
 	public Map<String, String> getSettings() {
 		if (connectionFactory == null) {
 			IConnection connectionToEdit = settingsWizard.getConnectionToEdit();
-			if (connectionToEdit == null || !connectionToEdit.getConnectionType().equals(settingsWizard.getConnectionType())) {
+			if (connectionToEdit == null || !connectionToEdit.getConnectionType().equals(getConnectionType())) {
 				return null;
 			}
 			return connectionToEdit.getSettings();
@@ -896,4 +1021,111 @@
 		});
 	}
 
+	public IConnectionType getConnectionType() {
+		return (IConnectionType) ((IStructuredSelection) connectionTypeViewer.getSelection()).getFirstElement();
+	}
+	
+	public String getName() {
+		return nameText.getText().trim();
+	}
+	
+	@SuppressWarnings("unchecked")
+	private int getCurrentTypeIndex() {
+		IConnection connectionToEdit = settingsWizard.getConnectionToEdit();
+		if (connectionToEdit != null) {
+			Object input = connectionTypeViewer.getInput();
+			if (input != null) {
+				Collection<IConnectionType> connectionTypes = (Collection<IConnectionType>) input;
+				for (int i = 0; i < connectionTypes.size(); i++) {
+					IConnectionType connectionType = (IConnectionType) connectionTypeViewer.getElementAt(i);
+					if (connectionToEdit.getConnectionType().equals(connectionType))
+						return i;
+				}
+			}
+		}
+		return 0;
+	}
+	
+	private Collection<IConnectionType> getConnectionTypes() {
+		Collection<IConnectionType> connectionTypes = getValidConnectionTypes();
+		IService serviceToRestrict = settingsWizard.getServiceToRestrict();
+		if (serviceToRestrict != null) {
+			List<IConnectionType> restrictedConnectionTypes = new ArrayList<IConnectionType>();
+			Collection<String> compatibleConnectionTypeIds = 
+				Registry.instance().getCompatibleConnectionTypeIds(serviceToRestrict);
+			for (String connectionTypeId : compatibleConnectionTypeIds) {
+				IConnectionType connectionType = 
+					Registry.instance().getConnectionType(connectionTypeId);
+				if (connectionTypes.contains(connectionType))
+					restrictedConnectionTypes.add(connectionType);
+			}
+			return restrictedConnectionTypes;
+		}
+		
+		return connectionTypes;
+	}
+
+	private String getInitialNameText() {
+		IConnection connectionToEdit = settingsWizard.getConnectionToEdit();
+		if (connectionToEdit != null)
+			return connectionToEdit.getDisplayName();
+		
+		long i = 1;
+		while (true) {
+			String name = MessageFormat.format(INITIAL_NAME_FMT, new Object[] { Long.toString(i++) });
+			if (isNameUnique(name))
+				return name;
+		}
+	}
+
+	private String getServicesString(IConnectionType connectionType) {
+		StringBuilder servicesString = new StringBuilder();
+		Collection<IService> services = 
+			Registry.instance().getCompatibleServices(connectionType);
+		if (services == null || services.isEmpty())
+			return ""; //$NON-NLS-1$
+		for (Iterator<IService> iterator = services.iterator(); iterator.hasNext();) {
+			servicesString.append(iterator.next().getDisplayName());
+			if (iterator.hasNext())
+				servicesString.append(", "); //$NON-NLS-1$
+		}
+		
+		return MessageFormat.format(Messages.getString("ConnectionTypePage.SupportedServicesLabel"), new Object[] { servicesString.toString() }); //$NON-NLS-1$
+	}
+
+	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 = 
+		Registry.instance().getConnectionTypes();
+		Collection<IConnectionType> connectionTypes = new ArrayList<IConnectionType>();
+		for (IConnectionType connectionType : allConnectionTypes) {
+			if (!Registry.instance().getCompatibleServices(connectionType).isEmpty() ||
+					connectionType.equals(connectionTypeToEdit))
+				connectionTypes.add(connectionType);
+		}
+		return connectionTypes;
+	}
+
+	private boolean isNameUnique(String name) {
+		boolean inUse = Registry.instance().connectionNameInUse(name);
+		IConnection connectionToEdit = settingsWizard.getConnectionToEdit();
+		if (connectionToEdit != null && inUse)
+			inUse = !name.equals(connectionToEdit.getDisplayName());
+		
+		return !inUse;
+	}
+
+	private boolean validatePage() {
+		setErrorMessage(null);
+		String name = getName();
+		boolean isValid = isNameUnique(name);
+		if (!isValid) {
+			setErrorMessage(MessageFormat.format(Messages.getString("ConnectionTypePage.ConnectionNameInUseError"), new Object[] { name } )); //$NON-NLS-1$
+		}
+		
+		return isValid;
+	}
+	
 }
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java	Mon Apr 05 14:01:00 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/settings/ui/SettingsWizard.java	Tue Apr 06 15:10:31 2010 -0500
@@ -41,7 +41,6 @@
  */
 public class SettingsWizard extends Wizard {
 
-	private ConnectionTypePage connectionTypePage;
 	private ConnectionSettingsPage connectionSettingsPage;
 	private IConnection connectionToEdit;
 	private IService serviceToRestrict;
@@ -70,17 +69,12 @@
 
 	@Override
 	public void addPages() {
-		connectionTypePage = new ConnectionTypePage(this);
-		addPage(connectionTypePage);
 		connectionSettingsPage = new ConnectionSettingsPage(this);
 		addPage(connectionSettingsPage);
 	}
 	
     public IWizardPage getStartingPage() {
-    	if (connectionToEdit == null)
-    		return connectionTypePage;
-    	else
-    		return connectionSettingsPage;
+    	return connectionSettingsPage;
     }
     
     public IConnection getConnectionToEdit() {
@@ -96,15 +90,11 @@
 		return serviceToRestrict;		
 	}
 	
-	public IConnectionType getConnectionType() {
-		return connectionTypePage.getConnectionType();
-	}
-	
 	@Override
 	public boolean performFinish() {
-		String newName = connectionTypePage.getName();
+		String newName = connectionSettingsPage.getName();
 		Map<String, String> newSettings = connectionSettingsPage.getSettings();
-		IConnectionType newConnectionType = connectionTypePage.getConnectionType();
+		IConnectionType newConnectionType = connectionSettingsPage.getConnectionType();
 		if (connectionToEdit == null || !connectionToEdit.getConnectionType().equals(newConnectionType)) {
 			String id = null;
 			if (connectionToEdit != null) {