* Save the layout.
*/
public void saveDescAs(IPerspectiveDescriptor desc) {
PerspectiveDescriptor realDesc = (PerspectiveDescriptor) desc;
//get the layout from the registry
PerspectiveRegistry perspRegistry = (PerspectiveRegistry) WorkbenchPlugin
.getDefault().getPerspectiveRegistry();
// Capture the layout state.
XMLMemento memento = XMLMemento.createWriteRoot("perspective");//$NON-NLS-1$
IStatus status = saveState(memento, realDesc, false);
if (status.getSeverity() == IStatus.ERROR) {
ErrorDialog.openError((Shell) null, WorkbenchMessages.Perspective_problemSavingTitle,
WorkbenchMessages.Perspective_problemSavingMessage,
status);
return;
}
//save it to the preference store
try {
perspRegistry.saveCustomPersp(realDesc, memento);
descriptor = realDesc;
} catch (IOException e) {
perspRegistry.deletePerspective(realDesc);
MessageDialog.openError((Shell) null, WorkbenchMessages.Perspective_problemSavingTitle,
WorkbenchMessages.Perspective_problemSavingMessage);
}
}