Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Saving dirty parts in all perspectives
Saving dirty parts in all perspectives [message #1027877] Wed, 27 March 2013 14:39 Go to next message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
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 #1032757 is a reply to message #1027877] Wed, 03 April 2013 12:00 Go to previous messageGo to next message
Eclipse UserFriend
Does EPartService#getDirtyParts list your dirty parts in the other perspective? I'm not sure I understand the parts layout on your perspective but the save handler grabs the list of parts to save from the method above.
Re: Saving dirty parts in all perspectives [message #1032763 is a reply to message #1032757] Wed, 03 April 2013 12:06 Go to previous message
Eclipse UserFriend
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.
Previous Topic:performance problems with editor
Next Topic:VisibleWhen core expression not working for Menu
Goto Forum:
  


Current Time: Thu Apr 25 23:15:40 GMT 2024

Powered by FUDForum. Page generated in 0.03378 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top