Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Some questions about savable parts
Some questions about savable parts [message #661784] Sun, 27 March 2011 20:14 Go to next message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
Suppose I have a savable part that is closeable, i.e. something like an editor in eclipse. If this part is dirty and I try to close it, a pop-up dialog appears. I can deselect the part and press the ok-button. In this case the method annotated with @Persist is not invoked and the part is destroyed.

When I later quit the application the pop-up is displayed again, asking me again if I want to save that part. If I do not deselect it this time and press the ok-button, an exception is thrown, presumably because the framework tries to invoke the method annotated with @Persist on a part that does no longer exist.

To remedy the situation, one has to set MDirtyable.setDirty(false) before the part is destroyed. One may use a method annotated with @PreDestroy. In the contacts demo one may also use the method DetailsView.setSelection, the last time it is called.

I wonder why one has to setDirty(false) manually, i.e. why the framework could not do it.

Suppose the savable part can be opened multiple times on different inputs (something like an IEditorInput). When I try to open a file in the eclipse ide that is already displayed in an editor, the ide will not open a new editor but set the focus on the editor that is already open. The method IEditorInput.equals is used to check that.

The e4 framework does not seem to have this functionality, i.e. it seems I have to implement it by hand. I.e. before I try to create and show an MPart for an MPartDescriptor using the EPartService, the client code needs to check whether another MPart for the same MPartDescriptor is already present with the same input. Is this correct, or is there some framework functionality I don't know about yet?
Re: Some questions about savable parts [message #661894 is a reply to message #661784] Mon, 28 March 2011 13:15 Go to previous message
Remy Suen is currently offline Remy SuenFriend
Messages: 462
Registered: July 2009
Senior Member
Karl Weber wrote on Sun, 27 March 2011 16:14
Suppose I have a savable part that is closeable, i.e. something like an editor in eclipse. If this part is dirty and I try to close it, a pop-up dialog appears. I can deselect the part and press the ok-button. In this case the method annotated with @Persist is not invoked and the part is destroyed.

When I later quit the application the pop-up is displayed again, asking me again if I want to save that part. If I do not deselect it this time and press the ok-button, an exception is thrown, presumably because the framework tries to invoke the method annotated with @Persist on a part that does no longer exist.
This is most certainly a bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=341096

Quote:
To remedy the situation, one has to set MDirtyable.setDirty(false) before the part is destroyed. One may use a method annotated with @PreDestroy. In the contacts demo one may also use the method DetailsView.setSelection, the last time it is called.

I wonder why one has to setDirty(false) manually, i.e. why the framework could not do it.
This is open to debate in my opinion.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=341099

Quote:
Suppose the savable part can be opened multiple times on different inputs (something like an IEditorInput). When I try to open a file in the eclipse ide that is already displayed in an editor, the ide will not open a new editor but set the focus on the editor that is already open. The method IEditorInput.equals is used to check that.
This is missing functionality.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=341100
Previous Topic:How to make the contacts demo more dynamic?
Next Topic:Unable to create class BindingProcessingAddon
Goto Forum:
  


Current Time: Wed Apr 24 16:10:27 GMT 2024

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

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

Back to the top