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.11
diff -u -r1.11 IWorkbenchConfigurer.java
--- Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java 25 Feb 2005 20:52:36 -0000 1.11
+++ Eclipse UI/org/eclipse/ui/application/IWorkbenchConfigurer.java 23 Mar 2005 19:40:11 -0000
@@ -13,6 +13,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.window.WindowManager;
+import org.eclipse.ui.IMemento;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
@@ -36,7 +37,7 @@
* could not be restored, but that startup should continue
* with a reset state.
*
- * @see #restoreState
+ * @see #restoreState()
*/
public static final int RESTORE_CODE_RESET = 1;
@@ -75,6 +76,23 @@
* false
to forget current workbench state on close.
*/
public void setSaveAndRestore(boolean enabled);
+
+ /**
+ * Saves the current state of the workbench using the
+ * specified memento.
+ *
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the save was successful
+ */
+ public IStatus saveSate(IMemento memento);
+
+ /**
+ * Restores the Workbench state using the specified memento.
+ *
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the restore was successful
+ */
+ public IStatus restoreState(IMemento memento);
/**
* Returns the workbench window manager.
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 23 Mar 2005 19:40:11 -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,22 @@
* @return the page composite, suitable for laying out in the parent
*/
public Control createPageComposite(Composite parent);
+
+ /**
+ * Saves the state of the WorkbenchWindow
using
+ * the specified memento.
+ *
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the save was successful
+ */
+ public IStatus saveState(IMemento memento);
+
+ /**
+ * Restores the state of the WorkbenchWindow
using
+ * the specified memento.
+ *
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the restore was successful
+ */
+ public IStatus restoreState(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 23 Mar 2005 19:40:12 -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;
@@ -740,6 +741,34 @@
*/
public Control createEmptyWindowContents(IWorkbenchWindowConfigurer configurer, Composite parent) {
return null;
+ }
+
+ /**
+ * Saves the state of the workbench using the specified memento.
+ *
+ * The default implementation of this uses IWorkbenchConfigurer.saveState
.
+ * Subclasses may override.
+ *
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the save was successful
+ */
+ public IStatus saveState(IMemento memento) {
+ // default behavior
+ return getWorkbenchConfigurer().saveSate(memento);
+ }
+
+ /**
+ * Restores the state of the workbench using the specified memento.
+ *
+ * The default implementation of this uses IWorkbenchConfigurer.restoreState
.
+ * Subclasses may override.
+ *
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the restore was successful
+ */
+ public IStatus restoreState(IMemento memento) {
+ // default behavior
+ return getWorkbenchConfigurer().restoreState(memento);
}
}
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.3
diff -u -r1.3 WorkbenchWindowAdvisor.java
--- Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java 25 Feb 2005 20:52:36 -0000 1.3
+++ Eclipse UI/org/eclipse/ui/application/WorkbenchWindowAdvisor.java 23 Mar 2005 19:40:12 -0000
@@ -10,10 +10,13 @@
*******************************************************************************/
package org.eclipse.ui.application;
+import org.eclipse.core.runtime.IStatus;
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.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.internal.WorkbenchWindowConfigurer;
@@ -376,5 +379,34 @@
public void dispose() {
// do nothing.
}
-
+
+ /**
+ * Saves the state of the workbench window using the specified memento.
+ *
+ * The default implementation of this uses IWorkbenchWindowConfigurer.saveState
.
+ * Subclasses may override.
+ *
+ * @param window the window that is being saved
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the save was successful
+ */
+ public IStatus saveState (IWorkbenchWindow window, IMemento memento) {
+ // default behavior
+ return windowConfigurer.saveState(memento);
+ }
+
+ /**
+ * Restores the state of the workbench window using the specified memento.
+ *
+ * The default implementation of this uses IWorkbenchWindowConfigurer.restoreState
.
+ * Subclasses may override.
+ *
+ * @param window the window that is being restored
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the restore was successful
+ */
+ public IStatus restoreState (IWorkbenchWindow window, IMemento memento) {
+ // default behavior
+ return windowConfigurer.restoreState(memento);
+ }
}
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.318
diff -u -r1.318 Workbench.java
--- Eclipse UI/org/eclipse/ui/internal/Workbench.java 23 Mar 2005 16:42:47 -0000 1.318
+++ Eclipse UI/org/eclipse/ui/internal/Workbench.java 23 Mar 2005 19:40:14 -0000
@@ -1252,7 +1252,7 @@
}
// Restore the saved state
- IStatus restoreResult = restoreState(memento);
+ IStatus restoreResult = getAdvisor().restoreState(memento);
reader.close();
if (restoreResult.getSeverity() == IStatus.ERROR) {
ErrorDialog.openError(null,
@@ -1322,7 +1322,7 @@
private XMLMemento recordWorkbenchState() {
XMLMemento memento = XMLMemento
.createWriteRoot(IWorkbenchConstants.TAG_WORKBENCH);
- IStatus status = saveState(memento);
+ IStatus status = getAdvisor().saveState(memento);
if (status.getSeverity() != IStatus.OK) {
// don't use newWindow as parent because it has not yet been opened
// (bug 76724)
@@ -1344,7 +1344,7 @@
/*
* Restores the state of the previously saved workbench
*/
- private IStatus restoreState(IMemento memento) {
+ IStatus restoreState(IMemento memento) {
MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK,
WorkbenchMessages.Workbench_problemsRestoring, null);
@@ -1387,7 +1387,7 @@
// for any exception that might hose us before we get a chance to
// open it. If one occurs, remove the new window from the manager.
try {
- result.merge(newWindow.restoreState(childMem, null));
+ result.merge(newWindow.restoreState(childMem));
try {
newWindow.fireWindowRestored();
} catch (WorkbenchException e) {
@@ -1561,7 +1561,7 @@
/*
* Saves the current state of the workbench so it can be restored later on
*/
- private IStatus saveState(IMemento memento) {
+ IStatus saveState(IMemento memento) {
MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK,
WorkbenchMessages.Workbench_problemsSaving, null);
@@ -1574,7 +1574,7 @@
WorkbenchWindow window = (WorkbenchWindow) windows[nX];
IMemento childMem = memento
.createChild(IWorkbenchConstants.TAG_WINDOW);
- result.merge(window.saveState(childMem));
+ result.merge(window.recordState(childMem));
}
result.add(getEditorHistory().saveState(
memento.createChild(IWorkbenchConstants.TAG_MRU_LIST))); //$NON-NLS-1$
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.9
diff -u -r1.9 WorkbenchConfigurer.java
--- Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java 25 Feb 2005 20:52:13 -0000 1.9
+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchConfigurer.java 23 Mar 2005 19:40:14 -0000
@@ -16,6 +16,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.window.WindowManager;
+import org.eclipse.ui.IMemento;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
@@ -177,4 +178,18 @@
public void openFirstTimeWindow() {
((Workbench) getWorkbench()).openFirstTimeWindow();
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.application.IWorkbenchConfigurer#saveSate(org.eclipse.ui.IMemento)
+ */
+ public IStatus saveSate(IMemento memento) {
+ return ((Workbench) getWorkbench()).saveState(memento);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.application.IWorkbenchConfigurer#restoreState(org.eclipse.ui.IMemento)
+ */
+ public IStatus restoreState(IMemento memento) {
+ return ((Workbench) getWorkbench()).restoreState(memento);
+ }
}
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 23 Mar 2005 19:40:17 -0000
@@ -1373,6 +1373,16 @@
}
/**
+ * Restores the state of the workbench window using the specified memento.
+ *
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the restore was successful
+ */
+ IStatus restoreState(IMemento memento) {
+ return getWindowAdvisor().restoreState(this, memento);
+ }
+
+ /**
* @see IPersistable.
*/
public IStatus restoreState(IMemento memento,
@@ -2505,6 +2515,17 @@
return getWorkbenchImpl().getAdvisor();
}
+ /**
+ * Records the state of the workbench window using the
+ * specified memento.
+ *
+ * @param memento the storage area for object's state
+ * @return a status object indicating whether the record was successful
+ */
+ IStatus recordState(IMemento memento) {
+ return getWindowAdvisor().saveState(this, memento);
+ }
+
/**
* Returns the window advisor, creating a new one for this
* window if needed.
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 23 Mar 2005 19:40:17 -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,18 @@
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 window.saveState(memento);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.application.IWorkbenchWindowConfigurer#restoreState(org.eclipse.ui.IMemento)
+ */
+ public IStatus restoreState(IMemento memento) {
+ return window.restoreState(memento, null);
+ }
}