Search in sources :

Example 1 with WorkbenchRunnableAdapter

use of org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter in project xtext-eclipse by eclipse.

the class RefactoringWizardOpenOperation_NonForking method checkInitialConditions.

/**
 * CHANGED to protected
 * CHANGED do not fork as we are keeping the resource lock.
 */
protected RefactoringStatus checkInitialConditions(Refactoring refactoring, Shell parent, String title, IRunnableContext context) throws InterruptedException {
    try {
        CheckConditionsOperation cco = new CheckConditionsOperation(refactoring, CheckConditionsOperation.INITIAL_CONDITONS);
        WorkbenchRunnableAdapter workbenchRunnableAdapter = new WorkbenchRunnableAdapter(cco, ResourcesPlugin.getWorkspace().getRoot());
        /* CHANGE: don't fork (or use busyCursorWhile) as this will cause a deadlock */
        if (context == null) {
            PlatformUI.getWorkbench().getProgressService().run(false, true, workbenchRunnableAdapter);
        } else if (context instanceof IProgressService) {
            ((IProgressService) context).run(false, true, workbenchRunnableAdapter);
        } else {
            context.run(false, true, workbenchRunnableAdapter);
        }
        return cco.getStatus();
    } catch (InvocationTargetException e) {
        ExceptionHandler.handle(e, parent, title, RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
        return RefactoringStatus.createFatalErrorStatus(RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
    }
}
Also used : IProgressService(org.eclipse.ui.progress.IProgressService) CheckConditionsOperation(org.eclipse.ltk.core.refactoring.CheckConditionsOperation) WorkbenchRunnableAdapter(org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 CheckConditionsOperation (org.eclipse.ltk.core.refactoring.CheckConditionsOperation)1 WorkbenchRunnableAdapter (org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter)1 IProgressService (org.eclipse.ui.progress.IProgressService)1