Project: Eclipse_Platform_UI
Bug 137527 [PresentationAPI] (regression) Implementors of StackPresentation now must implement save/restore state methods
Reported: 2006-04-19 12:13:44 | Status: resolved fixed

In previous releases it was okay not to implement the save/restore state methods for subclasses of StackPresentation. In recent builds, unexpected errors occur when restoring a perpsective from a previous run. Without code that looks like the following, no views are ever added to the StackPresentation on a restore event. public void restoreState(IPresentationSerializer serializer, IMemento savedState) { IMemento[] parts = savedState.getChildren(IWorkbenchConstants.TAG_PART); for (int idx = 0; idx < parts.length; idx++) { String id = parts[idx].getString(IWorkbenchConstants.TAG_ID); if (id != null) { IPresentablePart part = serializer.getPart(id); if (part != null) { addPart(part, null); } } } } public void saveState(IPresentationSerializer context, IMemento { TabItem[] items = tabFolder.getItems(); ArrayList parts = new ArrayList(3); for (int i=0; i<items.length; i++) { parts.add(getPartForTab(items[i])); } Iterator iter = parts.iterator(); while (iter.hasNext()) { IPresentablePart next = (IPresentablePart) iter.next(); IMemento childMem = memento .createChild(IWorkbenchConstants.TAG_PART); childMem.putString(IWorkbenchConstants.TAG_ID, context.getId(next)); } } We are fine with this change in behavior, we will update our presentation, however we should probably update the Javadoc.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartStack.java