1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 02:36:01 +02:00

Merge "[306494] Prevent disconnect of wrong connection when handling SSH or TELNET connection loss"

This commit is contained in:
Martin Oberhuber 2015-05-22 04:51:44 -04:00 committed by Gerrit Code Review @ Eclipse.org
commit 122e20009a
2 changed files with 22 additions and 45 deletions

View file

@ -319,17 +319,6 @@ public class SshConnectorService extends StandardConnectorService implements ISs
public void run()
{
Shell shell = getShell();
//TODO need a more correct message for "session lost"
//TODO allow users to reconnect from this dialog
//SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_UNKNOWNHOST);
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ICommonMessageIds.MSG_CONNECT_CANCELLED, IStatus.CANCEL,
NLS.bind(CommonMessages.MSG_CONNECT_CANCELLED,
_connection.getHost().getAliasName()));
SystemMessageDialog dialog = new SystemMessageDialog(getShell(), msg);
dialog.open();
try
{
//TODO I think we should better use a Job for disconnecting?
@ -342,21 +331,21 @@ public class SshConnectorService extends StandardConnectorService implements ISs
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
sr.connectedStatusChange(_connection.getPrimarySubSystem(), false, true, true);
}
catch (InterruptedException exc) // user cancelled
{
if (shell != null)
showDisconnectCancelledMessage(shell, _connection.getHostName(), _connection.getPort());
}
catch (java.lang.reflect.InvocationTargetException invokeExc) // unexpected error
{
Exception exc = (Exception)invokeExc.getTargetException();
if (shell != null)
showDisconnectErrorMessage(shell, _connection.getHostName(), _connection.getPort(), exc);
}
catch (Exception e)
{
SystemBasePlugin.logError(SshConnectorResources.SshConnectorService_ErrorDisconnecting, e);
}
//TODO need a more correct message for "session lost"
//TODO allow users to reconnect from this dialog
//SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_UNKNOWNHOST);
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ICommonMessageIds.MSG_CONNECT_CANCELLED, IStatus.CANCEL,
NLS.bind(CommonMessages.MSG_CONNECT_CANCELLED,
_connection.getHost().getAliasName()));
SystemMessageDialog dialog = new SystemMessageDialog(getShell(), msg);
dialog.open();
}
public void run(IProgressMonitor monitor)

View file

@ -370,17 +370,6 @@ public class TelnetConnectorService extends StandardConnectorService implements
public void run() {
Shell shell = getShell();
// TODO need a more correct message for "session lost"
// TODO allow users to reconnect from this dialog
// SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_UNKNOWNHOST);
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ICommonMessageIds.MSG_CONNECT_CANCELLED,
IStatus.CANCEL,
NLS.bind(CommonMessages.MSG_CONNECT_CANCELLED, _connection.getHost().getAliasName()));
SystemMessageDialog dialog = new SystemMessageDialog(getShell(), msg);
dialog.open();
try {
// TODO I think we should better use a Job for disconnecting?
// But what about error messages?
@ -394,21 +383,20 @@ public class TelnetConnectorService extends StandardConnectorService implements
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
sr.connectedStatusChange(_connection.getPrimarySubSystem(),
false, true, true);
} catch (InterruptedException exc) // user cancelled
{
if (shell != null)
showDisconnectCancelledMessage(shell, _connection
.getHostName(), _connection.getPort());
} catch (java.lang.reflect.InvocationTargetException invokeExc) // unexpected error
{
Exception exc = (Exception) invokeExc.getTargetException();
if (shell != null)
showDisconnectErrorMessage(shell,
_connection.getHostName(), _connection.getPort(),
exc);
} catch (Exception e) {
SystemBasePlugin.logError(TelnetConnectorResources.TelnetConnectorService_ErrorDisconnecting, e);
}
// TODO need a more correct message for "session lost"
// TODO allow users to reconnect from this dialog
// SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_UNKNOWNHOST);
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ICommonMessageIds.MSG_CONNECT_CANCELLED,
IStatus.CANCEL,
NLS.bind(CommonMessages.MSG_CONNECT_CANCELLED, _connection.getHost().getAliasName()));
SystemMessageDialog dialog = new SystemMessageDialog(getShell(), msg);
dialog.open();
}
public void run(IProgressMonitor monitor)