Set cachedIds = new HashSet();
Iterator ppIter = getPresentableParts().iterator();
while (ppIter.hasNext()) {
PresentablePart presPart = (PresentablePart) ppIter.next();
IMemento childMem = memento
.createChild(IWorkbenchConstants.TAG_PAGE);
PartPane part = presPart.getPane();
String tabText = part.getPartReference().getPartName();
childMem.putString(IWorkbenchConstants.TAG_LABEL, tabText);
childMem.putString(IWorkbenchConstants.TAG_CONTENT, presPart.getPane().getPlaceHolderId());
// Cache the id so we don't write it out later
cachedIds.add(presPart.getPane().getPlaceHolderId());
}
Iterator iter = children.iterator();
while (iter.hasNext()) {
LayoutPart next = (LayoutPart) iter.next();
PartPane part = null;
if (next instanceof PartPane) {
// Have we already written it out?
if (cachedIds.contains(((PartPane)next).getPlaceHolderId()))
continue;
part = (PartPane)next;
}
IMemento childMem = memento
.createChild(IWorkbenchConstants.TAG_PAGE);
String tabText = "LabelNotFound"; //$NON-NLS-1$
if (part != null) {
tabText = part.getPartReference().getPartName();
}
childMem.putString(IWorkbenchConstants.TAG_LABEL, tabText);
childMem.putString(IWorkbenchConstants.TAG_CONTENT, next
.getCompoundId());
}
IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
boolean useNewMinMax = preferenceStore.getBoolean(IWorkbenchPreferenceConstants.ENABLE_NEW_MIN_MAX);
if (useNewMinMax) {
memento.putInteger(IWorkbenchConstants.TAG_EXPANDED, presentationSite.getState());
}
else {
memento
.putInteger(
IWorkbenchConstants.TAG_EXPANDED,
(presentationSite.getState() == IStackPresentationSite.STATE_MINIMIZED) ? IStackPresentationSite.STATE_MINIMIZED
: IStackPresentationSite.STATE_RESTORED);
}
memento.putInteger(IWorkbenchConstants.TAG_APPEARANCE, appearance);
savePresentationState();
if (savedPresentationState != null) {
IMemento presentationState = memento
.createChild(IWorkbenchConstants.TAG_PRESENTATION);
presentationState.putMemento(savedPresentationState);
}
if (!properties.isEmpty()) {
IMemento propertiesState = memento.createChild(IWorkbenchConstants.TAG_PROPERTIES);
Set ids = properties.keySet();
for (Iterator iterator = ids.iterator(); iterator.hasNext();) {
String id = (String)iterator.next();
if (properties.get(id) == null) continue;
IMemento prop = propertiesState.createChild(IWorkbenchConstants.TAG_PROPERTY, id);
prop.putTextData((String)properties.get(id));
}
}
return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", null); //$NON-NLS-1$