/*
* Saves the current state of the workbench so it can be restored later on
*/
private IStatus saveState(IMemento memento) {
MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK,
WorkbenchMessages.Workbench_problemsSaving, null);
// Save the version number.
memento.putString(IWorkbenchConstants.TAG_VERSION, VERSION_STRING[1]);
// Save how many plug-ins were loaded while restoring the workbench
if (progressCount != -1) {
memento.putInteger(IWorkbenchConstants.TAG_PROGRESS_COUNT,
progressCount);
}
// Save the advisor state.
IMemento advisorState = memento
.createChild(IWorkbenchConstants.TAG_WORKBENCH_ADVISOR);
result.add(getAdvisor().saveState(advisorState));
// Save the workbench windows.
IWorkbenchWindow[] windows = getWorkbenchWindows();
for (int nX = 0; nX < windows.length; nX++) {
WorkbenchWindow window = (WorkbenchWindow) windows[nX];
IMemento childMem = memento
.createChild(IWorkbenchConstants.TAG_WINDOW);
result.merge(window.saveState(childMem));
}
result.add(getEditorHistory().saveState(
memento.createChild(IWorkbenchConstants.TAG_MRU_LIST)));
return result;
}