[0.9.1] Using Graphiti with external editing domain causes problem at clean up [message #1006267] |
Wed, 30 January 2013 10:57  |
Eclipse User |
|
|
|
Hello,
I'm using a graphiti editor as a page inside a multi-page editor. In order to have the undo command stack working properly with the rest of the editor, I provide my own editing domain to graphiti (by overriding the DefaultUpdateBehavior). This works fine, but I have the requirement that if a specific element in my own editor (on another page) is removed, then the graphiti page has to be removed as well. Unfortunately, by doing so, graphiti does some clean-up with the TransactionalEditingDomain causing my application to throw exceptions after that (I can't close nor save my editor anymore for instance).
After a bit of investigation I saw that in the dispose method of the DiagramEditor, there are thinkgs like this:
if (getEditDomain() != null && getEditDomain().getCommandStack() != null) {
getEditDomain().getCommandStack().removeCommandStackEventListener(gefCommandStackListener);
getEditDomain().getCommandStack().dispose();
}
I could override the dispose method but there are things which I can't access, e.g. this piece of code:
if (getConfigurationProvider() != null) {
getConfigurationProvider().dispose();
}
if (paletteBehaviour != null) {
paletteBehaviour.dispose();
}
markerBehavior.dispose();
Or even call the dispose method of the super class (GraphicalEditorWithFlyoutPalette) :
try {
super.dispose();
} catch (RuntimeException e) {
exc = e;
}
How can I properly dispose my editor without breaking the full editing domain in this case ?
|
|
|
|
|
Re: [0.9.1] Using Graphiti with external editing domain causes problem at clean up [message #1006406 is a reply to message #1006387] |
Thu, 31 January 2013 04:26  |
Eclipse User |
|
|
|
not sure, but don't you mingle two different concepts here?
Yes indeed you are right: I thought that the getEditDomain() method in DiagramEditor was returning my own domain model.
So I first tried to override the dispose method and things were working again. But the problem was not that this editing domain was cleaned, but rather the call to
DefaultUpdateBehavior behavior = getUpdateBehavior();
behavior.dispose();
which was disposing my own editing domain. So indeed, if I only override the dispose method of the update behavior, this fixes the problem too.
I didn't know that GEF also had its own editing domain.
So indeed, I don't need to override the dispose method of the DiagramEditor.
Thanks for the reply !
[Updated on: Thu, 31 January 2013 04:26] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 1.26456 seconds