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 10:39 Go to next message
Bastian Wagenfeld is currently offline Bastian Wagenfeld
Messages: 162
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 08:00 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 596
Registered: December 2010
Senior Member

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 08:06 Go to previous message
Sopot Cela is currently offline Sopot Cela
Messages: 596
Registered: December 2010
Senior Member

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: Fri Jul 25 12:13:33 EDT 2014

Powered by FUDForum. Page generated in 0.02323 seconds