Shared editing domains and dispose [message #1039144] |
Thu, 11 April 2013 16:17  |
Eclipse User |
|
|
|
Hi,
I've implemented a multi page graphiti editor, where each page is a
special subclass of DiagramEditor that takes care to share the editing
domain with the other DiagramEditors within the same multi page editor.
However, this gives problems when closing the editor, since the first
DiagramEditor's DefaultUpdateBehavior will dispose the editing domain
and when the following ones try, they throw a NPE. The problem is the
second line, where getOperationHistory() returns null.
In DefaultUpdateBehavior:
public void dispose() {
editingDomain.getResourceSet().eAdapters().remove(resourceSetUpdateAdapter);
resourceSetUpdateAdapter = null;
getOperationHistory().removeOperationHistoryListener(this);
for (Resource r : editingDomain.getResourceSet().getResources()) {
r.eAdapters().remove(updateAdapter);
}
EObject object = (EObject) diagramBehavior.getAdapter(Diagram.class);
if (object != null) {
object.eAdapters().remove(elementDeleteListener);
}
workspaceSynchronizer.dispose();
// Remove reference
disposeEditingDomain();
editingDomain = null;
}
Perhaps a test could be done first, to avoid calling
removeOperationHistoryListener when it's null?
Hallvard
|
|
|
|
|
Re: Shared editing domains and dispose [message #1042512 is a reply to message #1039973] |
Tue, 16 April 2013 10:20  |
Eclipse User |
|
|
|
"Hallvard Trætteberg" schrieb im Newsbeitrag
news:kka0d1$71p$1@xxxxxxxxe.org...
>As I explained, my use case is a multi page editor. Perhaps the generic
>parts of it could be integrated into Graphiti itself?
Hallvard,
I'm rather reluctant with adding more infrastructure around editors to the
framework at least for now, since you easily get GEF dependencies here. I'm
not sure yet where Graphiti will evolve to, currently there are options like
moving to GEF4 (as soon as it is out) or JavaFX as rendering engines. Fo
rboth options we will pile up more effort when we add stuff around the
editor.
But there is a small example on multi page editors in the Graphiti examples.
Have you seen that?
Michael
|
|
|
Powered by
FUDForum. Page generated in 0.07283 seconds