debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/newwizard/ConnectToDeviceDialog.java
changeset 983 8b4ee73c530c
parent 981 77bc8173ce83
child 1061 ceac11190019
equal deleted inserted replaced
981:77bc8173ce83 983:8b4ee73c530c
   139 			@Override
   139 			@Override
   140 			public void widgetSelected(SelectionEvent e) {
   140 			public void widgetSelected(SelectionEvent e) {
   141 				SettingsWizard wizard = new SettingsWizard(null, data.getService());
   141 				SettingsWizard wizard = new SettingsWizard(null, data.getService());
   142 				wizard.open(composite.getShell());
   142 				wizard.open(composite.getShell());
   143 				IConnection connection = wizard.getConnectionToEdit();
   143 				IConnection connection = wizard.getConnectionToEdit();
   144 				// note: refresh ASAP so the selection will be valid; but endure a listener event
       
   145 				// which will redo this
       
   146 				refreshUI();
       
   147 				setViewerInput(connection);
   144 				setViewerInput(connection);
   148 			}
   145 			}
   149 		});
   146 		});
   150 		
   147 		
   151 		editButton = new Button(buttonGroup, SWT.PUSH);
   148 		editButton = new Button(buttonGroup, SWT.PUSH);
   240 		updateConnection(connection);
   237 		updateConnection(connection);
   241 		validate();
   238 		validate();
   242 	}
   239 	}
   243 	
   240 	
   244 	public void connectionAdded(IConnection connection) {
   241 	public void connectionAdded(IConnection connection) {
   245 		refreshUI();
   242 		refreshUI(null);
   246 	}
   243 	}
   247 
   244 
   248 	public void connectionRemoved(IConnection connection) {
   245 	public void connectionRemoved(IConnection connection) {
   249 		refreshUI();		
   246 		refreshUI(null);		
   250 	}
   247 	}
   251 
   248 
   252 	public void currentConnectionSet(IConnection connection) {
   249 	public void currentConnectionSet(IConnection connection) {
   253 		refreshUI();		
   250 		refreshUI(connection);
   254 	}
   251 	}
   255 
   252 
   256 	private Set<IConnectionType> getCompatibleConnectionTypes() {
   253 	private Set<IConnectionType> getCompatibleConnectionTypes() {
   257 		HashSet<IConnectionType> types = new HashSet<IConnectionType>();
   254 		HashSet<IConnectionType> types = new HashSet<IConnectionType>();
   258 		Collection<String> compatibleTypeIds =
   255 		Collection<String> compatibleTypeIds =
   299 	
   296 	
   300 	private IConnection getConnectionFromSelection(ISelection selection) {
   297 	private IConnection getConnectionFromSelection(ISelection selection) {
   301 		return (IConnection) ((IStructuredSelection) selection).getFirstElement();
   298 		return (IConnection) ((IStructuredSelection) selection).getFirstElement();
   302 	}
   299 	}
   303 
   300 
   304 	private void refreshUI() {
   301 	private void refreshUI(final IConnection connection) {
   305 		Display.getDefault().syncExec(new Runnable() {
   302 		Display.getDefault().syncExec(new Runnable() {
   306 			public void run() {
   303 			public void run() {
   307 				if (viewer != null && viewer.getContentProvider() != null) {
   304 				if (viewer != null && viewer.getContentProvider() != null) {
   308 					setViewerInput(getConnectionFromSelection(viewer.getSelection()));
   305 					IConnection connectionToSet = connection == null ? getConnectionFromSelection(viewer.getSelection()) : connection;
       
   306 					setViewerInput(connectionToSet);
   309 				}
   307 				}
   310 			}
   308 			}
   311 		});
   309 		});
   312 	}
   310 	}
   313 	
   311