Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » About Notify framework
About Notify framework [message #415848] Wed, 09 January 2008 16:19 Go to next message
Eclipse UserFriend
Originally posted by: research.opencanarias.com

Hi ed,

I have encountered some problems about using EMF notifications.

I would like to implement a class which could have control about any
change in, any EMF resource of the workspace. I dont know if is possible
that a class can easily listen to all the eObject changes, as same as
for instnace a class can easliy listen to IResource changes
(implementing an IResourceChangeListener and registering the class to
the workpspace resource change listeners).

The adapter-notifier system is not useful for me, since i have to attach
MyOwnAdapter in every EObject, which i dont presumibly have control.

Is there any class in EMF which could receive all the notification, and
then, my own class could register to?

Is there any way of doing what im trying to do ?

Greetings and thanks in advance,

Adolfo.
Re: About Notify framework [message #415850 is a reply to message #415848] Wed, 09 January 2008 16:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Adolfo,

Comments below.

Adolfo Sánchez-Barbudo Herrera wrote:
> Hi ed,
>
> I have encountered some problems about using EMF notifications.
>
> I would like to implement a class which could have control about any
> change in, any EMF resource of the workspace. I dont know if is
> possible that a class can easily listen to all the eObject changes, as
> same as for instnace a class can easliy listen to IResource changes
> (implementing an IResourceChangeListener and registering the class to
> the workpspace resource change listeners).
The objects loaded into editors are private and not necessarily
available to you. Generated editors implemented IEditingDomainProvider
which allows you to access the editor's resource set and you can listen
to the workbench to see when editors are opened (each generated editor
has an example of such a listener).
>
> The adapter-notifier system is not useful for me, since i have to
> attach MyOwnAdapter in every EObject, which i dont presumibly have
> control.
Something like an EContentAdapter is very useful because you can attach
it to a resource set, for example, and it will attach itself to all
objects contained by it (and will maintain itself to attach to any new
objects that are attached).
>
> Is there any class in EMF which could receive all the notification,
> and then, my own class could register to?
You can only do what other editors allow you to do. You can't simply
sneak in and see anything you choose.
>
> Is there any way of doing what im trying to do ?
I guess I'm curious what you're trying to accomplish. A workbench
listener and then attaching to the resource set if the editor reveals
it's a good start anyway...
>
> Greetings and thanks in advance,
>
> Adolfo.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: About Notify framework [message #415851 is a reply to message #415850] Wed, 09 January 2008 16:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Ed, Adolfo,

Also, in a transactional editor, the TransactionalEditingDomain implicitly
listens to all objects in the resource set, and provides the
ResourceSetListener interface with some rather different behaviour than
Adapter and EContentAdapter. More details on that are available in the EMF
Model Transaction Developer Guide.

Cheers,

Christian

Ed Merks wrote:

> Adolfo,
>
> Comments below.
>
> Adolfo Sánchez-Barbudo Herrera wrote:
>> Hi ed,
>>
>> I have encountered some problems about using EMF notifications.
>>
>> I would like to implement a class which could have control about any
>> change in, any EMF resource of the workspace. I dont know if is
>> possible that a class can easily listen to all the eObject changes, as
>> same as for instnace a class can easliy listen to IResource changes
>> (implementing an IResourceChangeListener and registering the class to
>> the workpspace resource change listeners).
> The objects loaded into editors are private and not necessarily
> available to you. Generated editors implemented IEditingDomainProvider
> which allows you to access the editor's resource set and you can listen
> to the workbench to see when editors are opened (each generated editor
> has an example of such a listener).
>>
>> The adapter-notifier system is not useful for me, since i have to
>> attach MyOwnAdapter in every EObject, which i dont presumibly have
>> control.
> Something like an EContentAdapter is very useful because you can attach
> it to a resource set, for example, and it will attach itself to all
> objects contained by it (and will maintain itself to attach to any new
> objects that are attached).
>>
>> Is there any class in EMF which could receive all the notification,
>> and then, my own class could register to?
> You can only do what other editors allow you to do. You can't simply
> sneak in and see anything you choose.
>>
>> Is there any way of doing what im trying to do ?
> I guess I'm curious what you're trying to accomplish. A workbench
> listener and then attaching to the resource set if the editor reveals
> it's a good start anyway...
>>
>> Greetings and thanks in advance,
>>
>> Adolfo.
Re: About Notify framework [message #415902 is a reply to message #415851] Thu, 10 January 2008 09:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: research.opencanarias.com

Thank you very much for the response...

As a conclusion: i should generally add an adapter to the resourceSet
(better than adding it to every object :D) of the editingDomain of every
opened editor...

About TransactionalEditingDomain (such as a diagram editor) i should
have to find out the benefits of using the resourceSetChangeListener
mechanism better than Attached-adapter one...

Again, thanks for the help ;)

Adolfo.


Christian W. Damus escribió:
> Hi, Ed, Adolfo,
>
> Also, in a transactional editor, the TransactionalEditingDomain implicitly
> listens to all objects in the resource set, and provides the
> ResourceSetListener interface with some rather different behaviour than
> Adapter and EContentAdapter. More details on that are available in the EMF
> Model Transaction Developer Guide.
>
> Cheers,
>
> Christian
>
> Ed Merks wrote:
>
>> Adolfo,
>>
>> Comments below.
>>
>> Adolfo Sánchez-Barbudo Herrera wrote:
>>> Hi ed,
>>>
>>> I have encountered some problems about using EMF notifications.
>>>
>>> I would like to implement a class which could have control about any
>>> change in, any EMF resource of the workspace. I dont know if is
>>> possible that a class can easily listen to all the eObject changes, as
>>> same as for instnace a class can easliy listen to IResource changes
>>> (implementing an IResourceChangeListener and registering the class to
>>> the workpspace resource change listeners).
>> The objects loaded into editors are private and not necessarily
>> available to you. Generated editors implemented IEditingDomainProvider
>> which allows you to access the editor's resource set and you can listen
>> to the workbench to see when editors are opened (each generated editor
>> has an example of such a listener).
>>> The adapter-notifier system is not useful for me, since i have to
>>> attach MyOwnAdapter in every EObject, which i dont presumibly have
>>> control.
>> Something like an EContentAdapter is very useful because you can attach
>> it to a resource set, for example, and it will attach itself to all
>> objects contained by it (and will maintain itself to attach to any new
>> objects that are attached).
>>> Is there any class in EMF which could receive all the notification,
>>> and then, my own class could register to?
>> You can only do what other editors allow you to do. You can't simply
>> sneak in and see anything you choose.
>>> Is there any way of doing what im trying to do ?
>> I guess I'm curious what you're trying to accomplish. A workbench
>> listener and then attaching to the resource set if the editor reveals
>> it's a good start anyway...
>>> Greetings and thanks in advance,
>>>
>>> Adolfo.
>
Re: About Notify framework [message #415930 is a reply to message #415850] Fri, 11 January 2008 16:00 Go to previous message
Eclipse UserFriend
Originally posted by: research.opencanarias.com

Uou... i forgot it...

> I guess I'm curious what you're trying to accomplish.

I'm maintaining a mapping between eObject's URIs and auto-generated
UIDs, so when an eObject changes its URI, i need to listen to that
changes to update the Map entries...

Cheers !!!!
Adolfo
Previous Topic:Proble when saving a resouce...
Next Topic:Interface Override Issue
Goto Forum:
  


Current Time: Fri Apr 26 23:16:06 GMT 2024

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

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

Back to the top