/** * This implementation of IRunnableContext#run(boolean, boolean, * IRunnableWithProgress) runs the given <code>IRunnableWithProgress</code> * using the progress monitor for this progress dialog and blocks until the * runnable has been run, regardless of the value of <code>fork</code>. * The dialog is opened before the runnable is run, and closed after it * completes. It is recommended that <code>fork</code> is set to true in * most cases. If <code>fork</code> is set to <code>false</code>, the * runnable will run in the UI thread and it is the runnable's * responsibility to call <code>Display.readAndDispatch()</code> to ensure * UI responsiveness. */ @Override public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException { setCancelable(cancelable); try { aboutToRun(); // Let the progress monitor know if they need to update in UI Thread progressMonitor.forked = fork; ModalContext.run(runnable, fork, getProgressMonitor(), getShell() .getDisplay()); } finally { finishedRun(); } }
/** * This implementation of IRunnableContext#run(boolean, boolean, * IRunnableWithProgress) runs the given <code>IRunnableWithProgress</code> * using the progress monitor for this progress dialog and blocks until the * runnable has been run, regardless of the value of <code>fork</code>. * The dialog is opened before the runnable is run, and closed after it * completes. It is recommended that <code>fork</code> is set to true in * most cases. If <code>fork</code> is set to <code>false</code>, the * runnable will run in the UI thread and it is the runnable's * responsibility to call <code>Display.readAndDispatch()</code> to ensure * UI responsiveness. */ @Override public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException { setCancelable(cancelable); try { aboutToRun(); // Let the progress monitor know if they need to update in UI Thread progressMonitor.forked = fork; ModalContext.run(runnable, fork, getProgressMonitor(), getShell() .getDisplay()); } finally { finishedRun(); } }
dialog.setCancelable(true); dialog.open(); final IProgressMonitor monitor = dialog.getProgressMonitor();
throws InvocationTargetException, InterruptedException setCancelable( cancelable ); if( isSwtMode() ) { try {