Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Looking for examples of EContentAdapter usage
Looking for examples of EContentAdapter usage [message #392548] Tue, 26 April 2005 21:32 Go to next message
Adelino is currently offline AdelinoFriend
Messages: 11
Registered: July 2009
Junior Member
Hi,

I'm looking for small examples that make use of EContentAdapter.

I would be interested to know how to get notified of any object creation
that occurs in a given subtree of the model.

Many thanks, Adelino.
Re: Looking for examples of EContentAdapter usage [message #392553 is a reply to message #392548] Tue, 26 April 2005 22:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Adelino,

We don't have any examples of this. It's pretty simple to use. Just
create a derived class EContentAdapter class, override
notifyChanged(Notification notification) being sure to call super, and
add it to any object using eObject.eAdapters().add(new
MyEContentAdapter()). You'll get notifications from all objects in the
tree.


Adelino Rodrigues wrote:

> Hi,
>
> I'm looking for small examples that make use of EContentAdapter.
>
> I would be interested to know how to get notified of any object
> creation that occurs in a given subtree of the model.
>
> Many thanks, Adelino.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Looking for examples of EContentAdapter usage [message #405325 is a reply to message #392553] Wed, 15 November 2006 13:51 Go to previous messageGo to next message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
Hello Ed

I tried attaching an EContentAdapter to my resource to listen to
notifications (i eventually want to listen to addition of child
elements) like this:
resource.eAdapters().add(myNotificationAdapter);


It works ok for all elements directly under the root element but not for
any deeper level.

Is there anything i need to do to make it 'notify' element changes deep
within the tree ?

thanks

roy

Ed Merks wrote:

> Adelino,
>
> We don't have any examples of this. It's pretty simple to use. Just
> create a derived class EContentAdapter class, override
> notifyChanged(Notification notification) being sure to call super, and
> add it to any object using eObject.eAdapters().add(new
> MyEContentAdapter()). You'll get notifications from all objects in the
> tree.
>
>
> Adelino Rodrigues wrote:
>
>> Hi,
>>
>> I'm looking for small examples that make use of EContentAdapter.
>>
>> I would be interested to know how to get notified of any object
>> creation that occurs in a given subtree of the model.
>>
>> Many thanks, Adelino.
>>
Re: Looking for examples of EContentAdapter usage [message #405326 is a reply to message #405325] Wed, 15 November 2006 14:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Roy,

It should attach itself to the whole tree. You are sure you are calling
super in your notifyChanged override? If you look at the deeper
children's eAdapters() list, are they empty or do the contain the
EContentAdapter instance?


user@domain.invalid wrote:
> Hello Ed
>
> I tried attaching an EContentAdapter to my resource to listen to
> notifications (i eventually want to listen to addition of child
> elements) like this:
> resource.eAdapters().add(myNotificationAdapter);
>
>
> It works ok for all elements directly under the root element but not
> for any deeper level.
>
> Is there anything i need to do to make it 'notify' element changes
> deep within the tree ?
>
> thanks
>
> roy
>
> Ed Merks wrote:
>
>> Adelino,
>>
>> We don't have any examples of this. It's pretty simple to use. Just
>> create a derived class EContentAdapter class, override
>> notifyChanged(Notification notification) being sure to call super,
>> and add it to any object using eObject.eAdapters().add(new
>> MyEContentAdapter()). You'll get notifications from all objects in
>> the tree.
>>
>>
>> Adelino Rodrigues wrote:
>>
>>> Hi,
>>>
>>> I'm looking for small examples that make use of EContentAdapter.
>>>
>>> I would be interested to know how to get notified of any object
>>> creation that occurs in a given subtree of the model.
>>>
>>> Many thanks, Adelino.
>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Looking for examples of EContentAdapter usage [message #405331 is a reply to message #405326] Wed, 15 November 2006 20:30 Go to previous messageGo to next message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
Thanks you so much Ed !

I missed the super() call.

Apologies..

Roy

Ed Merks wrote:
> Roy,
>
> It should attach itself to the whole tree. You are sure you are calling
> super in your notifyChanged override? If you look at the deeper
> children's eAdapters() list, are they empty or do the contain the
> EContentAdapter instance?
>
>
> user@domain.invalid wrote:
>
>> Hello Ed
>>
>> I tried attaching an EContentAdapter to my resource to listen to
>> notifications (i eventually want to listen to addition of child
>> elements) like this:
>> resource.eAdapters().add(myNotificationAdapter);
>>
>>
>> It works ok for all elements directly under the root element but not
>> for any deeper level.
>>
>> Is there anything i need to do to make it 'notify' element changes
>> deep within the tree ?
>>
>> thanks
>>
>> roy
>>
>> Ed Merks wrote:
>>
>>> Adelino,
>>>
>>> We don't have any examples of this. It's pretty simple to use. Just
>>> create a derived class EContentAdapter class, override
>>> notifyChanged(Notification notification) being sure to call super,
>>> and add it to any object using eObject.eAdapters().add(new
>>> MyEContentAdapter()). You'll get notifications from all objects in
>>> the tree.
>>>
>>>
>>> Adelino Rodrigues wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm looking for small examples that make use of EContentAdapter.
>>>>
>>>> I would be interested to know how to get notified of any object
>>>> creation that occurs in a given subtree of the model.
>>>>
>>>> Many thanks, Adelino.
>>>>
Re: Looking for examples of EContentAdapter usage [message #416950 is a reply to message #405331] Wed, 20 February 2008 20:57 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Example: http://www.vogella.de/articles/EclipseEMF/article.html#emfno tifcation
Re: Looking for examples of EContentAdapter usage [message #531003 is a reply to message #416950] Mon, 03 May 2010 10:27 Go to previous message
Kris Missing name is currently offline Kris Missing nameFriend
Messages: 47
Registered: July 2009
Member
apparently the article has moved to:
http://www.vogella.de/articles/EclipseEMFNotification/articl e.html

Am 2/20/08 9:57 PM, schrieb Lars Vogel:
> Example: http://www.vogella.de/articles/EclipseEMF/article.html#emfno tifcation
Previous Topic:EContentAdapter
Next Topic:[CDO] CDOFeatureDelta => ADD with null
Goto Forum:
  


Current Time: Thu Apr 25 08:52:44 GMT 2024

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

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

Back to the top