public boolean performFinish() { if (resolvedOperation.getResolutionResult().getSeverity() != IStatus.ERROR) { ProgressMonitorDialog progress = new ProgressMonitorDialog(getShell()); try { progress.run( true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { getProvisioningUI() .schedule( resolvedOperation.getProvisioningJob(monitor), StatusManager.SHOW | StatusManager.LOG); } }); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } return true; } return false; }
private void showProgressDialog() { ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell()); try { dialog.run( true, true, new IRunnableWithProgress() { public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Counting from one to 20...", 20); for (int i = 1; !monitor.isCanceled() && i <= 20; i++) { monitor.worked(1); Thread.sleep(1000); } monitor.done(); } }); } catch (Exception e) { MessageDialog.openError(getShell(), "Error", e.getMessage()); } }