Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » remove delete problems(Explanation on remove from generated code)
remove delete problems [message #1232845] Fri, 17 January 2014 22:14 Go to next message
antonio guillen is currently offline antonio guillenFriend
Messages: 34
Registered: January 2014
Member
Iam new user of EMF and I have a pb with remove delete.
I have for example 3 classes A, B, C. C contains a list of object B. Object B have a reference on object A. I delete an object A. The objects of type B which are referenced by object C are still here even if they have a reference on the object A i had deleted!!! So they are invalid.
How I can do to delete all the objects B which have a refrence on the deleted object A??

Thanks a lot for your help.

Antonio
Re: remove delete problems [message #1234334 is a reply to message #1232845] Tue, 21 January 2014 18:13 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 19-01-14 02:30, antonio guillen wrote:
> Iam new user of EMF and I have a pb with remove delete.
> I have for example 3 classes A, B, C. C contains a list of object B.
> Object B have a reference on object A. I delete an object A. The objects
> of type B which are referenced by object C are still here even if they
> have a reference on the object A i had deleted!!!
Yes, very intentional behaviour of EMF.

So they are invalid.
> How I can do to delete all the objects B which have a refrence on the
> deleted object A??
You can find the references with ECoreUtil.UsageCrossReferencer. Then
you can delete them separately from the objects 'A'.
>
> Thanks a lot for your help.
>
> Antonio
Re: remove delete problems [message #1235020 is a reply to message #1234334] Thu, 23 January 2014 11:12 Go to previous messageGo to next message
antonio guillen is currently offline antonio guillenFriend
Messages: 34
Registered: January 2014
Member
Thanks for your help Christophe,

I have still questions:

Why it's a very intentional behaviour of EMF?

I had a look to the doc of ECoreUtil.UsageCrossReferencer and I don't understand
very well what means for the method find(Eobject obj, Collection<?> eObjectOfInterest) what means "a collection of objects whose combined content trees should be considered" can you explain me?

Thanks a lot for your help

Antonio
Re: remove delete problems [message #1235122 is a reply to message #1235020] Thu, 23 January 2014 16:14 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
On 23-01-14 12:12, antonio guillen wrote:
> Thanks for your help Christophe,
>
> I have still questions:
>
> Why it's a very intentional behaviour of EMF?

EMF has two types of EReference. There is a containment and a
non-containment reference. If you have a tree of EObjects which are
linked with a containment reference, then deleting the root of the tree,
will delete all objects. A non-containment reference is different,
multiple of these references can reference the same object.
It sounds like this is what you are using. EMF has no intention to
delete non-containment references.

>
> I had a look to the doc of ECoreUtil.UsageCrossReferencer and I don't
> understand very well what means for the method find(Eobject obj,
> Collection<?> eObjectOfInterest) what means "a collection of objects
> whose combined content trees should be considered" can you explain me?
I would recommend writing a simple test program where you feed this
method with your example. So for your example it will be look for A in
the containment tree C, which 'contains' B referencing A. (B being a
non-contaiment reference I assume from what you describe).

>
> Thanks a lot for your help
>
> Antonio
Previous Topic:CDO ArrayIndexOutOfBoundsException on rollback due to contains optimization in DelegatingEcoreEList.
Next Topic:JFace-Databinding
Goto Forum:
  


Current Time: Sat Aug 24 03:23:37 GMT 2019

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

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

Back to the top