How to use an Adapter to get all the notifications in a EMF model? [message #1803038] |
Thu, 21 February 2019 05:55  |
Eclipse User |
|
|
|
Hi All,
I am writing to ask if someone knows a way to get notifications for all the events triggered in a model.
In details:
I am working on a EMF model where I need to receive the RESOLVE changes in all the EObjects in the model.
So far, I can receive notifications for changes of a single object, by attaching an adapter to such object after creation, for example:
EObject aObject = instantiateElementA();
// here I attach the adapter to the specific object
aObject.eAdapters().add(new AdapterImpl() {
@Override
public void notifyChanged(final Notification msg) {
if ((msg.getEventType() == Notification.RESOLVE)) {
// here I handle the event
// ...
}
super.notifyChanged(msg);
}
});
I think there should be a way to attach the same Adapter to all the obejcts instantiated in the model, and I guess this should be done either by accessing a global notifier, or by accessing the Factory that instantiates the EObjects.
Is there anybody who can suggest me which is the "best practice way" to attach such adapters to listen to all the notifications ?
Thanks for the time spent on this.
Best Regards,
Patrik
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07230 seconds