mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Merge "[306494] Prevent disconnect of wrong connection when handling SSH or TELNET connection loss"
This commit is contained in:
commit
122e20009a
2 changed files with 22 additions and 45 deletions
|
@ -319,17 +319,6 @@ public class SshConnectorService extends StandardConnectorService implements ISs
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Shell shell = getShell();
|
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
|
try
|
||||||
{
|
{
|
||||||
//TODO I think we should better use a Job for disconnecting?
|
//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();
|
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
||||||
sr.connectedStatusChange(_connection.getPrimarySubSystem(), false, true, true);
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
SystemBasePlugin.logError(SshConnectorResources.SshConnectorService_ErrorDisconnecting, 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)
|
public void run(IProgressMonitor monitor)
|
||||||
|
|
|
@ -370,17 +370,6 @@ public class TelnetConnectorService extends StandardConnectorService implements
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
Shell shell = getShell();
|
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 {
|
try {
|
||||||
// TODO I think we should better use a Job for disconnecting?
|
// TODO I think we should better use a Job for disconnecting?
|
||||||
// But what about error messages?
|
// But what about error messages?
|
||||||
|
@ -394,21 +383,20 @@ public class TelnetConnectorService extends StandardConnectorService implements
|
||||||
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
||||||
sr.connectedStatusChange(_connection.getPrimarySubSystem(),
|
sr.connectedStatusChange(_connection.getPrimarySubSystem(),
|
||||||
false, true, true);
|
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) {
|
} catch (Exception e) {
|
||||||
SystemBasePlugin.logError(TelnetConnectorResources.TelnetConnectorService_ErrorDisconnecting, 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)
|
public void run(IProgressMonitor monitor)
|
||||||
|
|
Loading…
Add table
Reference in a new issue