private void performUndo(final Change undo) { IWorkspaceRunnable runnable= new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { monitor.beginTask("", 11); //$NON-NLS-1$ try { undo.initializeValidationData(new NotCancelableProgressMonitor(new SubProgressMonitor(monitor, 1))); if (undo.isValid(new SubProgressMonitor(monitor,1)).hasFatalError()) { monitor.done(); return; } undo.perform(new SubProgressMonitor(monitor, 9)); } finally { undo.dispose(); } } }; WorkbenchRunnableAdapter adapter= new WorkbenchRunnableAdapter(runnable, ResourcesPlugin.getWorkspace().getRoot()); ProgressMonitorDialog dialog= new ProgressMonitorDialog(fParent); try { dialog.run(false, false, adapter); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, fParent, RefactoringMessages.ChangeExceptionHandler_undo_dialog_title, RefactoringMessages.ChangeExceptionHandler_undo_dialog_message + fName); } catch (InterruptedException e) { // can't happen } } }
protected IStatus run(IProgressMonitor monitor) { try { IWorkspaceRunnable runnable= new IWorkspaceRunnable() { public void run(IProgressMonitor pm) throws CoreException { updateClasspathEntries(oldLocations, pm); IPreferenceStore preferenceStore= PreferenceConstants.getPreferenceStore(); preferenceStore.setValue(PREF_JAVADOCLOCATIONS, ""); //$NON-NLS-1$ preferenceStore.setValue(PREF_JAVADOCLOCATIONS_MIGRATED, true); } }; new WorkbenchRunnableAdapter(runnable).run(monitor); } catch (InvocationTargetException e) { JavaPlugin.log(e); } catch (InterruptedException e) { // should not happen, cannot cancel } return Status.OK_STATUS; } };
@Override public void run(final IStructuredSelection selection) { IWorkspaceRunnable operation= new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { performRefresh(selection, monitor); } }; new WorkbenchRunnableAdapter(operation).runAsUserJob(ActionMessages.RefreshAction_refresh_operation_label, null); }
PerformChangeOperation op= RefactoringUI.createUIAwareChangeOperation(change); WorkbenchRunnableAdapter adapter= new WorkbenchRunnableAdapter(op); PlatformUI.getWorkbench().getProgressService().runInUI( new BusyIndicatorRunnableContext(), adapter, adapter.getSchedulingRule()); } catch (CoreException e) { ExceptionHandler.handle(e, getDialogTitle(), RefactoringMessages.SurroundWithTryCatchAction_exception);
@Override protected IStatus run(IProgressMonitor monitor) { try { WorkbenchRunnableAdapter.this.run(monitor); } catch (InvocationTargetException e) { Throwable cause= e.getCause(); if (cause instanceof CoreException) { return ((CoreException) cause).getStatus(); } else { return JavaUIStatus.createError(IStatus.ERROR, cause); } } catch (InterruptedException e) { return Status.CANCEL_STATUS; } finally { monitor.done(); } return Status.OK_STATUS; } @Override
PerformChangeOperation op= new PerformChangeOperation(change); WorkbenchRunnableAdapter adapter= new WorkbenchRunnableAdapter(op); PlatformUI.getWorkbench().getProgressService().runInUI( new BusyIndicatorRunnableContext(), adapter, adapter.getSchedulingRule());
@Override protected IStatus run(IProgressMonitor monitor) { try { WorkbenchRunnableAdapter.this.run(monitor); } catch (InvocationTargetException e) { Throwable cause= e.getCause(); if (cause instanceof CoreException) { return ((CoreException) cause).getStatus(); } else { return JavaUIStatus.createError(IStatus.ERROR, cause); } } catch (InterruptedException e) { return Status.CANCEL_STATUS; } finally { monitor.done(); } return Status.OK_STATUS; } @Override
WorkbenchRunnableAdapter adapter= new WorkbenchRunnableAdapter(runnable, ResourcesPlugin.getWorkspace().getRoot()); ProgressMonitorDialog dialog= new ProgressMonitorDialog(fParent);
@Override public void run(final IStructuredSelection selection) { IWorkspaceRunnable operation= new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException { performRefresh(selection, monitor); } }; new WorkbenchRunnableAdapter(operation).runAsUserJob(ActionMessages.RefreshAction_refresh_operation_label, null); }
PerformChangeOperation op= new PerformChangeOperation(change); WorkbenchRunnableAdapter adapter= new WorkbenchRunnableAdapter(op); PlatformUI.getWorkbench().getProgressService().runInUI( new BusyIndicatorRunnableContext(), adapter, adapter.getSchedulingRule());
@Override protected IStatus run(IProgressMonitor monitor) { try { IWorkspaceRunnable runnable= new IWorkspaceRunnable() { @Override public void run(IProgressMonitor pm) throws CoreException { updateClasspathEntries(oldLocations, pm); IPreferenceStore preferenceStore= PreferenceConstants.getPreferenceStore(); preferenceStore.setValue(PREF_JAVADOCLOCATIONS, ""); //$NON-NLS-1$ preferenceStore.setValue(PREF_JAVADOCLOCATIONS_MIGRATED, true); } }; new WorkbenchRunnableAdapter(runnable).run(monitor); } catch (InvocationTargetException e) { JavaPlugin.log(e); } catch (InterruptedException e) { // should not happen, cannot cancel } return Status.OK_STATUS; } };
protected IStatus run(IProgressMonitor monitor) { try { WorkbenchRunnableAdapter.this.run(monitor); } catch (InvocationTargetException e) { Throwable cause= e.getCause(); if (cause instanceof CoreException) { return ((CoreException) cause).getStatus(); } else { return JavaUIStatus.createError(IStatus.ERROR, cause); } } catch (InterruptedException e) { return Status.CANCEL_STATUS; } finally { monitor.done(); } return Status.OK_STATUS; } public boolean belongsTo(Object family) {
WorkbenchRunnableAdapter adapter= new WorkbenchRunnableAdapter(runnable, ResourcesPlugin.getWorkspace().getRoot()); ProgressMonitorDialog dialog= new ProgressMonitorDialog(fParent);
/** * @see org.eclipse.jface.preference.IPreferencePage#performOk() */ @Override public boolean performOk() { if (fIsValidElement && fIgnoreOptionalProblemsField.isSelected() != isIgnoringOptionalProblems()) { String newValue= fIgnoreOptionalProblemsField.isSelected() ? "true" : null; //$NON-NLS-1$ fElement.setAttribute(IClasspathAttribute.IGNORE_OPTIONAL_PROBLEMS, newValue); IWorkspaceRunnable runnable= getRunnable(getShell(), fProject, fElement.getClasspathEntry()); WorkbenchRunnableAdapter op= new WorkbenchRunnableAdapter(runnable); op.runAsUserJob(PreferencesMessages.BuildPathsPropertyPage_job_title, null); } return true; }
IRunnableWithProgress runnable= null; if (rule != null) runnable= new WorkbenchRunnableAdapter(op, rule, true); else runnable= new WorkbenchRunnableAdapter(op, ResourcesPlugin.getWorkspace().getRoot()); getContainer().run(false, true, runnable); } catch (InvocationTargetException e) {
/** * @see org.eclipse.jface.preference.IPreferencePage#performOk() */ @Override public boolean performOk() { if (fIsValidElement && fIgnoreOptionalProblemsField.isSelected() != isIgnoringOptionalProblems()) { String newValue= fIgnoreOptionalProblemsField.isSelected() ? "true" : null; //$NON-NLS-1$ fElement.setAttribute(IClasspathAttribute.IGNORE_OPTIONAL_PROBLEMS, newValue); IWorkspaceRunnable runnable= getRunnable(getShell(), fProject, fElement.getClasspathEntry()); WorkbenchRunnableAdapter op= new WorkbenchRunnableAdapter(runnable); op.runAsUserJob(PreferencesMessages.BuildPathsPropertyPage_job_title, null); } return true; }
IRunnableWithProgress runnable= null; if (rule != null) runnable= new WorkbenchRunnableAdapter(op, rule, true); else runnable= new WorkbenchRunnableAdapter(op, ResourcesPlugin.getWorkspace().getRoot()); getContainer().run(false, true, runnable); } catch (InvocationTargetException e) {
public boolean performOk() { if (fBuildPathsBlock != null) { getSettings().put(INDEX, fBuildPathsBlock.getPageIndex()); if (fBuildPathsBlock.hasChangesInDialog() || fBuildPathsBlock.isClassfileMissing()) { IWorkspaceRunnable runnable= new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException, OperationCanceledException { fBuildPathsBlock.configureJavaProject(monitor); } }; WorkbenchRunnableAdapter op= new WorkbenchRunnableAdapter(runnable); if (fBlockOnApply) { try { new ProgressMonitorDialog(getShell()).run(true, true, op); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), PreferencesMessages.BuildPathsPropertyPage_error_title, PreferencesMessages.BuildPathsPropertyPage_error_message); return false; } catch (InterruptedException e) { return false; } } else { op.runAsUserJob(PreferencesMessages.BuildPathsPropertyPage_job_title, null); } } } return true; }
IRunnableWithProgress runnable= null; if (rule != null) runnable= new WorkbenchRunnableAdapter(op, rule, true); else runnable= new WorkbenchRunnableAdapter(op, ResourcesPlugin.getWorkspace().getRoot()); getContainer().run(false, true, runnable); } catch (InvocationTargetException e) {
@Override public boolean performOk() { if (fBuildPathsBlock != null) { getSettings().put(INDEX, fBuildPathsBlock.getPageIndex()); if (fBuildPathsBlock.hasChangesInDialog() || fBuildPathsBlock.isClassfileMissing()) { IWorkspaceRunnable runnable= new IWorkspaceRunnable() { @Override public void run(IProgressMonitor monitor) throws CoreException, OperationCanceledException { fBuildPathsBlock.configureJavaProject(monitor); } }; WorkbenchRunnableAdapter op= new WorkbenchRunnableAdapter(runnable); if (fBlockOnApply) { try { new ProgressMonitorDialog(getShell()).run(true, true, op); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), PreferencesMessages.BuildPathsPropertyPage_error_title, PreferencesMessages.BuildPathsPropertyPage_error_message); return false; } catch (InterruptedException e) { return false; } } else { op.runAsUserJob(PreferencesMessages.BuildPathsPropertyPage_job_title, null); } } } return true; }