Bug 576414 - dirty parts sometimes not shown for saving on application closing
Summary: dirty parts sometimes not shown for saving on application closing
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 4.17   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-10-04 02:34 EDT by Markus Seifert CLA
Modified: 2021-10-05 05:56 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 Markus Seifert CLA 2021-10-04 02:34:49 EDT
We have a problem with our Eclipse RCP application after we upgraded from Eclipse 4.5 to Eclipse 4.17 (2020-09). When closing our application the dirty parts are no longer handled in a (in our view) consistent way. It all depends on the fact if a dirty part is visible in the active perspective or not. Imagine the following scenarios with two dirty parts:

Scenario 1: Both dirty parts are visible when closing. When closing the application a dialog is shown to save both resources. That is the desired behaviour.

Scenario 2: Only one dirty part is visible then closing. When closing the application a dialog is shown to save the visible dirty part. When you save now, the application is closed and the changes of the non-visible part is lost. In this case the same dialog as in scenario 1 should be shown, since there are 2 dirty parts and not only one.

Scenario 3: Both dirty parts are not visible when closing and no other dirty parts are visible. Just like in scenario 1 a dialog to save both resources is shown.

When taking a look at the code, in Workbench.saveAllParts() the dirty parts are indirectly determined using the EPartService-instance. PartServiceImpl.getParts() determines the Parts using the searchFlags 'EModelService.OUTSIDE_PERSPECTIVE | EModelService.IN_ACTIVE_PERSPECTIVE | EModelService.IN_SHARED_AREA'. So it looks like dirty parts, that are not visible right at this moment, are ignored. I wrote some code that uses EModelService.ANYWHERE instead as the searchFlags-value and in the resulting list all dirty parts are contained for all of the 3 scenarios. This also applies to the most current code I found in the git repository of Eclipse. So there shouldn't be a difference to a newer version that 4.17.
Comment 1 Andrey Loskutov CLA 2021-10-05 05:56:08 EDT
Probably related: bug 543442 changes.

If you have patch in mind, please provide gerrit.
See https://wiki.eclipse.org/Platform/How_to_Contribute