* org.eclipse.core.runtime.jobs.ISchedulingRule)
*/
public void runInUI(final IRunnableContext context,
final IRunnableWithProgress runnable, final ISchedulingRule rule)
throws InvocationTargetException, InterruptedException {
final IJobManager manager = Job.getJobManager();
final InvocationTargetException[] exception = new InvocationTargetException[1];
final InterruptedException[] canceled = new InterruptedException[1];
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
try {
manager.beginRule(rule,
((Workbench) PlatformUI.getWorkbench())
.isStarting() ? new NullProgressMonitor()
: getEventLoopMonitor());
context.run(false, false, runnable);
} catch (InvocationTargetException e) {
exception[0] = e;
} catch (InterruptedException e) {
canceled[0] = e;
} catch (OperationCanceledException e) {
canceled[0] = new InterruptedException(e.getMessage());
} finally {
manager.endRule(rule);
}
}
/**
* Get a progress monitor that forwards to an event loop monitor.