Mercurial > projects > dwt-addons
changeset 44:25461c48a9bd
some FIXME
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 11 Apr 2008 01:41:47 +0200 |
parents | ea8ff534f622 |
children | 076d0807c32a |
files | dwtx/core/runtime/SafeRunner.d dwtx/jface/operation/AccumulatingProgressMonitor.d |
diffstat | 2 files changed, 34 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/dwtx/core/runtime/SafeRunner.d Fri Apr 11 01:24:25 2008 +0200 +++ b/dwtx/core/runtime/SafeRunner.d Fri Apr 11 01:41:47 2008 +0200 @@ -12,6 +12,14 @@ *******************************************************************************/ module dwtx.core.runtime.SafeRunner; +import dwtx.core.runtime.OperationCanceledException; +import dwtx.core.runtime.MultiStatus; +import dwtx.core.runtime.IStatus; +import dwtx.core.runtime.Status; +import dwtx.core.runtime.CoreException; + +import dwtx.core.internal.runtime.IRuntimeConstants; + import dwtx.core.runtime.ISafeRunnable; import dwtx.core.runtime.Assert; @@ -41,36 +49,39 @@ code.run(); } catch (Exception e) { handleException(code, e); -//FIXME +// DWT not in D // } catch (LinkageError e) { // handleException(code, e); } } private static void handleException(ISafeRunnable code, Exception e) { -//FIXME -// if (!(e instanceof OperationCanceledException)) { -// // try to obtain the correct plug-in id for the bundle providing the safe runnable + if( null is cast(OperationCanceledException) e ){ + + // try to obtain the correct plug-in id for the bundle providing the safe runnable // Activator activator = Activator.getDefault(); -// String pluginId = null; + String pluginId = null; // if (activator !is null) // pluginId = activator.getBundleId(code); -// if (pluginId is null) -// pluginId = IRuntimeConstants.PI_COMMON; + if (pluginId is null) + pluginId = IRuntimeConstants.PI_COMMON; + + String message = null; // String message = NLS.bind(CommonMessages.meta_pluginProblems, pluginId); -// IStatus status; -// if (e instanceof CoreException) { -// status = new MultiStatus(pluginId, IRuntimeConstants.PLUGIN_ERROR, message, e); -// ((MultiStatus) status).merge(((CoreException) e).getStatus()); -// } else { -// status = new Status(IStatus.ERROR, pluginId, IRuntimeConstants.PLUGIN_ERROR, message, e); -// } -// // Make sure user sees the exception: if the log is empty, log the exceptions on stderr -// if (!RuntimeLog.isEmpty()) -// RuntimeLog.log(status); -// else -// e.printStackTrace(); -// } + IStatus status; + if ( auto ce = cast(CoreException) e ) { + status = new MultiStatus(pluginId, IRuntimeConstants.PLUGIN_ERROR, message, e); + (cast(MultiStatus) status).merge( ce.getStatus()); + } else { + status = new Status(IStatus.ERROR, pluginId, IRuntimeConstants.PLUGIN_ERROR, message, e); + } + // Make sure user sees the exception: if the log is empty, log the exceptions on stderr + //if (!RuntimeLog.isEmpty()) + // RuntimeLog.log(status); + //else + ExceptionPrintStackTrace(e); + } + code.handleException(e); } }
--- a/dwtx/jface/operation/AccumulatingProgressMonitor.d Fri Apr 11 01:24:25 2008 +0200 +++ b/dwtx/jface/operation/AccumulatingProgressMonitor.d Fri Apr 11 01:41:47 2008 +0200 @@ -19,8 +19,7 @@ import dwtx.core.runtime.IProgressMonitorWithBlocking; import dwtx.core.runtime.IStatus; import dwtx.core.runtime.ProgressMonitorWrapper; -//FIXME -// import dwtx.jface.dialogs.Dialog; +import dwtx.jface.dialogs.Dialog; import dwt.dwthelper.utils; import dwt.dwthelper.Runnable; @@ -237,8 +236,7 @@ */ public void run() { (cast(IProgressMonitorWithBlocking) pm_).clearBlocked(); -//FIXME -// Dialog.getBlockedHandler().clearBlocked(); + Dialog.getBlockedHandler().clearBlocked(); } }); } @@ -264,8 +262,7 @@ public void run() { (cast(IProgressMonitorWithBlocking) pm_).setBlocked(reason); //Do not give a shell as we want it to block until it opens. -//FIXME -// Dialog.getBlockedHandler().showBlocked(pm, reason, currentTask); + Dialog.getBlockedHandler().showBlocked(pm, reason, currentTask); } }); }