Bug 287308 - [WorkbenchParts] Request public API to persist workbench state / editor stacks
Summary: [WorkbenchParts] Request public API to persist workbench state / editor stacks
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-21 11:02 EDT by Adam Neal CLA
Modified: 2019-09-06 15:37 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Neal CLA 2009-08-21 11:02:13 EDT
Build ID: 351I20090714

Steps To Reproduce:
Our product has a requirement to persist diagram editors such that we remember the layout and placement of the editor stack each diagram existed in.

The diagram editors we are persisting most likely will not implement the IPersistableEditor interface, and we do not have any control over this.

Also, the timing of when we need to create a memento of the editor layout is specific, it does not simply align with shut down and restart of the workbench.  Rather we need to grab a snap shot and restore it possibly multiple times throughout the workbench's lifetime.

In our case at least, we only care about persisting editors with a specific IEditorInput.

What I would like to request, is some public API, perhaps available on the workbench or the workbench page (?) that allows one to grab a snapshot/memento of the current layout of the workbench parts.

For example,

/* Each 'selected' workbench part will be added to the
 * memento such that its position in the workbench can
 * be later restored
 */
public IStatus saveState(IMemento memento, IPartSelector selector);

where:
interface IPartSelector {
  // Returns true if this part is interesting 
  // for the memento
  boolean shouldSavePart(IWorkbenchPart part);
}

/*
 * Extracts the workbench parts from the given memento and
 * will re-open them in the same layout as they were when
 * they were persisted.  
 *
 * @param forceRelocation
 *    <code>true</code> if already opened parts should be moved to the 
 *                      location specified in the memento
 *    <code>false</code> if already opened parts should not be moved
 *
 */
public IStatus restoreState(IMemento menento, boolean forceRelocation);

Note:  This is not the required API, just a suggestion...
Comment 1 Adam Neal CLA 2009-11-11 09:13:47 EST
Any chance of this enhancement being tackled for 3.6?
Comment 2 Eclipse Webmaster CLA 2019-09-06 15:37:56 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.