|Re: EOpposite in diagram editor [message #1023901 is a reply to message #1022378]
||Mon, 25 March 2013 12:31
| Simon Zutterman
Registered: October 2012
What i want to achieve is a link that goes both ways
1) so i can connect Goal-Object but also Object-Goal
2) the recursive relation is automatically mapped, so if I connect Goal A-Object A,
the opposite relation is also mapped, so i can't create an additional link
Object A - Goal A.
With this EOpposite relation as you can see below how i mapped that in ecore, that aspect works. I create a single graphical def, and have two link mappings so i can make the link starting from either type of node.
If i only have one relation on the domain level e.g. from goal-object, i won't be able to draw links from object-goal in the editor right?
So it does everything i want now but displays the recursive relation in an unwanted way when i add a new node (as seen in first post). Because I'm an Eclipse beginner, i also don't know how to find the problem in the DiagramEditPart or other code..
Any help would be immensely appreciated
(Size: 8.45KB, Downloaded 434 times)
|Re: EOpposite in diagram editor [message #1036463 is a reply to message #1027116]
||Mon, 08 April 2013 12:25
| Thomas Beyer
Registered: February 2013
i think the discussion is more or less a graph theory one.
GMF's notational model semantically (and syntactically) only understands directed graphs, which explicitely require a source and a target.
In my eyes, this only makes sense. Take a look at an UML-Class diagram. It really does matter, from what class you are drawing a composition-relation.
Just an idea:
In order to better support the user, you could raise the abstraction of your elements (Goal and Object) to a common super-class/interface IConcern.
Give the IConcern the relations concern1 and concern2 reference to itself.
In your mapping model, add ocl-contraints to the linkmappings, that prevent the source from being the target at the same time.
This would take care of enabling the user to draw the relation from either Goal or Object to the counter part.
Once a user creates a relation, you would have to complete concern1 or concern2 programmatically (the eopposite-approach) and take care of the canonical behavior for the Relation, you do not want to be displayed.
Tweaky, but could be worth a try.
If you feel, GMF is lacking this kind of feature, you are always free to file feature requests and push discussions or even provide improvements.
Powered by FUDForum
. Page generated in 0.02143 seconds