# HG changeset patch # User Frank Benoit # Date 1207870907 -7200 # Node ID 25461c48a9bd5c05a6d9f5e9e4572663c838293c # Parent ea8ff534f622854b27b22a1c5d2d1c2380bebad7 some FIXME diff -r ea8ff534f622 -r 25461c48a9bd dwtx/core/runtime/SafeRunner.d --- 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); } } diff -r ea8ff534f622 -r 25461c48a9bd dwtx/jface/operation/AccumulatingProgressMonitor.d --- 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); } }); }