I have drawn a diagram automatically.
By a certain event the whole diagram should be repainted automatically with the new values.
I've tried this with the removeFeature and new AddFeatures. But there always come an exception that I can't modify a resource without a writing transaction.
I also tried to create a new diagram with the same URI as before, but if the diagram is open by the event, it is not refreshed.
Michael Wenz Messages: 1370 Registered: July 2009 Location: Walldorf, Germany
Senior Member
Juliane,
what do you mean with "repainted"?
Just an update of what the editor shows to the state the Graphiti model is
in? In that case calling refresh on the editor should help.
In case your would like to update the Graphiti model to the current state of
e.g. your domain model I would suggest to implement your own subclass of
DefaultUpdateDiagramFeature and call that. Note that any feature you call
and makes changes to the EMF models need to do those changes inside a
transaction on the transactional editing domain of the editor otherwise you
will see the exception you got.
I've found the solution for my problem. Now I remove everything from the diagram with the RemoveFeature and afterwards I call my own UpdateFeature, which repaints the whole diagram.
Michael Wenz Messages: 1370 Registered: July 2009 Location: Walldorf, Germany
Senior Member
Juliane,
that surely works for small diagrams, but might cause performance issues
with larger diagrams. Maybe it would be better to implement the update
features in a way that they first check what is already on the diagram and
only update the missing parts (plus maybe delete no longer needed parts).