Bug 476560 - saveState is not called for background perspective Views
Summary: saveState is not called for background perspective Views
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2015-09-03 10:00 EDT by Adrian Stefanescu CLA
Modified: 2020-06-11 03:14 EDT (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 Adrian Stefanescu CLA 2015-09-03 10:00:45 EDT
The saveState method is called only views in the active perspective. Views from the inactive perspective don't have their saveState called when the workbench shuts down.

You can debug(line 1242) the persist() method from Workbench. It gets only the reference for the active perspective views and only for this views it calls the save state.
Comment 1 Brian de Alwis CLA 2015-09-09 14:44:39 EDT
Do you think you could submit a patch?
Comment 2 Ad Mising name CLA 2018-01-12 09:43:38 EST
Found this problem still persists in Eclipse Neon.
Any plans for fixing  or workaround ?
Comment 3 Eclipse Genie CLA 2020-06-04 13:51:02 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.

--
The automated Eclipse Genie.
Comment 4 Adrian Stefanescu CLA 2020-06-11 03:14:04 EDT
The problem still exists. 

I tested with eclipse 2020-03 (4.15.0) and it's the same code as in 4.5. Only the views from the active perspective have the saveState method called.

If you open a view in a perspective then change to another perspective and close the application the saveState is not called. Only if the view is in the active perspective then the eclipse framework calls the saveState.

All the changes to the view are lost if the view is in a background perspective.

The problem is in WorkbenchPage.getViewReferences. It only lists views from the active perspective. It has the getViewReferences that can get all the open views but it's not used. Simply calling the getViewReferences to return the views from all perspectives would solve the problem.