Bug 78222 [JFace] ModalContext event loop should guard against SWTExceptions
I was generating a patch and clicking Finish on the wizard would not close the wizard even though the patch was created succesfully. It turned out that the problem was that writing to the console caused an error due to word wrap being on. There are two problems here. There was no error message shown to the user and writing to the console should not cause a command to fail.
bundles/org.eclipse.jface/src/org/eclipse/jface/operation/ModalContext.java
* if (monitor.isCanceled())
     *    throw new InterruptedException();
     * </pre>
     * </p>
     *
     * @param monitor the progress monitor
     * @exception InterruptedException if cancelling the operation has been requested
     * @see IProgressMonitor#isCanceled()
     */
    public static void checkCanceled(IProgressMonitor monitor)
            throws InterruptedException {
        if (monitor.isCanceled())
            throw new InterruptedException();
    }
    /**
     * Returns the currently active modal context thread, or null if no modal context is active.
     */
    private static ModalContextThread getCurrentModalContextThread() {
        Thread t = Thread.currentThread();
        if (t instanceof ModalContextThread)
            return (ModalContextThread) t;
        return null;
    }
    /**
     * Returns the modal nesting level.
     * <p>
     * The modal nesting level increases by one each time the
     * <code>ModalContext.run</code> method is called within the
     * dynamic scope of another call to <code>ModalContext.run</code>.
     * </p>