use of org.eclipse.core.runtime.jobs.IJobManager in project che by eclipse.
the class RefactoringExecutionHelper method perform.
/**
* Must be called in the UI thread.<br>
* <strong>Use {@link #perform(boolean, boolean)} unless you know exactly what you are doing!</strong>
*
* @param fork if set, the operation will be forked
* @param forkChangeExecution if the change should not be executed in the UI thread: This may not work in any case
* @param cancelable if set, the operation will be cancelable
* @throws InterruptedException thrown when the operation is cancelled
* @throws InvocationTargetException thrown when the operation failed to execute
*/
public RefactoringStatus perform(boolean fork, boolean forkChangeExecution, boolean cancelable) throws InterruptedException, InvocationTargetException, CoreException {
// Assert.isTrue(Display.getCurrent() != null);
final IJobManager manager = Job.getJobManager();
final ISchedulingRule rule;
if (fRefactoring instanceof IScheduledRefactoring) {
rule = ((IScheduledRefactoring) fRefactoring).getSchedulingRule();
} else {
rule = ResourcesPlugin.getWorkspace().getRoot();
}
Operation op = null;
try {
try {
op = new Operation(fork, forkChangeExecution);
op.run(new NullProgressMonitor());
fPerformChangeOperation = op.fPerformChangeOperation;
// fRefactoring.setValidationContext(fParent);
if (op.fPerformChangeOperation != null) {
ResourcesPlugin.getWorkspace().run(op.fPerformChangeOperation, new NullProgressMonitor());
}
if (op.fPerformChangeOperation != null) {
RefactoringStatus validationStatus = op.fPerformChangeOperation.getValidationStatus();
if (validationStatus != null) /*&& validationStatus.hasFatalError()*/
{
// throw new InterruptedException();
return validationStatus;
}
}
} catch (OperationCanceledException e) {
if (op != null) {
if (op.allConditions != null) {
return op.allConditions;
}
}
throw new InterruptedException(e.getMessage());
} finally {
// saveHelper.triggerIncrementalBuild();
}
} finally {
// manager.endRule(rule);
fRefactoring.setValidationContext(null);
}
return new RefactoringStatus();
}
Aggregations