Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF] EContentAdapter
[EMF] EContentAdapter [message #1064818] Fri, 21 June 2013 08:33 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi,

I am working on a patch for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=405483

Now I notice something interesting in EContentAdapter; The adapter can
self-adapt to the containment hierarchy of an EObject, Resource or
Resourceset. While self-adapting the 'target' of the adapter is set to
whatever object was 'last' self-adapted, by calling basicSetTarget(target).

I wonder why this is? I understand the adapter is shared, but what's the
point of replacing the target? If there are many targets, there are
actually no-targets...

Now for the EContentAdapter, It doesn't seem to matter. (None of the
code is calling getTarget(), except some code in EAdapterList.didRemove
but I keep wondering what is the purpose of the target in an AdapterImpl
considering that's overwritten continuously in the EContentAdapter ?

For bug 405483 or better for implementations which extend
CDOLazyContentAdapter, it would be nice to rely on the 'target' being
the root object of the hierarchy. Interestingly enough,
CDOLazyContentAdapter tracks the root in another field:
private WeakReference<CDOObject> adaptedRoot;


Thank you,
Christophe Bouhier
Re: [EMF] EContentAdapter [message #1064825 is a reply to message #1064818] Fri, 21 June 2013 08:49 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Christophe,

Comments below.

On 21/06/2013 10:33 AM, Christophe Bouhier wrote:
> Hi,
>
> I am working on a patch for
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=405483
>
> Now I notice something interesting in EContentAdapter; The adapter
> can self-adapt to the containment hierarchy of an EObject, Resource or
> Resourceset. While self-adapting the 'target' of the adapter is set to
> whatever object was 'last' self-adapted, by calling
> basicSetTarget(target).
>
> I wonder why this is? I understand the adapter is shared, but what's
> the point of replacing the target? If there are many targets, there
> are actually no-targets...
Yes, it's a bit questionable.
>
> Now for the EContentAdapter, It doesn't seem to matter. (None of the
> code is calling getTarget(), except some code in
> EAdapterList.didRemove but I keep wondering what is the purpose of the
> target in an AdapterImpl considering that's overwritten continuously
> in the EContentAdapter ?
There really isn't much point other than to reproduce consistent but
arguably useless behavior. Potentially more purposeful would be to
extend org.eclipse.emf.common.notify.impl.SingletonAdapterImpl but that
didn't exist at the time.
>
> For bug 405483 or better for implementations which extend
> CDOLazyContentAdapter, it would be nice to rely on the 'target' being
> the root object of the hierarchy.
Yes, arguably the first object to which it was attached is most
logically the "target".
> Interestingly enough, CDOLazyContentAdapter tracks the root in another
> field:
> private WeakReference<CDOObject> adaptedRoot;
>
>
> Thank you,
> Christophe Bouhier
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF] EContentAdapter [message #1064833 is a reply to message #1064825] Fri, 21 June 2013 09:50 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Thanks Ed.

On 21-06-13 10:49, Ed Merks wrote:
> Christophe,
>
> Comments below.
>
> On 21/06/2013 10:33 AM, Christophe Bouhier wrote:
>> Hi,
>>
>> I am working on a patch for
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=405483
>>
>> Now I notice something interesting in EContentAdapter; The adapter
>> can self-adapt to the containment hierarchy of an EObject, Resource or
>> Resourceset. While self-adapting the 'target' of the adapter is set to
>> whatever object was 'last' self-adapted, by calling
>> basicSetTarget(target).
>>
>> I wonder why this is? I understand the adapter is shared, but what's
>> the point of replacing the target? If there are many targets, there
>> are actually no-targets...
> Yes, it's a bit questionable.
>>
>> Now for the EContentAdapter, It doesn't seem to matter. (None of the
>> code is calling getTarget(), except some code in
>> EAdapterList.didRemove but I keep wondering what is the purpose of the
>> target in an AdapterImpl considering that's overwritten continuously
>> in the EContentAdapter ?
> There really isn't much point other than to reproduce consistent but
> arguably useless behavior. Potentially more purposeful would be to
> extend org.eclipse.emf.common.notify.impl.SingletonAdapterImpl but that
> didn't exist at the time.
>>
>> For bug 405483 or better for implementations which extend
>> CDOLazyContentAdapter, it would be nice to rely on the 'target' being
>> the root object of the hierarchy.
> Yes, arguably the first object to which it was attached is most
> logically the "target".
>> Interestingly enough, CDOLazyContentAdapter tracks the root in another
>> field:
>> private WeakReference<CDOObject> adaptedRoot;
>>
>>
>> Thank you,
>> Christophe Bouhier
>>
>>
>>
>>
>
Previous Topic:Show EMF Validation problems in Eclipse problems view
Next Topic:[SOLVED] Parts of EMF Plugin are not deployed on startup
Goto Forum:
  


Current Time: Thu Apr 25 20:41:08 GMT 2024

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

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

Back to the top