return false;
}
try {
// Save isn't cancelable.
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription description = workspace.getDescription();
boolean autoBuild = description.isAutoBuilding();
description.setAutoBuilding(false);
workspace.setDescription(description);
try {
if (fSaveMode == SAVE_ALL_ALWAYS_ASK || fSaveMode == SAVE_ALL
|| RefactoringSavePreferences.getSaveAllEditors()) {
if (!JavaPlugin.getActiveWorkbenchWindow().getWorkbench()
.saveAllEditors(false)) {
return false;
}
}
else {
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor pm)
throws InterruptedException {
int count = dirtyEditors.length;
pm.beginTask("", count); //$NON-NLS-1$
for (int i = 0; i < count; i++) {
IEditorPart editor = dirtyEditors[i];
editor.doSave(new SubProgressMonitor(pm, 1));
if (pm.isCanceled()) {
throw new InterruptedException();
}
}
pm.done();
}
};
try {
PlatformUI.getWorkbench().getProgressService().runInUI(
JavaPlugin.getActiveWorkbenchWindow(),
runnable, null);
}
catch (InterruptedException e) {
return false;
}
catch (InvocationTargetException e) {
ExceptionHandler
.handle(
e,
shell,
RefactoringMessages.RefactoringStarter_saving,
RefactoringMessages.RefactoringStarter_unexpected_exception);
return false;
}
}
fFilesSaved = true;
}
finally {
description.setAutoBuilding(autoBuild);
workspace.setDescription(description);
}
return true;
}
catch (CoreException e) {