Refresh command on diagram modification [message #505836] |
Tue, 05 January 2010 05:12  |
Eclipse User |
|
|
|
I have created a GMF editor which is used to create/edit the underlying model (XML). In the model, ordering of elements in various compartments is critical for the execution flow, thus the flow is visualized in GMF by creating (notational) connections between the different elements depending on their order.
These connections are created by iterating though the list of elements in a compartment and creating connections with respect to the order of the elements. When the compound command is executed all connections are created/refreshed.
The question is where to execute this command?
At first I tried executing it in the refresh method of the diagram toplevel node, however this had the undesired results that any diagram modification consisted of two commands (also undo/redo). It also caused flickering.
I then tried adding it to the various editingpolicies: CompartmentEditPolicy, CompartmentComponentEditPolicy and CompartmentChildCreationEditPolicy.
And everything is now executed inside a CompositeTransactionalCommand with correct undo/redo functionality. However the refreshCommand is build before the diagram is up-to-date and thus, it does not include the latest modication command.
I tried building the refresh connections command dynamically during execution but this causes unwanted undo/redo results.How is this best solved using the GMF framework?
[Updated on: Tue, 05 January 2010 05:13] by Moderator
|
|
|
|
Re: Refresh command on diagram modification [message #506662 is a reply to message #506607] |
Fri, 08 January 2010 05:24  |
Eclipse User |
|
|
|
Peder,
if I remember correctly, the EditPolicy for
EditPolicyRoles.CANONICAL_ROLE
handles the refresh of the diagram. You can get it from you CanvasEditPart and simply call refresh. I think it delegates this call to all subelements and refreshes the whole diagram.
Best,
Artur
|
|
|
Powered by
FUDForum. Page generated in 0.03521 seconds