mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
[189272] exception when canceling ssh connect
This commit is contained in:
parent
6f97d36fad
commit
4fef3aa04c
2 changed files with 13 additions and 8 deletions
|
@ -13,6 +13,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
|
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
|
||||||
* Martin Oberhuber (Wind River) - [187115] force SystemMessageDialog always into Display thread
|
* 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;
|
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
|
* 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);
|
SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
|
||||||
msgDlg.setException(exc);
|
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.
|
* 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);
|
SystemMessage msg = getExceptionMessage(shell, exc);
|
||||||
if ((shell == null) && (Display.getCurrent()!=null))
|
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,
|
* When an exception occurs and you want to turn it into a SystemMessage,
|
||||||
* call this...
|
* 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);
|
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_OCCURRED);
|
||||||
msg.makeSubstitution(exc);
|
msg.makeSubstitution(exc);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
* 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;
|
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.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
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.ISchedulingRule;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
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)
|
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;
|
SystemMessage sysMsg = null;
|
||||||
if (exc instanceof SystemMessageException)
|
if (exc instanceof SystemMessageException)
|
||||||
{
|
{
|
||||||
|
@ -234,11 +242,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
||||||
sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED);
|
sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED);
|
||||||
sysMsg.makeSubstitution(excMsg);
|
sysMsg.makeSubstitution(excMsg);
|
||||||
|
|
||||||
|
SystemMessageDialog.displayErrorMessage(shell, sysMsg, exc);
|
||||||
SystemMessageDialog msgDlg = new SystemMessageDialog(shell, sysMsg);
|
|
||||||
msgDlg.setException(exc);
|
|
||||||
msgDlg.open();
|
|
||||||
//RSEUIPlugin.logError("Operation failed",exc); now done successfully in msgDlg.open()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue