Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Prevent adding more connections to the node
Prevent adding more connections to the node [message #479989] Thu, 13 August 2009 11:24 Go to next message
Eclipse UserFriend
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 14:49 Go to previous message
Nikola Milikic is currently offline Nikola MilikicFriend
Messages: 10
Registered: July 2009
Junior Member
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
Previous Topic:Obtain all editparts from model
Next Topic:How to apply UML profile to activity diagram
Goto Forum:
  


Current Time: Thu Sep 20 09:40:00 GMT 2018

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

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

Back to the top