PlatSim-related launch wizard changes: (1) Remember last connection created and offer this by default in the Select Connection dialog; (2) Immediately open New Connection dialog if debugging and no connections exist; (3) Split out SelectConnectionDialog; (4) Fix some wording in Select Connection dialog since this is not always an error situation.
authorEd Swartz <ed.swartz@nokia.com>
Fri, 23 Apr 2010 08:25:11 -0500
changeset 1265 f90f47d3882f
parent 1264 076ad3096576
child 1266 15644163b1a2
PlatSim-related launch wizard changes: (1) Remember last connection created and offer this by default in the Select Connection dialog; (2) Immediately open New Connection dialog if debugging and no connections exist; (3) Split out SelectConnectionDialog; (4) Fix some wording in Select Connection dialog since this is not always an error situation.
connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/SelectConnectionDialog.java
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceSection.java
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java
--- a/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF	Fri Apr 23 08:22:24 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/META-INF/MANIFEST.MF	Fri Apr 23 08:25:11 2010 -0500
@@ -21,7 +21,7 @@
  com.nokia.carbide.remoteconnections.interfaces,
  com.nokia.carbide.remoteconnections.internal.api,
  com.nokia.carbide.remoteconnections.internal.registry;x-friends:="com.nokia.carbide.remoteConnections.tests,com.nokia.carbide.tests.debug",
- com.nokia.carbide.remoteconnections.settings.ui;x-friends:="com.nokia.carbide.tests.debug"
+ com.nokia.carbide.remoteconnections.settings.ui;x-friends:="com.nokia.carbide.tests.debug,com.nokia.cdt.debug.launch"
 Bundle-ClassPath: .,
  lib/commons-codec-1.3.jar,
  lib/commons-httpclient-3.1.jar,
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Fri Apr 23 08:22:24 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Fri Apr 23 08:25:11 2010 -0500
@@ -41,14 +41,9 @@
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IMessageProvider;
 import org.eclipse.jface.dialogs.TitleAreaDialog;
 import org.eclipse.jface.viewers.IFilter;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
 
 import com.nokia.carbide.remoteconnections.Messages;
 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
@@ -63,13 +58,13 @@
 import com.nokia.carbide.remoteconnections.interfaces.IExtensionFilter;
 import com.nokia.carbide.remoteconnections.interfaces.IService;
 import com.nokia.carbide.remoteconnections.interfaces.AbstractConnection.ConnectionStatus;
-import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2.IListener;
 import com.nokia.carbide.remoteconnections.internal.api.IConnection2;
 import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus;
 import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatusChangedListener;
 import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus;
 import com.nokia.carbide.remoteconnections.internal.ui.ClientServiceSiteUI2;
 import com.nokia.carbide.remoteconnections.internal.ui.ConnectionUIUtils;
+import com.nokia.carbide.remoteconnections.internal.ui.SelectConnectionDialog;
 import com.nokia.carbide.remoteconnections.ui.ClientServiceSiteUI;
 import com.nokia.cpp.internal.api.utils.core.Check;
 import com.nokia.cpp.internal.api.utils.core.ListenerList;
@@ -93,6 +88,8 @@
 	// this is exposed to other clients inside this plugin but it is not public knowledge
 	public static final String CURRENT_CONNECTION_ID = RemoteConnectionsActivator.PLUGIN_ID + ".currentConnection"; //$NON-NLS-1$
 	
+	private static final String LAST_CONNECTION_ID = "last_connection_id"; //$NON-NLS-1$
+	
 	private static Registry instance = new Registry();
 	
 	private List<IExtensionFilter> extensionFilters;
@@ -335,6 +332,8 @@
 		connectionToConnectedServices.put(connection, connectedServices);
 		fireConnectionStoreChanged();
 		fireConnectionAdded(connection);
