Prevent adding more connections to the node [message #479989] |
Thu, 13 August 2009 07:24  |
Eclipse User |
|
|
|
Originally posted by: peterzoler.godon.de
Hi,
I would be grateful if someone could be able to help me.
In my model I have composition relationship (for instance called
"contains") between classes A and B: A can contain 0 or more B. That
automatically means that one B instance can belong only to one A instance.
Now in my GMF editor, I am actually able to draw that node A1 contains B1,
but also another node A2 contains B1. In output model, only the second
relationship stands, but on diagram, there are two. And when I close
diagram and open it again, only second connection is drawn. Is this some
kind of bug in GMF?
So, I want to prevent user to draw this second connection, or in other
words I want to check if the source node already has this kind of
connection attached to it, and if does, to dispose this second one. And
maybe here to throw some message to the user, but that's not too important.
Does anyone have clue how to do this and where?
I appreciate your time and help.
Regards,
Peter Zoler
|
|
|
Re: Prevent adding more connections to the node [message #480049 is a reply to message #479989] |
Thu, 13 August 2009 10:49  |
Eclipse User |
|
|
|
I think you should do the following:
In class <connection name>CreateCommand in method canExecute() add:
if(target != null)
if(target.eContainer() != null)
return false;
Maybe it could be more generalized.
Nevertheless, I think that GMF in the first place shouldn't allow adding
this multiple connections because Ecore model don't allow that. Should
this be reported as a bug?
Regards,
Nikola Milikic
|
|
|
Powered by
FUDForum. Page generated in 0.03092 seconds