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 09: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 08:05]

Report message to a moderator

Re: autoupdate [message #1068134 is a reply to message #1067759] Fri, 12 July 2013 06:50 Go to previous message
Michael Wenz is currently offline Michael Wenz
Messages: 1577
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: Sat Aug 02 04:54:04 EDT 2014

Powered by FUDForum. Page generated in 0.03791 seconds