Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Question on Commands and Connections
Question on Commands and Connections [message #121393] Mon, 23 April 2007 13:58 Go to next message
Eclipse UserFriend
Originally posted by: awm_abu.yahoo.com

Hello,

I am having a very annoying issue I was hoping some one could help me with.

When the user creates Node A...I use configure command to add some
BorderItems to be used as connection ports.
At the same time I create some other nodes programmatically (the same number
as Node A has connection ports).
Then I want to create connections between the newly created nodes and Node
A's connection ports.

So my question was where do i do this ?

I started by putting the code in addChildVisual of Node A's parent but I got
some strange undo/redo behaviour.
Then I put the code in the ConfigureCommand - so right after I add the ports
to Node A I create the other Nodes and try to connect them.
However the issue I have here is a strange one...the connections do not
appear.
If I undo/redo they appear - if I add a different node using the
addChildVisual method (which does not have this connection problem ) then
they appear straight away as well.

So it seems as if they are there but just not showing up.
I have tried to get the Container of the connections to refresh in multiple
ways (I called every refresh method in the container editparts
handleNotificationMethod).

Then I was thinking that it was a timing issue so I thought of the
EditHelperAdvice and using getAfterCreate and getAfterConfigureCommands.
getAfterCreate doesn't work but then the configure is where the ports get
added so maybe makes sense.
I cannot get the getAfterConfigure to get called.


Any thoughts on any of this ?

Any help greatly appreciated.

Thanks,
Alan.
Re: Question on Commands and Connections [message #121492 is a reply to message #121393] Tue, 24 April 2007 07:21 Go to previous message
Eclipse UserFriend
Hello Alan,

The following sequence of calls will be executed on creating new node in GMF:
1. Request created and passed to the corresponding EditPart and then redirected
to all the installed EditPolicies.
2. Command returned from 1. executed
If you open CreationEditPolicy installed on the EditPart of parent of Node
A you’ll see the actual sequence of calls executed while creating Node A.
There is a separate EditPolicy responsible for creation of domain model elements
(???ItemSemanticEditPolicy) this EditPolicy will check some necessary conditions
and then instantiate NodeACreateCommand to perform actual domain model element
creation. CreationEditPolicy will redirect domain model element creation
to ???ItemSemanticEditPolicy and handle notation model changes directly.

So, answering your question: correct places to create some additional elements
are CreationEditPolicy/NodeACreateCommand. If you have to create several
domain model elements in addition to the one you are creating – modify NodeACreateCommand
and this code will be executed on creation of Node A. If you should perform
some specific actions on notation model (create additional views/edges) then
you either have to modify request to force existing CreationEditPolicy handling
it or create a subclass CreationEditPolicy with your custom logic and install
this subclass instead of CreationEditPolicy to the corresponding container
EditPart.

-----------------
Alex Shatalin
Previous Topic:EditPolicyProvider is not called for DiagramEditPart on first open
Next Topic:Possible to map this metamodel with GMF?
Goto Forum:
  


Current Time: Fri Jul 18 00:28:28 EDT 2025

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

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

Back to the top