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
/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.operation;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.ProgressMonitorWrapper;
import org.eclipse.jface.util.Assert;
import org.eclipse.swt.widgets.Display;
/**
 * Utility class for supporting modal operations.
 * The runnable passed to the <code>run</code> method is executed in a
 * separate thread, depending on the value of the passed fork argument. 
 * If the runnable is executed in a separate thread then the current thread
 * either waits until the new thread ends or, if the current thread is the 
 * UI thread, it polls the SWT event queue and dispatches each event.
 * <p>
 * This class is not intended to be subclassed.
 * </p>
 */
public class ModalContext {