This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 411465 - EditorPart#isSaveOnCloseNeeded() not called when closing Editor Part
Summary: EditorPart#isSaveOnCloseNeeded() not called when closing Editor Part
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.3.2   Edit
Assignee: Paul Elder CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-24 02:59 EDT by Phil Beauvoir CLA
Modified: 2013-11-29 10:26 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Beauvoir CLA 2013-06-24 02:59:50 EDT
(I was advised by PW in Bug #405562 to open a new bug report, so here it is.)

The behaviour is exactly as that described in Bug #3772992, this time caused by a regression introduced (I think) by the fix for Bug #405562.

A 3.8 based RCP app is running in E4 RC4. Build id: I20130605-2000 with the "compatibility" layer.

I have Editor parts that sub-class EditorPart. I over-ride isSaveOnCloseNeeded() to return false so that the "<resource> has been modified. Save changes?" dialog is *not* shown by the workbench if the editor is dirty and the user manually closes the editor part.

However, isSaveOnCloseNeeded() is not called and the dialog is shown.

This works when using Ctrl+W but not when clicking on the 'X'.
Comment 1 Phil Beauvoir CLA 2013-06-24 03:00:46 EDT
Correction: the original was Bug #372992.
Comment 2 Paul Webster CLA 2013-06-24 13:40:12 EDT
This seems to fail for the tab close because our Eclipse4 closePart->savePart lets the save run without considering that it was called from a close, and our org.eclipse.e4.ui.workbench.modeling.ISaveHandler (which is pluggable from the Workbench layer that knows about ISaveablePart) cuts the algorithm after the knowledge that this is a close has already been lost.

For the Workbench/3.x RCP case, solving Bug 396318 should fix this problem for tabs as well, as ClosePartHandler will go through the Workbench closeEditor(*) or hideView(*). Paul E, what do you think?

For views instead of editors, I've already released http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=f8df51502b1c801fd23198ad34123f0994633ce7

PW
Comment 3 Dani Megert CLA 2013-06-25 11:38:19 EDT
(In reply to comment #0)
> A 3.8 based RCP app is running in E4 RC4. Build id: I20130605-2000 with the
> "compatibility" layer.
> 
> I have Editor parts that sub-class EditorPart. I over-ride
> isSaveOnCloseNeeded() to return false so that the "<resource> has been
> modified. Save changes?" dialog is *not* shown by the workbench if the
> editor is dirty and the user manually closes the editor part.
> 
> However, isSaveOnCloseNeeded() is not called and the dialog is shown.
> 
> This works when using Ctrl+W but not when clicking on the 'X'.

The same is true for our own editors.
Comment 4 Paul Elder CLA 2013-11-14 13:20:15 EST
Proposed fixed pushed to Gerrit (on master/4.4) for review:

https://git.eclipse.org/r/18398
Comment 6 Paul Elder CLA 2013-11-29 10:26:12 EST
Verified in build 4.3.0.M20131127-1300