Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ECrossreferenceAdapter and removing elements from content tree
ECrossreferenceAdapter and removing elements from content tree [message #1753061] Wed, 01 February 2017 13:52 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
Hi,

I found some behavior that quite surprised me when having a tree that is adapted with an ECrossReferenceAdapter:

If I have an element A that references B, then I remove A from the content tree, and ask for inverse references to B, a setting for the A -> B reference is returned. I was about 100% sure that this wouldn't happen, but looking at the code, there is no case for REMOVE/REMOVE_MANY notifications in the handleContainment() method of ECrossReferenceAdapter.

I'm confused. Is this really intended behavior? Do I miss something, or does one really need to handle the returned settings with care since they possibly involve objects that have been deleted?

Thanks,
Felix
Re: ECrossreferenceAdapter and removing elements from content tree [message #1753081 is a reply to message #1753061] Wed, 01 February 2017 17:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Yes, that's intended. "Deleted" objects are objects that have no references to them at all. A cross reference adapter can be used to help delete objects.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ECrossreferenceAdapter and removing elements from content tree [message #1753145 is a reply to message #1753081] Thu, 02 February 2017 08:33 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
Ok that's good to know. I still find the behavior a bit unexpected though. Looking slightly closer, I found out that the ECrossReferenceAdapter that I'm working with is a customized subclass, which has handleContainment() overridden to also handle the remove case, unfortunately only REMOVE notifications are handlet whereas REMOVE_MANY is just ignored which yes, leads to nasty bugs.
Previous Topic:Java to Ecore using annotation
Next Topic:OCLinEcore and ATL
Goto Forum:
  


Current Time: Wed Sep 25 22:21:44 GMT 2024

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

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

Back to the top