Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Auto update when domain model changes
Auto update when domain model changes [message #653571] Thu, 10 February 2011 10:09 Go to next message
Jos Warmer is currently offline Jos Warmer
Messages: 108
Registered: October 2010
Senior Member
As described in the documentation, setting the isAutoUpdateAtRuntime() in the feature provider to true will automatically update open diagrams. However, it does this only when the diagram is already dirty.

I need to update the diagram on domain model changes, even when the diagram is not dirty. This check is done in DomainModelChangeListener.

Looking further I tried to change the field "domainModelListener" in the DiagramEditor (actually in my own sibclass of it) to point to my own subclass of DomainModelChangeListener. However, the field is private, so I cannot possibly change it.

Is it possible to add the option to Graphiti to auto-update even when the editor is not dirty ?

Jos
Re: Auto update when domain model changes [message #653787 is a reply to message #653571] Fri, 11 February 2011 08:35 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1595
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Jos,

We didn't implement that mode because we thought that would be confusing for
the user; at some point in time while he works in another editor the diagram
gets dirty. But if you have a use case for that, others might have well.

For now you might implement your own DomainModelChangeListener that does the
same things as the standard ones but omits the check for the dirty editor.
You can do this by overriding both registerBOListener and
unregisterBOListener in DiagramEditorInternal.

In general it would make sense to add an additional mode to the editor,
something like isAutoUpdateAtRuntimeAllEditors. Would you open a bugzilla
for that request? Maybe you have also a better name for that method...

Michael
Re: Auto update when domain model changes [message #653813 is a reply to message #653787] Fri, 11 February 2011 11:20 Go to previous messageGo to next message
Jos Warmer is currently offline Jos Warmer
Messages: 108
Registered: October 2010
Senior Member
Michael,

That is exactly what I did. Works perfectly.

My use case is an editor where I automatically do the layout. I do not even store the diagram, it is generated whenever the users opens a model element. If the user drops anything from the palette, it is first added to the model repsoitory and then auto layout again.

I have sub-classed the DiagramEditor and redefined the method isDirty() to always return false to stop the editor from trying to save (as it isn't stored anyway). I have now also redefined registerBOListener and
unregisterBOListener.

Jos
Re: Auto update when domain model changes [message #655535 is a reply to message #653813] Mon, 21 February 2011 16:08 Go to previous messageGo to next message
Harald Stangl is currently offline Harald Stangl
Messages: 7
Registered: February 2011
Junior Member
Jos, could you give a brief description of how you realized this?

I'm also in the need of disabling dirty checking as in my case all changes are persisted instantly, but I could not figure out how to register my own subclass of DiagramEditor unfortunately.

Thanks, Harald
Re: Auto update when domain model changes [message #657559 is a reply to message #655535] Thu, 03 March 2011 09:46 Go to previous messageGo to next message
Thomas Raffelsieper is currently offline Thomas Raffelsieper
Messages: 1
Registered: March 2011
Junior Member
Hi Jos, hi Harald,

I got the same problem. I created my own DomainModelChangeListener, where I modified the resourceSetChanged(..) and run(...) to omit the dirty check. Furthermore I override registerBOListener() and unregisterBOListener in my own DiagramEditor. But now I'm stuck as I can't set domainModelListener to my own DomainModelChangeListener. How do I replace the original one there?

My use case is btw. that I want to have a CustomFeature which applies several modifications to the DomainModel, followed by an auto layout of the drawing.

Thanks, Thomas

[Updated on: Thu, 03 March 2011 10:04]

Report message to a moderator

Re: Auto update when domain model changes [message #657609 is a reply to message #657559] Thu, 03 March 2011 13:15 Go to previous message
Tim Kaiser is currently offline Tim Kaiser
Messages: 118
Registered: July 2009
Senior Member
Hi Thomas,

can you specify your use case (and especially the problems you observe) in
more detail?

There might be a solution without changing the listener mechanism..

Best, Tim
Previous Topic:Graphiti API
Next Topic:Reflecting Connection source/target change from diagram to business objects
Goto Forum:
  


Current Time: Fri Sep 19 19:54:52 GMT 2014

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

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