Index: Eclipse UI/org/eclipse/ui/application/ActionBarAdvisor.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/ActionBarAdvisor.java,v retrieving revision 1.3 diff -u -r1.3 ActionBarAdvisor.java --- Eclipse UI/org/eclipse/ui/application/ActionBarAdvisor.java 25 Feb 2005 20:52:36 -0000 1.3 +++ Eclipse UI/org/eclipse/ui/application/ActionBarAdvisor.java 28 Mar 2005 21:06:52 -0000 @@ -14,10 +14,13 @@ import java.util.Iterator; import java.util.Map; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.ICoolBarManager; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.ui.IMemento; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.ActionFactory; @@ -298,5 +301,29 @@ ((ActionFactory.IWorkbenchAction) action).dispose(); } } + + /** + * Saves arbitrary application specific state information. + * + * @param memento the storage area for object's state + * @return a status object indicating whether the save was successful + * @since 3.1 + */ + public IStatus saveState(IMemento memento) { + // do nothing + return Status.OK_STATUS; + } + + /** + * Restores arbitrary application specific state information. + * + * @param memento the storage area for object's state + * @return a status object indicating whether the restore was successful + * @since 3.1 + */ + public IStatus restoreState(IMemento memento) { + // do nothing + return Status.OK_STATUS; + } } Index: Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java,v retrieving revision 1.12 diff -u -r1.12 IWorkbenchConfigurer.java --- Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java 25 Mar 2005 22:59:01 -0000 1.12 +++ Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java 28 Mar 2005 21:06:52 -0000 @@ -77,17 +77,6 @@ * false to forget current workbench state on close. */ public void setSaveAndRestore(boolean enabled); - - /** - * Saves the current state of the specified workbench window - * using the specified memento. - * - * @param window the window to be recorded - * @param memento the storage area for object's state - * @return a status object indicating whether the save was successful - * @since 3.1 - */ - public IStatus recordWorkbenchWindowState(IWorkbenchWindow window, IMemento memento); /** * Restores a workbench window with state using the specified memento. Index: Eclipse UI/org/eclipse/ui/application/IWorkbenchWindowConfigurer.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/IWorkbenchWindowConfigurer.java,v retrieving revision 1.16 diff -u -r1.16 IWorkbenchWindowConfigurer.java --- Eclipse UI/org/eclipse/ui/application/IWorkbenchWindowConfigurer.java 25 Feb 2005 20:52:36 -0000 1.16 +++ Eclipse UI/org/eclipse/ui/application/IWorkbenchWindowConfigurer.java 28 Mar 2005 21:06:52 -0000 @@ -10,12 +10,14 @@ *******************************************************************************/ package org.eclipse.ui.application; +import org.eclipse.core.runtime.IStatus; import org.eclipse.swt.dnd.DropTargetListener; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.IMemento; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.presentations.AbstractPresentationFactory; @@ -393,4 +395,14 @@ * @return the page composite, suitable for laying out in the parent */ public Control createPageComposite(Composite parent); + + /** + * Saves the current state of the specified workbench window + * using the specified memento. + * + * @param memento the storage area for object's state + * @return a status object indicating whether the save was successful + * @since 3.1 + */ + public IStatus saveState(IMemento memento); } Index: Eclipse UI/org/eclipse/ui/application/WorkbenchAdvisor.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchAdvisor.java,v retrieving revision 1.30 diff -u -r1.30 WorkbenchAdvisor.java --- Eclipse UI/org/eclipse/ui/application/WorkbenchAdvisor.java 25 Feb 2005 20:52:36 -0000 1.30 +++ Eclipse UI/org/eclipse/ui/application/WorkbenchAdvisor.java 28 Mar 2005 21:06:52 -0000 @@ -18,6 +18,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IMemento; import org.eclipse.ui.IWorkbenchPreferenceConstants; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; @@ -741,5 +742,29 @@ public Control createEmptyWindowContents(IWorkbenchWindowConfigurer configurer, Composite parent) { return null; } + + /** + * Saves arbitrary application specific state information. + * + * @param memento the storage area for object's state + * @return a status object indicating whether the save was successful + * @since 3.1 + */ + public IStatus saveState(IMemento memento) { + // do nothing + return Status.OK_STATUS; + } + + /** + * Restores arbitrary application specific state information. + * + * @param memento the storage area for object's state + * @return a status object indicating whether the restore was successful + * @since 3.1 + */ + public IStatus restoreState(IMemento memento) { + // do nothing + return Status.OK_STATUS; + } } Index: Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java,v retrieving revision 1.4 diff -u -r1.4 WorkbenchWindowAdvisor.java --- Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java 25 Mar 2005 04:16:24 -0000 1.4 +++ Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java 28 Mar 2005 21:06:52 -0000 @@ -10,9 +10,12 @@ *******************************************************************************/ package org.eclipse.ui.application; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IMemento; import org.eclipse.ui.IWorkbenchPreferenceConstants; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.WorkbenchException; @@ -282,5 +285,28 @@ public void dispose() { // do nothing. } - + + /** + * Saves arbitrary application specific state information. + * + * @param memento the storage area for object's state + * @return a status object indicating whether the save was successful + * @since 3.1 + */ + public IStatus saveState(IMemento memento) { + // do nothing + return Status.OK_STATUS; + } + + /** + * Restores arbitrary application specific state information. + * + * @param memento the storage area for object's state + * @return a status object indicating whether the restore was successful + * @since 3.1 + */ + public IStatus restoreState(IMemento memento) { + // do nothing + return Status.OK_STATUS; + } } Index: Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java,v retrieving revision 1.61 diff -u -r1.61 IWorkbenchConstants.java --- Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 25 Mar 2005 22:15:19 -0000 1.61 +++ Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java 28 Mar 2005 21:06:52 -0000 @@ -132,6 +132,12 @@ public static final String TRUE = "true"; //$NON-NLS-1$ public static final String FALSE = "false"; //$NON-NLS-1$ + + public static final String TAG_WORKBENCH_ADVISOR = "workbenchAdvisor"; //$NON-NLS-1$ + + public static final String TAG_WORKBENCH_WINDOW_ADVISOR = "workbenchWindowAdvisor"; //$NON-NLS-1$ + + public static final String TAG_ACTIONBAR_ADVISOR = "actionBarAdvisor"; //$NON-NLS-1$ public static final String TAG_ID = "id"; //$NON-NLS-1$ Index: Eclipse UI/org/eclipse/ui/internal/Workbench.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java,v retrieving revision 1.320 diff -u -r1.320 Workbench.java --- Eclipse UI/org/eclipse/ui/internal/Workbench.java 25 Mar 2005 22:58:59 -0000 1.320 +++ Eclipse UI/org/eclipse/ui/internal/Workbench.java 28 Mar 2005 21:06:53 -0000 @@ -1370,6 +1370,13 @@ } finally { UIStats.end(UIStats.RESTORE_WORKBENCH, this, "MRUList"); //$NON-NLS-1$ } + + // Restore advisor state. + IMemento advisorState = memento + .getChild(IWorkbenchConstants.TAG_WORKBENCH_ADVISOR); + if (advisorState != null) + result.add(getAdvisor().restoreState(advisorState)); + // Get the child windows. IMemento[] children = memento .getChildren(IWorkbenchConstants.TAG_WINDOW); @@ -1578,6 +1585,11 @@ // Save the version number. memento.putString(IWorkbenchConstants.TAG_VERSION, VERSION_STRING[1]); + + // Save the advisor state. + IMemento advisorState = memento + .createChild(IWorkbenchConstants.TAG_WORKBENCH_ADVISOR); + result.add(getAdvisor().saveState(advisorState)); // Save the workbench windows. IWorkbenchWindow[] windows = getWorkbenchWindows(); Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java,v retrieving revision 1.10 diff -u -r1.10 WorkbenchConfigurer.java --- Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java 25 Mar 2005 22:59:00 -0000 1.10 +++ Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java 28 Mar 2005 21:06:53 -0000 @@ -181,13 +181,6 @@ } /* (non-Javadoc) - * @see org.eclipse.ui.application.IWorkbenchConfigurer#recordWorkbenchWindowState(org.eclipse.ui.IWorkbenchWindow, org.eclipse.ui.IMemento) - */ - public IStatus recordWorkbenchWindowState(IWorkbenchWindow window, IMemento memento) { - return ((WorkbenchWindow)window).saveState(memento); - } - - /* (non-Javadoc) * @see org.eclipse.ui.application.IWorkbenchConfigurer#restoreWorkbenchWindow(org.eclipse.ui.IMemento) */ public IWorkbenchWindow restoreWorkbenchWindow(IMemento memento) throws WorkbenchException { Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java,v retrieving revision 1.268 diff -u -r1.268 WorkbenchWindow.java --- Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 22 Mar 2005 21:04:50 -0000 1.268 +++ Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 28 Mar 2005 21:06:53 -0000 @@ -1383,6 +1383,18 @@ PlatformUI.PLUGIN_ID, IStatus.OK, WorkbenchMessages.WorkbenchWindow_problemsRestoringWindow, null); + + // Restore the window advisor state. + IMemento windowAdvisorState = memento.getChild( + IWorkbenchConstants.TAG_WORKBENCH_WINDOW_ADVISOR); + if (windowAdvisorState != null) + result.add(getWindowAdvisor().restoreState(windowAdvisorState)); + + // Restore actionbar advisor state. + IMemento actionBarAdvisorState = memento + .getChild(IWorkbenchConstants.TAG_ACTIONBAR_ADVISOR); + if (actionBarAdvisorState != null) + result.add(getActionBarAdvisor().restoreState(actionBarAdvisorState)); // Read window's bounds and state. Rectangle displayBounds = getShell().getDisplay().getBounds(); @@ -2139,6 +2151,17 @@ } } } + + // Save window advisor state. + IMemento windowAdvisorState = memento.createChild( + IWorkbenchConstants.TAG_WORKBENCH_WINDOW_ADVISOR); + result.add(getWindowAdvisor().saveState(windowAdvisorState)); + + // Save actionbar advisor state. + IMemento actionBarAdvisorState = memento + .createChild(IWorkbenchConstants.TAG_ACTIONBAR_ADVISOR); + result.add(getActionBarAdvisor().saveState(actionBarAdvisorState)); + return result; } Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java,v retrieving revision 1.29 diff -u -r1.29 WorkbenchWindowConfigurer.java --- Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java 25 Feb 2005 20:52:13 -0000 1.29 +++ Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java 28 Mar 2005 21:06:53 -0000 @@ -14,6 +14,7 @@ import java.util.HashMap; import java.util.Map; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.ICoolBarManager; @@ -29,6 +30,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IMemento; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.application.IActionBarConfigurer; @@ -600,4 +602,12 @@ public Control createPageComposite(Composite parent) { return window.createPageComposite(parent); } + + /* (non-Javadoc) + * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#saveState(org.eclipse.ui.IMemento) + */ + public IStatus saveState(IMemento memento) { + return ((WorkbenchWindow)window).saveState(memento); + } + }