1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 430211 - Fix open failure if host is not known.

Change-Id: I6345d2068261f19751320315b26f1513e671b125
Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
Greg Watson 2014-06-02 17:14:44 -04:00
parent e9ea3eaa16
commit d2d6c71758

View file

@ -50,6 +50,7 @@ public class JSchUIConnectionManager extends AbstractRemoteUIConnectionManager {
}
}
@Override
public PasswordAuthentication prompt(String username, String message) {
if (prompter.promptPassword(message)) {
PasswordAuthentication auth = new PasswordAuthentication(username, prompter.getPassword().toCharArray());
@ -58,10 +59,12 @@ public class JSchUIConnectionManager extends AbstractRemoteUIConnectionManager {
return null;
}
@Override
public String[] prompt(String destination, String name, String message, String[] prompt, boolean[] echo) {
return prompter.promptKeyboardInteractive(destination, name, message, prompt, echo);
}
@Override
public int prompt(final int promptType, final String title, final String message, final int[] promptResponses,
final int defaultResponseIndex) {
final Display display = getDisplay();
@ -86,13 +89,14 @@ public class JSchUIConnectionManager extends AbstractRemoteUIConnectionManager {
}
display.syncExec(new Runnable() {
@Override
public void run() {
final MessageDialog dialog = new MessageDialog(new Shell(display), title, null /* title image */, message,
promptType, buttons, defaultResponseIndex);
retval[0] = dialog.open();
}
});
return retval[0];
return promptResponses[retval[0]];
}
}
@ -115,6 +119,7 @@ public class JSchUIConnectionManager extends AbstractRemoteUIConnectionManager {
*
* @see org.eclipse.remote.ui.IRemoteUIConnectionManager#getConnectionWizard(org.eclipse.swt.widgets.Shell)
*/
@Override
public IRemoteUIConnectionWizard getConnectionWizard(Shell shell) {
return new JSchConnectionWizard(shell, fConnMgr);
}
@ -123,6 +128,7 @@ public class JSchUIConnectionManager extends AbstractRemoteUIConnectionManager {
public void openConnectionWithProgress(Shell shell, IRunnableContext context, final IRemoteConnection connection) {
if (!connection.isOpen()) {
IRunnableWithProgress op = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
connection.open(new RemoteAuthenticator(connection), monitor);
@ -141,10 +147,12 @@ public class JSchUIConnectionManager extends AbstractRemoteUIConnectionManager {
new ProgressMonitorDialog(shell).run(true, true, op);
}
} catch (InvocationTargetException e) {
ErrorDialog.openError(shell, Messages.JSchUIConnectionManager_Connection_Error, Messages.JSchUIConnectionManager_Could_not_open_connection,
ErrorDialog.openError(shell, Messages.JSchUIConnectionManager_Connection_Error,
Messages.JSchUIConnectionManager_Could_not_open_connection,
new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), e.getCause().getMessage()));
} catch (InterruptedException e) {
ErrorDialog.openError(shell, Messages.JSchUIConnectionManager_Connection_Error, Messages.JSchUIConnectionManager_Could_not_open_connection,
ErrorDialog.openError(shell, Messages.JSchUIConnectionManager_Connection_Error,
Messages.JSchUIConnectionManager_Could_not_open_connection,
new Status(IStatus.ERROR, Activator.getUniqueIdentifier(), e.getMessage()));
}
}