Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Refresh command on diagram modification(Where to hook in refresh notational connections on diagram modification)
Refresh command on diagram modification [message #505836] Tue, 05 January 2010 10:12 Go to next message
Peder Herborg is currently offline Peder HerborgFriend
Messages: 5
Registered: July 2009
Junior Member
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 10:13]

Report message to a moderator

Re: Refresh command on diagram modification [message #506607 is a reply to message #505836] Fri, 08 January 2010 10:19 Go to previous messageGo to next message
Peder Herborg is currently offline Peder HerborgFriend
Messages: 5
Registered: July 2009
Junior Member
I continued with the solution adding functionality to the various editingpolicies: CompartmentEditPolicy, CompartmentComponentEditPolicy and CompartmentChildCreationEditPolicy.

However skipped the general refresh command, and created seperate command for each case handling the local changes, IE. when an object is deleted, its source- and target-connections are deleted and created between the previous and next elements in the list if possible.
Re: Refresh command on diagram modification [message #506662 is a reply to message #506607] Fri, 08 January 2010 10:24 Go to previous message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
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
Previous Topic:How to Rename a Diagram
Next Topic:TransactionalEditingDomain.dispose() calls missing?
Goto Forum:
  


Current Time: Thu Apr 25 11:29:19 GMT 2024

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

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

Back to the top