Saving dirty parts in all perspectives [message #1027877] |
Wed, 27 March 2013 10:39  |
Eclipse User |
|
|
|
Hi,
I created an Eclipse 4 RCP that changes resources and therefore sets parts dirty (MDirtyable dirty; dirty.setDirty(true)). When I close the editor with non-saved parts, I'm asked to save those parts, or to discard them. But my RCP consists of several perspectives. So when I change a resource in a part in one perspective, then switch to another perspective and close the editor, I'm not asked to save unsaved contents.
Can I achieve a behavior to ask for unsaved resources, although I'm in another perspective? I could create such a behavior manually, but I'd rather use a common way.
Best regards
Bastian
|
|
|
|
Re: Saving dirty parts in all perspectives [message #1032763 is a reply to message #1032757] |
Wed, 03 April 2013 08:06  |
Eclipse User |
|
|
|
Ok the issue is that getDirtyParts does a find on the model with the flags OUTSIDE_PERSPECTIVE | IN_ACTIVE_PERSPECTIVE | IN_SHARED_AREA; which means that it does not save the parts in the other perspectives (IN_ANY_PERSPECTIVE flag, check out these flags on the EModelService). What you can do is override the ISaveHandler and do a find MParts with the IN_ANY_PERSPECTIVE flag and then do a EPartService#savePart on the result, or just move the "common" parts in the shared area.
The idea is that anything common to perspectives goes in the shared area, that's why the current behavior is this way.
|
|
|
Powered by
FUDForum. Page generated in 0.05314 seconds