+		
+		setLastConnectionId(connection.getIdentifier());
 	}
 	
 	private void ensureUniqueId(IConnection connection) {
@@ -524,7 +523,7 @@
 			connectionHolder[0] = getCompatibleConnectionFromUser(service, storableIdHolder);
 			if (connectionHolder[0] == null) {
 				throw new CoreException(
-						Logging.newStatus(RemoteConnectionsActivator.getDefault(), IStatus.ERROR, 
+						Logging.newStatus(RemoteConnectionsActivator.getDefault(), IStatus.CANCEL, 
 								Messages.getString("Registry.NoCompatibleConnectionMsg"))); //$NON-NLS-1$
 			}
 			else if (wasCurrentConnection && !connectionHolder[0].getIdentifier().equals(CURRENT_CONNECTION_ID)) {
@@ -548,60 +547,11 @@
 		if (!WorkbenchUtils.isJUnitRunning()) {
 			Display.getDefault().syncExec(new Runnable() {
 				public void run() {
+					// First, see if any connections could possibly be selected.
+					// If not, immediately offer to create a new connection.
+					
 					final IClientServiceSiteUI2 ui = getClientSiteUI2(service);
-					final TitleAreaDialog dialog = new TitleAreaDialog(WorkbenchUtils.getSafeShell()) {
-						@Override
-						protected Control createDialogArea(Composite parent) {
-							final Composite c = (Composite) super.createDialogArea(parent);
-							ui.createComposite(c);
-							ui.addListener(new IListener() {
-								public void connectionSelected() {
-									updateStatus(ui.getSelectionStatus());
-								}
-
-							});
-							
-							return c;
-						}
-
-						private void updateStatus(IStatus selectionStatus) {
-							setTitle(Messages.getString("Registry.EnsureConnection.TitleLabel")); //$NON-NLS-1$
-							setMessage(Messages.getString("Registry.EnsureConnection.Description")); //$NON-NLS-1$
-							switch (selectionStatus.getSeverity()) {
-							case IStatus.ERROR:
-								setMessage(selectionStatus.getMessage(), IMessageProvider.ERROR);
-								getButton(IDialogConstants.OK_ID).setEnabled(false);
-								break;
-							case IStatus.WARNING:
-								setMessage(selectionStatus.getMessage(), IMessageProvider.WARNING);
-								getButton(IDialogConstants.OK_ID).setEnabled(true);
-								break;
-							case IStatus.INFO:
-								setMessage(selectionStatus.getMessage(), IMessageProvider.INFORMATION);
-								getButton(IDialogConstants.OK_ID).setEnabled(true);
-								break;
-							default:
-								getButton(IDialogConstants.OK_ID).setEnabled(true);
-							}
-						}
-						
-						@Override
-						public void create() {
-							super.create();
-							updateStatus(ui.getSelectionStatus());
-						}
-						
-						@Override
-						protected void configureShell(Shell newShell) {
-							super.configureShell(newShell);
-							newShell.setText(Messages.getString("Registry.EnsureConnection.DialogTitle")); //$NON-NLS-1$
-						}
-						
-						@Override
-						protected boolean isResizable() {
-							return true;
-						}
-					};
+					final TitleAreaDialog dialog = new SelectConnectionDialog(WorkbenchUtils.getSafeShell(), ui);
 					dialog.setBlockOnOpen(true);
 					if (dialog.open() == Dialog.OK) {
 						storableIdHolder[0] = ui.getSelectedConnection();
@@ -700,4 +650,25 @@
 		
 		return false;
 	}
+
+	/**
+	 * Internal method:  get the last id of a connection created or selected in UI.  
+	 * Used to prepopulate UI for selecting connections.
+	 * @return connection id (not "current") or <code>null</code>
+	 */
+	public String getLastConnectionId() {
+		return RemoteConnectionsActivator.getDefault().getPreferenceStore().getString(LAST_CONNECTION_ID);
+	}
+	
+	/**
+	 * Internal method:  remember the last id of a connection created or selected in UI.  
+	 * @param id connection id.  Current connection is converted to an actual connection id.
+	 */
+	public void setLastConnectionId(String id) {
+		if (CURRENT_CONNECTION_ID.equals(id)) 
+			id = currentConnection != null ? currentConnection.getIdentifier() : null;
+		if (id == null) 
+			return;
+		RemoteConnectionsActivator.getDefault().getPreferenceStore().setValue(LAST_CONNECTION_ID, id);
+	}
 }
\ No newline at end of file
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java	Fri Apr 23 08:22:24 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java	Fri Apr 23 08:25:11 2010 -0500
@@ -223,8 +223,13 @@
 		else {
 			viewer.getCombo().setEnabled(true);
 			if (connection == null) {
-				viewer.getCombo().select(0);
-				viewer.setSelection(viewer.getSelection());
+				String lastConnectionId = Registry.instance().getLastConnectionId();
+				if (lastConnectionId != null) {
+					selectConnection(lastConnectionId);
+				} else {
+					viewer.getCombo().select(0);
+					viewer.setSelection(viewer.getSelection());
+				}
 			}
 			else
 				selectConnection(connection.getIdentifier());
@@ -304,6 +309,7 @@
 	}
 	
 	public String getSelectedConnection() {
+		Registry.instance().setLastConnectionId(connection);
 		return connection;
 	}
 	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/SelectConnectionDialog.java	Fri Apr 23 08:25:11 2010 -0500
@@ -0,0 +1,90 @@
+package com.nokia.carbide.remoteconnections.internal.ui;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.carbide.remoteconnections.Messages;
+import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager;
+import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2.IListener;
+
+/**
+ * Dialog for selecting a connection (via {@link IConnectionsManager#ensureConnection(String, com.nokia.carbide.remoteconnections.interfaces.IService)}.
+ */
+public class SelectConnectionDialog extends TitleAreaDialog {
+	/**
+	 * 
+	 */
+	private final IClientServiceSiteUI2 ui;
+
+	/**
+	 * @param parentShell
+	 * @param ui
+	 */
+	public SelectConnectionDialog(Shell parentShell,
+			IClientServiceSiteUI2 ui) {
+		super(parentShell);
+		this.ui = ui;
+	}
+
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		final Composite c = (Composite) super.createDialogArea(parent);
+		GridLayout layout = (GridLayout) c.getLayout();
+		layout.marginWidth = 6;
+		layout.marginHeight = 6;
+		ui.createComposite(c);
+		ui.addListener(new IListener() {
+			public void connectionSelected() {
+				updateStatus(ui.getSelectionStatus());
+			}
+
+		});
+		
+		return c;
+	}
+
+	private void updateStatus(IStatus selectionStatus) {
+		setTitle(Messages.getString("SelectConnectionDialog.TitleLabel")); //$NON-NLS-1$
+		setMessage(Messages.getString("SelectConnectionDialog.Description")); //$NON-NLS-1$
+		switch (selectionStatus.getSeverity()) {
+		case IStatus.ERROR:
+			setMessage(selectionStatus.getMessage(), IMessageProvider.ERROR);
+			getButton(IDialogConstants.OK_ID).setEnabled(false);
+			break;
+		case IStatus.WARNING:
+			setMessage(selectionStatus.getMessage(), IMessageProvider.WARNING);
+			getButton(IDialogConstants.OK_ID).setEnabled(true);
+			break;
+		case IStatus.INFO:
+			setMessage(selectionStatus.getMessage(), IMessageProvider.INFORMATION);
+			getButton(IDialogConstants.OK_ID).setEnabled(true);
+			break;
+		default:
+			getButton(IDialogConstants.OK_ID).setEnabled(true);
+		}
+	}
+
+	@Override
+	public void create() {
+		super.create();
+		updateStatus(ui.getSelectionStatus());
+	}
+
+	@Override
+	protected void configureShell(Shell newShell) {
+		super.configureShell(newShell);
+		newShell.setText(Messages.getString("SelectConnectionDialog.DialogTitle")); //$NON-NLS-1$
+	}
+
+	@Override
+	protected boolean isResizable() {
+		return true;
+	}
+}
\ No newline at end of file
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Fri Apr 23 08:22:24 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/messages.properties	Fri Apr 23 08:25:11 2010 -0500
@@ -121,9 +121,9 @@
 Registry.ConnectionStoreError=Could not store connections
 Registry.FilterExtensionLoadError=Could not load filter extensions
 Registry.ConnectionTypeExtensionLoadError=Could not load connection type extensions
-Registry.EnsureConnection.DialogTitle=Invalid Connection Stored
-Registry.EnsureConnection.TitleLabel=Select a connection to use
-Registry.EnsureConnection.Description=Select a connection, create a new one or attach a device
+SelectConnectionDialog.DialogTitle=Select Connection
+SelectConnectionDialog.TitleLabel=Select a connection to use
+SelectConnectionDialog.Description=Select a connection, create a new one or attach a device
 Registry.NoCompatibleConnectionMsg=No compatible connection found for this id
 Registry.ServiceExtensionLoadError=Could not load service extensions
 Registry.ServiceListUnknownConnectionTypeError=Service ''{0}'' lists unknown connection type ''{1}'' as compatible
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java	Fri Apr 23 08:22:24 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java	Fri Apr 23 08:25:11 2010 -0500
@@ -70,7 +70,6 @@
 /**
  *	This dialog allows in-depth configuration of the connection settings.
  */
-@SuppressWarnings("restriction")
 public class ConnectToDeviceDialog extends AbstractLaunchSettingsDialog implements IConnectionListener, IStatusChangedListener {
 	private IConnectionsManager manager;
 	private IConnectionTypeProvider typeProvider;
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceSection.java	Fri Apr 23 08:22:24 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceSection.java	Fri Apr 23 08:25:11 2010 -0500
@@ -1,137 +1,148 @@
-/*
-* Copyright (c) 2010 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.cdt.internal.debug.launch.newwizard;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
-import com.nokia.carbide.remoteconnections.interfaces.IConnection;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager;
-import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener;
-
-/**
- * Present the "Connect to device" section with a short description.
- */
-public class ConnectToDeviceSection extends AbstractLaunchWizardSection implements IConnectionListener {
-
-	private static final String NO_CURRENT_CONNECTION_MSG = Messages.getString("ConnectToDeviceSection.NoConnectionMsg"); //$NON-NLS-1$
-	private final IConnectionsManager manager;
-
-	/**
-	 * @param unifiedLaunchOptionsPage 
-	 * 
-	 */
-	public ConnectToDeviceSection(LaunchWizardData data, UnifiedLaunchOptionsPage launchOptionsPage) {
-		super(data, Messages.getString("ConnectToDeviceSection.Title"), launchOptionsPage); //$NON-NLS-1$
-		manager = RemoteConnectionsActivator.getConnectionsManager();
-	}
-	
-	public void createControl(Composite parent) {
-		createSection(parent, 0);
-		manager.addConnectionListener(this);
-	}
-	
-	@Override
-	protected void dispose() {
-		manager.removeConnectionListener(this);
-	}
-	
-	public void initializeSettings() {
-		data.setConnection(manager.getCurrentConnection());
-	}
-
-	@Override
-	protected void validate() {
-		status = revalidate(data);
-	}
-
-	/** Get the simple status for the connection state */
-	static IStatus revalidate(LaunchWizardData data) {
-		IStatus status = Status.OK_STATUS;
-		
-		if (data.getConnection() == null) {
-			status = error(NO_CURRENT_CONNECTION_MSG);
-		}
-		
-		return status;
-	}
-	
-	static String getStandardPNPMessage() {
-		return Messages.getString("ConnectToDeviceSection.StdPNPMsg"); //$NON-NLS-1$
-	}
-
-	@Override
-	protected void updateUI() {
-		if (control == null || control.isDisposed())
-			return;
-		
-		String msg;
-		if (data.getConnection() != null)
-			msg = MessageFormat.format(Messages.getString("ConnectToDeviceSection.CurrentConnectionLabel"), data.getConnectionName()); //$NON-NLS-1$
-		else
-			msg = MessageFormat.format("{0} {1}", NO_CURRENT_CONNECTION_MSG, getStandardPNPMessage()); //$NON-NLS-1$
-			
-		descriptionLabel.setText(msg);
-		launchOptionsPage.changed();
-	}
-	
-	@Override
-	protected AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchWizardData dialogData) {
-		return new ConnectToDeviceDialog(shell, dialogData);
-	}
-	
-	protected void refresh() {
-		Display.getDefault().syncExec(new Runnable() {
-			public void run() {
-				validate();
-				updateUI();
-			}
-		});
-	}
-	
-	private void doConnectionsChanged() {
-		data.setConnection(manager.getCurrentConnection());
-		refresh();
-	}
-	
-	public void connectionAdded(IConnection connection) {
-		doConnectionsChanged();
-	}
-	
-	public void connectionRemoved(IConnection connection) {
-		doConnectionsChanged();
-	}
-	
-	public void currentConnectionSet(IConnection connection) {
-		doConnectionsChanged();
-	}
-	
-	@Override
-	protected void doChange() {
-		super.doChange();
-		IConnection connection = data.getConnection();
-		if (connection != null && !connection.equals(manager.getCurrentConnection()))
-			manager.setCurrentConnection(connection);
-	}
-}
+/*
+* Copyright (c) 2010 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.cdt.internal.debug.launch.newwizard;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener;
+import com.nokia.carbide.remoteconnections.settings.ui.SettingsWizard;
+
+/**
+ * Present the "Connect to device" section with a short description.
+ */
+public class ConnectToDeviceSection extends AbstractLaunchWizardSection implements IConnectionListener {
+
+	private static final String NO_CURRENT_CONNECTION_MSG = Messages.getString("ConnectToDeviceSection.NoConnectionMsg"); //$NON-NLS-1$
+	private final IConnectionsManager manager;
+
+	/**
+	 * @param unifiedLaunchOptionsPage 
+	 * 
+	 */
+	public ConnectToDeviceSection(LaunchWizardData data, UnifiedLaunchOptionsPage launchOptionsPage) {
+		super(data, Messages.getString("ConnectToDeviceSection.Title"), launchOptionsPage); //$NON-NLS-1$
+		manager = RemoteConnectionsActivator.getConnectionsManager();
+	}
+	
+	public void createControl(Composite parent) {
+		createSection(parent, 0);
+		manager.addConnectionListener(this);
+	}
+	
+	@Override
+	protected void dispose() {
+		manager.removeConnectionListener(this);
+	}
+	
+	public void initializeSettings() {
+		data.setConnection(manager.getCurrentConnection());
+	}
+
+	@Override
+	protected void validate() {
+		status = revalidate(data);
+	}
+
+	/** Get the simple status for the connection state */
+	static IStatus revalidate(LaunchWizardData data) {
+		IStatus status = Status.OK_STATUS;
+		
+		if (data.getConnection() == null) {
+			status = error(NO_CURRENT_CONNECTION_MSG);
+		}
+		
+		return status;
+	}
+	
+	static String getStandardPNPMessage() {
+		return Messages.getString("ConnectToDeviceSection.StdPNPMsg"); //$NON-NLS-1$
+	}
+
+	@Override
+	protected void updateUI() {
+		if (control == null || control.isDisposed())
+			return;
+		
+		String msg;
+		if (data.getConnection() != null)
+			msg = MessageFormat.format(Messages.getString("ConnectToDeviceSection.CurrentConnectionLabel"), data.getConnectionName()); //$NON-NLS-1$
+		else
+			msg = MessageFormat.format("{0} {1}", NO_CURRENT_CONNECTION_MSG, getStandardPNPMessage()); //$NON-NLS-1$
+			
+		descriptionLabel.setText(msg);
+		launchOptionsPage.changed();
+	}
+	
+	@Override
+	protected AbstractLaunchSettingsDialog createChangeSettingsDialog(Shell shell, LaunchWizardData dialogData) {
+		return new ConnectToDeviceDialog(shell, dialogData);
+	}
+	
+	protected void refresh() {
+		Display.getDefault().syncExec(new Runnable() {
+			public void run() {
+				validate();
+				updateUI();
+			}
+		});
+	}
+	
+	private void doConnectionsChanged() {
+		data.setConnection(manager.getCurrentConnection());
+		refresh();
+	}
+	
+	public void connectionAdded(IConnection connection) {
+		doConnectionsChanged();
+	}
+	
+	public void connectionRemoved(IConnection connection) {
+		doConnectionsChanged();
+	}
+	
+	public void currentConnectionSet(IConnection connection) {
+		doConnectionsChanged();
+	}
+	
+	@Override
+	protected void doChange() {
+		// if no connections are available, immediately offer to create a connection
+		
+		if (manager.getConnections().isEmpty()) {
+			SettingsWizard wizard = new SettingsWizard(null, data.getService());
+			wizard.open(getControl().getShell());
+			IConnection newConnection = wizard.getConnectionToEdit();
+			data.setConnection(newConnection);
+		} else {
+			super.doChange();
+		}
+		
+		IConnection connection = data.getConnection();
+		if (connection != null && !connection.equals(manager.getCurrentConnection()))
+			manager.setCurrentConnection(connection);
+	}
+}
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java	Fri Apr 23 08:22:24 2010 -0500
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/UnifiedLaunchOptionsPage.java	Fri Apr 23 08:25:11 2010 -0500
@@ -45,8 +45,11 @@
  * allowing selecting different process to launch, and a button allowing more
  * in-depth configuration.
  * <p>
- * Build before debug: section with the build-before-debug preference for this
+ * Other settings: section with (currently only) the build-before-debug preference for this
  * launch configuration.
+ * <p>
+ * Each section is validated separately and editable with its own dialog.  Changes in
+ * the dialog are not applied until the dialog is accepted.
  */
 public class UnifiedLaunchOptionsPage extends WizardPage implements ISectionChangeListener {