Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Deleting connections
Deleting connections [message #197534] Thu, 17 July 2008 07:37 Go to next message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hello,

I have designed my model in a way that the connection between two knots is
reflected in the model classes: a knot has a collection of incomming and
outgoing connections and a connection knows the knot where it comes from
and the knot where it goes to.
Of course the connections are not contained by the knots. Knots and
connections are contained by a document object.

I discovered, that the deletion of a connection removes the connection
from its containing parent, the document. This is standard EMF behaviour.
But the references of the connection in the source knot and target knot
are not cleared.

Where should I insert my code to clear the non containment references of
deleted objects? Or is there any possibility to set a property in the
generation files (.gmfgen or other)?

gr Manfred
Re: Deleting connections [message #197650 is a reply to message #197534] Thu, 17 July 2008 09:57 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Manfred,

You can try setting "eOpposite" reference for a EReference from knot to connection
pointing to EReference from connection to knot. As a result, i think, EMF
will cleanup corresponding references automatically on deleting connection
(unsetting references from the connection to knots)

-----------------
Alex Shatalin
Re: Deleting connections [message #198083 is a reply to message #197650] Mon, 21 July 2008 13:50 Go to previous messageGo to next message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hello Alex,

I fear this is not the solution. EMF does not provide an automatic removal
of the stale references. Please look at the discussion thread here:
http://www.eclipse.org/newsportal/article.php?id=33773&g roup=eclipse.tools.emf#33773
Ed Merks says that commands should be used, but the command for deleting a
graphical object and the model object that belongs to it is completely
covered by the GMF framework.
I think I'm doing something wrong. :-<

gr.Manfred
Re: Deleting connections [message #198158 is a reply to message #198083] Mon, 21 July 2008 17:57 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Manfred,

Command returned from ???ItemSemanticEditPolicy.getDestroyElementCommand()
[in case of your model it should be ConnectionItemSemanticEditPolicy] will
be used to delete corresponding element. You can debug this code to see why
corresponding references was not cleared. In the code generated by GMF for
ecode diagram example EReferenceItemSemanticEditPolicy.getDestroyElementCommand()
returns DestroyElementCommand wich, in turn, performs tearDownIncomingReferences/tearDownOutgoingReferences
for the deleted object.

I suggest you debugging this code to see the reason of this problem - AFAIKSee
from the GMF-generated code for ecore diagram all unsetting code will be
executed for all incoming/outgoing references upon deleting object.

-----------------
Alex Shatalin
Previous Topic:eNotification
Next Topic:href of elements changes when saving GMF editor
Goto Forum:
  


Current Time: Thu Apr 18 05:46:00 GMT 2024

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

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

Back to the top