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

[189272] exception when canceling ssh connect

This commit is contained in:
Martin Oberhuber 2007-05-30 16:08:46 +00:00
parent 6f97d36fad
commit 4fef3aa04c
2 changed files with 13 additions and 8 deletions

View file

@ -13,6 +13,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
* Martin Oberhuber (Wind River) - [187115] force SystemMessageDialog always into Display thread
* Martin Oberhuber (Wind River) - [189272] exception when canceling ssh connect
********************************************************************************/
package org.eclipse.rse.ui.messages;
@ -629,7 +630,7 @@ public class SystemMessageDialog extends ErrorDialog implements Listener {
/**
* For ease of use for simple messages which are the result of an exception
*/
public static void displayErrorMessage(Shell shell, SystemMessage msg, Exception exc)
public static void displayErrorMessage(Shell shell, SystemMessage msg, Throwable exc)
{
SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
msgDlg.setException(exc);
@ -723,7 +724,7 @@ public class SystemMessageDialog extends ErrorDialog implements Listener {
/**
* For displaying a generic error message when an unexpected exception happens.
*/
public static void displayExceptionMessage(Shell shell, Exception exc)
public static void displayExceptionMessage(Shell shell, Throwable exc)
{
SystemMessage msg = getExceptionMessage(shell, exc);
if ((shell == null) && (Display.getCurrent()!=null))
@ -738,7 +739,7 @@ public class SystemMessageDialog extends ErrorDialog implements Listener {
* When an exception occurs and you want to turn it into a SystemMessage,
* call this...
*/
public static SystemMessage getExceptionMessage(Shell shell, Exception exc)
public static SystemMessage getExceptionMessage(Shell shell, Throwable exc)
{
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_OCCURRED);
msg.makeSubstitution(exc);

View file

@ -13,6 +13,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [189272] exception when canceling ssh connect
********************************************************************************/
package org.eclipse.rse.ui.operations;
@ -21,6 +22,7 @@ import java.net.URL;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
@ -220,6 +222,12 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
protected void showOperationErrorMessage(Shell shell, Throwable exc, SubSystem ss)
{
if (exc instanceof InvocationTargetException) {
exc = ((InvocationTargetException)exc).getTargetException();
}
if (exc instanceof OperationCanceledException) {
return; //don't log or display user cancellation
}
SystemMessage sysMsg = null;
if (exc instanceof SystemMessageException)
{
@ -234,11 +242,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED);
sysMsg.makeSubstitution(excMsg);
SystemMessageDialog msgDlg = new SystemMessageDialog(shell, sysMsg);
msgDlg.setException(exc);
msgDlg.open();
//RSEUIPlugin.logError("Operation failed",exc); now done successfully in msgDlg.open()
SystemMessageDialog.displayErrorMessage(shell, sysMsg, exc);
}
}