debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java
branchRCL_2_4
changeset 982 c848ffa5a500
parent 977 787669693166
child 1060 852f9f9927e6
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java	Wed Feb 17 12:52:01 2010 -0800
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java	Thu Feb 18 09:04:51 2010 -0600
@@ -141,9 +141,6 @@
 				SettingsWizard wizard = new SettingsWizard(null, data.getService());
 				wizard.open(composite.getShell());
 				IConnection connection = wizard.getConnectionToEdit();
-				// note: refresh ASAP so the selection will be valid; but endure a listener event
-				// which will redo this
-				refreshUI();
 				setViewerInput(connection);
 			}
 		});
@@ -242,15 +239,15 @@
 	}
 	
 	public void connectionAdded(IConnection connection) {
-		refreshUI();
+		refreshUI(null);
 	}
 
 	public void connectionRemoved(IConnection connection) {
-		refreshUI();		
+		refreshUI(null);		
 	}
 
 	public void currentConnectionSet(IConnection connection) {
-		refreshUI();		
+		refreshUI(connection);
 	}
 
 	private Set<IConnectionType> getCompatibleConnectionTypes() {
@@ -301,11 +298,12 @@
 		return (IConnection) ((IStructuredSelection) selection).getFirstElement();
 	}
 
-	private void refreshUI() {
+	private void refreshUI(final IConnection connection) {
 		Display.getDefault().syncExec(new Runnable() {
 			public void run() {
 				if (viewer != null && viewer.getContentProvider() != null) {
-					setViewerInput(getConnectionFromSelection(viewer.getSelection()));
+					IConnection connectionToSet = connection == null ? getConnectionFromSelection(viewer.getSelection()) : connection;
+					setViewerInput(connectionToSet);
 				}
 			}
 		});