Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » autoupdate(autoupdate the diagram in case of changes in datamodel)
autoupdate [message #1067759] Wed, 10 July 2013 13:19 Go to next message
Juliane Mueller is currently offline Juliane Mueller
Messages: 30
Registered: August 2011
Member
Hi all,

I have an EMF Datamodel.
In case of changes in datamodel the method "updateneeded" is random called. Therefor I have a listener. This listener calls the method "update" in case of changes.
The method is called and I can define the differences. But if I want to add anything to the diagram an exception is thrown.

Has anyone an idea how I could autoupdate the diagram?

Here is my code:

In the listener:
UpdateContext updateContext = new UpdateContext(getDiagram().getChildren().get(0).getGraphicsAlgorithm().getPictogramElement());
IUpdateFeature updateFeature = getFeatureProvider().getUpdateFeature(updateContext);
updateFeature.update(updateContext);


and that's the exception:
!ENTRY org.eclipse.ui 4 0 2013-07-11 13:36:43.886 
!MESSAGE Unhandled event loop exception 
!STACK 0

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalStateException: Cannot modify resource set without a write transaction)

Caused by: java.lang.IllegalStateException: Cannot modify resource set without a write transaction at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.assertWriting

Regards, Juliane

[Updated on: Thu, 11 July 2013 12:05]

Report message to a moderator

Re: autoupdate [message #1068134 is a reply to message #1067759] Fri, 12 July 2013 10:50 Go to previous message
Michael Wenz is currently offline Michael Wenz
Messages: 1595
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Juliane,

there's a bunch of isAutoUpdateAt... methods in the diagram type provider
that you might override to control the update behavior of the editor. Have
you seen those? Implementing an update listener should not be necessary
here.

Michael
Previous Topic:Save exception - UnknownServiceException
Next Topic:updateNeeded preconditions
Goto Forum:
  


Current Time: Sun Sep 21 12:16:18 GMT 2014

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

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