Community
Participate
Working Groups
Build Identifier: M20120208-0800 The javadoc of ISaveablePart says: "Workbench parts implement or adapt to this interface to participate in the enablement and execution of the <code>Save</code> and <code>Save As</code> actions." When a ViewPart implements ISaveablePart everything is well and property changes on dirty are recognized by the platform. But when the ViewPart doesn't implement ISaveablePart but adapts it, then the platform won't recognize changes on the dirty property any longer! SaveHandler and SaveAsHandler could handle the adaption of ISaveablePart through using AbstractSaveHandler#getSaveablePart(ExecutionEvent) which is aware of the possible adapter. But the class org.eclipse.ui.internal.handlers.DirtyStateTracker, which was introduced in 3.7 according to its javadoc, only checks for instanceof but not for adapters of ISaveablePart. Also org.eclipse.ui.internal.WorkbenchPartReference doesn't respect adapters in isDirty(). Reproducible: Always Steps to Reproduce: 1. Create RCP App with a view 2. Let the View adapt ISaveablePart which alwas returns true in isDirty() 3. Run application -> View is not dirty (If the same steps are followed but in step 2 implementing ISaveablePart instead of adapting and also returning true in isDirty() leads to dirty view)
See http://wiki.eclipse.org/Platform_UI/How_to_Contribute PW
New Gerrit change created: https://git.eclipse.org/r/41791
Gerrit change https://git.eclipse.org/r/41791 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=7464658bb4965909cb1936f93a0db6d25ed43e64
.
Created attachment 252868 [details] test project with two differently implemented views Seems that I've overlooked one place, see example. Both views must have "*" in view title if opened, but only one (old style) is dirty. The fix is trivial.
New Gerrit change created: https://git.eclipse.org/r/46720
Gerrit change https://git.eclipse.org/r/46720 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=2ba23f8d604a14aeebbfe27a133bd5ffd22ae2db
Verified with I20150429-1330
Never ending story. Just one step further next issue... !ENTRY org.eclipse.ui 4 0 2015-04-29 21:56:42.755 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.ClassCastException: test.View2 cannot be cast to org.eclipse.ui.ISaveablePart at org.eclipse.ui.internal.WorkbenchWindow$7.promptToSave(WorkbenchWindow.java:539) at org.eclipse.e4.ui.internal.workbench.PartServiceSaveHandler.save(PartServiceSaveHandler.java:44) at org.eclipse.ui.internal.WorkbenchWindow$7.save(WorkbenchWindow.java:593) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.savePart(PartServiceImpl.java:1342) at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.closePart(StackRenderer.java:1277)
New Gerrit change created: https://git.eclipse.org/r/46818
New Gerrit change created: https://git.eclipse.org/r/46821
Gerrit change https://git.eclipse.org/r/46818 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=d95758785ab9da9442f8c97c4d6fa18f16216b2f
Gerrit change https://git.eclipse.org/r/46821 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=2c055ba66e015157ff57957b9ece932a0b26622b
All fixes are now in I20150430-1445
Hi. It seems that this change has caused a regression for us (in Sirius, bug 470076). Not sure if it's a real regression or if we need to adapt our own code (and how?). Basically if we close Eclipse with a Sirius editor opened and dirty (and the Properties view open), since Mars WorkbenchPage.getDirtyWorkbenchParts() returns 2 parts: the editor itself (OK), and the PropertySheet, which is not an ISaveablePart, but can be adapted to one (the editor). Because our editor implements ISaveablePart2, in processSaveable2() we get our promptToSaveOnClose() called once for the editor, and, if the user answered "No", a second time via the PropertySheet, whose ISaveablePart2 is the same editor (still dirty as the user asked not to save). I believe this could be solved by changing this part of getDirtyWorkbenchParts (and getDirtyParts, and maybe others): ISaveablePart saveable = SaveableHelper.getSaveable(part); if (saveable != null) { if (saveable.isDirty()) { result.add(part); } } into: ISaveablePart saveable = SaveableHelper.getSaveable(part); if (saveable != null && !result.contains(saveable)) { if (saveable.isDirty()) { result.add(part); } } This would avoid to add a saveable virtually twice (or more): once for itself and once for each other part which proxies to it as its ISaveablePart.
Yes - I concur with Pierre. This fix has introduced a regression. When we have an editor (that implements ISaveablePart) opened that is dirty, and the Properties View (which is showing some properties for the open editor) and then try to close the RCP application - a save is prompted for the editor as well as the Properties view, which does not look correct. This might have to be fixed.
Please re-open this. The regression is killing my RCP application. My app is getting prompted to save the Properties View - not a sensible proposition!
(In reply to Phil Beauvoir from comment #20) > Please re-open this. See bug 495567.