org.eclipse.core.runtime.jobs.ProgressProvider Java Examples
The following examples show how to use
org.eclipse.core.runtime.jobs.ProgressProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpdateDialog.java From offspring with MIT License | 5 votes |
private void scheduleJob() { updateJob = createUpdateJob(); Job.getJobManager().setProgressProvider(new ProgressProvider() { @Override public IProgressMonitor createMonitor(Job job) { return monitor; } }); updateJob.schedule(); }
Example #2
Source File: Shutdown.java From offspring with MIT License | 4 votes |
public static boolean execute(Shell shell, IEventBroker broker, UISynchronize sync, final INxtService nxt, final IDataProviderPool pool) { if (!MessageDialog.openConfirm(shell, "Shutdown Offspring", "Are you sure you want to shutdown Offspring?")) { return false; } final StartupDialog dialog = new StartupDialog(shell, sync); dialog.setBlockOnOpen(true); dialog.showOKButton(false); dialog.create(); Job startupJob = new Job("Startup Job") { volatile boolean DONE = false; @Override protected IStatus run(final IProgressMonitor monitor) { Thread cancelThread = new Thread(new Runnable() { @Override public void run() { while (!DONE) { try { Thread.sleep(500); if (monitor.isCanceled()) { System.exit(-1); return; } } catch (InterruptedException e) { return; } } } }); cancelThread.start(); try { monitor.beginTask("Shutting down dataprovider pools", IProgressMonitor.UNKNOWN); pool.destroy(); monitor.setTaskName("Shutting down NXT"); nxt.shutdown(); monitor.done(); } finally { DONE = true; } return Status.OK_STATUS; } }; Job.getJobManager().setProgressProvider(new ProgressProvider() { @Override public IProgressMonitor createMonitor(Job job) { return dialog.getProgressMonitor(); } }); startupJob.schedule(); dialog.open(); // // // BusyIndicator.showWhile(shell.getDisplay(), new Runnable() { // // @Override // public void run() { // nxt.shutdown(); // pool.destroy(); // } // }); return true; }