Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Shared editing domains and dispose
Shared editing domains and dispose [message #1039144] Thu, 11 April 2013 20:17 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
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 #1039606 is a reply to message #1039144] Fri, 12 April 2013 10:50 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hallvard,

good point. I added the check to the master branch (Gerrit change
https://git.eclipse.org/r/#/c/11848/).

Just in case you're interested: feel free to propose such changes in Gerrit.

Thanks for pointing out,
Michael
Re: Shared editing domains and dispose [message #1039973 is a reply to message #1039606] Fri, 12 April 2013 22:04 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 12.04.13 03.50, Michael Wenz wrote:
>
> good point. I added the check to the master branch (Gerrit change
> https://git.eclipse.org/r/#/c/11848/).

It looked good to me :-) If it's enough is another question.

> Just in case you're interested: feel free to propose such changes in
> Gerrit.

Hm, I'll have to take a closer look at that.

As I explained, my use case is a multi page editor. Perhaps the generic
parts of it could be integrated into Graphiti itself?

Hallvard
Re: Shared editing domains and dispose [message #1042512 is a reply to message #1039973] Tue, 16 April 2013 14:20 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
"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
Previous Topic:Zooming in and out
Next Topic:Problems using our own Meta-Model
Goto Forum:
  


Current Time: Tue Mar 19 08:13:27 GMT 2024

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

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

Back to the top