Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 307319 - Saving view state within session on view close
Summary: Saving view state within session on view close
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-28 18:23 EDT by Prashant Deva CLA
Modified: 2019-01-04 05:18 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prashant Deva CLA 2010-03-28 18:23:30 EDT
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.
Comment 1 Paul Webster CLA 2010-03-29 09:48:51 EDT
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
Comment 2 Ralf Ebert CLA 2010-04-01 09:11:34 EDT
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?
Comment 3 Paul Webster CLA 2010-04-01 09:33:32 EDT
(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