Community
Participate
Working Groups
Currently the 'saveState()' method in ViewPart is called only when the workbench is closed. However a lot of times you want to save the state of the view even when it is closed within a session and restore it when it is opened again, all without actually exiting the workbench. Currently views like DisplayView have to use hacks in the form of static fields to get around this issue. There needs to be api to support saving/restoring state when just the view is closed/opened and not need the entire workbench to open/close.
We don't offer API around this and won't be intoducing new lifecycle methods on 3.x stream. Currently, a view can save the same state or more state by using its plugin state location and XMLMemento (if the view wants to persist the exact same state in both the session restore and its own open/close lifecycle). in e4 a part can update its savedState properties at any time and they are persisted between open/close and over sessions. PW
Would it be possible to just call saveState/init whenever the view is opened/closed? Can you think of something that would go wrong if this would be handled that way?
(In reply to comment #2) > Would it be possible to just call saveState/init whenever the view is > opened/closed? Can you think of something that would go wrong if this would be > handled that way? No, that's the one thing we can't do. We only call those methods are shutdown on open views, and at startup when restoring views. We can't change the lifecycle by calling them on close/open within the running session, as consumers have been specifically told that's not what those methods do. PW