// save the workspace
final MultiStatus status = new MultiStatus(
IDEWorkbenchPlugin.IDE_WORKBENCH, 1,
IDEWorkbenchMessages.ProblemSavingWorkbench, null);
try {
final ProgressMonitorJobsDialog p = new CancelableProgressMonitorJobsDialog(
null);
final boolean applyPolicy = ResourcesPlugin.getWorkspace()
.getDescription().isApplyFileStatePolicy();
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
try {
if (applyPolicy)
monitor = new CancelableProgressMonitorWrapper(
monitor, p);
status.merge(((Workspace) ResourcesPlugin
.getWorkspace()).save(true, true, monitor));
} catch (CoreException e) {
status.merge(e.getStatus());
}
}
};
p.run(true, false, runnable);
} catch (InvocationTargetException e) {
status
.merge(new Status(IStatus.ERROR,
IDEWorkbenchPlugin.IDE_WORKBENCH, 1,
IDEWorkbenchMessages.InternalError, e