Source:
public IRemoteUIConnectionWizard getConnectionWizard(final Shell shell) { final TargetElement element = connMgr.newTargetElement("new"); final ITargetConfig config; try { config = element.getControl().getConfig(); } catch (CoreException e) { return null; } return new IRemoteUIConnectionWizard() { private String fName; private RemoteToolsConnectionWorkingCopy fConnection; public IRemoteConnectionWorkingCopy open() { final RemoteToolsConnectionWorkingCopy conn; if (fConnection == null) { try { conn = (RemoteToolsConnectionWorkingCopy) connMgr.newConnection(fName); for (String key : config.getAttributes().getAttributesAsMap().keySet()) { conn.setAttribute(key, config.getAttributes().getString(key)); } } catch (RemoteConnectionException e) { RemoteToolsAdapterUIPlugin.log(e); return null; } } else { conn = fConnection; } EnvironmentWizard wizard = new EnvironmentWizard(conn.getTargetElement()); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.setBlockOnOpen(true); if (dialog.open() == WizardDialog.OK) { setConnectionName(wizard.getConnectionName()); RemoteToolsConnectionWorkingCopy connFinal = null; try { connFinal = (RemoteToolsConnectionWorkingCopy) connMgr.newConnection(fName); } catch (RemoteConnectionException e) { RemoteToolsAdapterUIPlugin.log(e); return null; } Map<String, String> attr = conn.getAttributes(); for (String key : attr.keySet()) { connFinal.setAttribute(key, attr.get(key)); } return connFinal; } return null; } public void setInvalidConnectionNames(Set<String> names) { } public void setConnectionName(String name) { fName = name; } public void setConnection(IRemoteConnectionWorkingCopy connection) { if (connection instanceof RemoteToolsConnectionWorkingCopy) { fConnection = (RemoteToolsConnectionWorkingCopy) connection; } } }; }

Target:
public IRemoteUIConnectionWizard getConnectionWizard(final Shell shell) { final TargetElement element = connMgr.newTargetElement("new"); final ITargetConfig config; try { config = element.getControl().getConfig(); } catch (CoreException e) { return null; } return new IRemoteUIConnectionWizard() { private String fName; private RemoteToolsConnectionWorkingCopy fConnection; public IRemoteConnectionWorkingCopy open() { final RemoteToolsConnectionWorkingCopy conn; if (fConnection == null) { try { conn = (RemoteToolsConnectionWorkingCopy) connMgr.newConnection(fName); for (String key : config.getAttributes().getAttributesAsMap().keySet()) { conn.setAttribute(key, config.getAttributes().getString(key)); } } catch (RemoteConnectionException e) { RemoteToolsAdapterUIPlugin.log(e); return null; } } else { conn = fConnection; } EnvironmentWizard wizard = new EnvironmentWizard(conn.getTargetElement()); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.setBlockOnOpen(true); if (dialog.open() == WizardDialog.OK) { conn.setName(wizard.getName()); return conn; } return null; } public void setInvalidConnectionNames(Set<String> names) { } public void setConnectionName(String name) { fName = name; } public void setConnection(IRemoteConnectionWorkingCopy connection) { if (connection instanceof RemoteToolsConnectionWorkingCopy) { fConnection = (RemoteToolsConnectionWorkingCopy) connection; } } }; }