/** Reverses the actions of {@link JobDoneListener#scheduled(IJobChangeEvent)} */ @Override public void done(final IJobChangeEvent event) { if (event.getResult() == Status.OK_STATUS || event.getResult() == Status.CANCEL_STATUS) { UIJob refreshJob = new UIJob(REFRESH_STATISTICS_VIEW) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { Job job = event.getJob(); if (job instanceof ITreeJob) { final LongRunningJob<?> treeJob = (LongRunningJob<?>) job; LongRunningMethod<?> method = treeJob.getMethod(); final boolean expand = (method instanceof StatisticTreeJob) && ((StatisticTreeJob) method).isExpand(); runningJobs.remove(treeJob); final Parent calc = ((TreeJob) method).getCalculated(); calc.startCalculating(false); checkViews(); synchronized (views) { for (TreeViewer view : views) { view.refresh(calc); if (expand) { view.expandToLevel(calc, 1); } } } } return Status.OK_STATUS; } }; refreshJob.setPriority(Job.INTERACTIVE); refreshJob.schedule(); } }
/** * @param action * @param showInstalledJob * @param event */ private void updateContributedUI( final ShowContributedExtensionsJob showContributedJob, final IJobChangeEvent event) { if (event.getResult().isOK()) { // update exchange view List<ComponentExtension> extensions = showContributedJob.getfContributedExtensions(); ExchangeManager.getInstance().updateContributedExtensions(extensions); } }
/** * Update ui after job finished. * * @param action * @param job * @param event */ private void updateUI(final RefreshJob job, final IJobChangeEvent event) { // activate action again after job finished if (event.getResult().isOK()) { // update exchange view List<ComponentExtension> extensions = job.getAvailableExtensions(); ExchangeManager.getInstance().updateAvailableExtensions(extensions); } }
@Override public void done(final IJobChangeEvent event) { IStatus iStatus = event.getResult(); String message = iStatus.getMessage(); if (IStatus.OK != iStatus.getSeverity()) { log.log(Level.WARNING, "This action's status :" + message); } }