Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Filter notifications when resource is loading
Filter notifications when resource is loading [message #988705] Sat, 01 December 2012 17:47 Go to next message
Aarón Martín is currently offline Aarón MartínFriend
Messages: 2
Registered: December 2012
Junior Member
I'm trying to create an adapter for certain models of EMF Eclipse that must capture the "add" notifications. What it should do is that when I add something to the model must show a dialog asking some questions.

However when I open the model, I'm receving lots of add notifications. I suppose that it's normal, because when you open a model it must load all its features and emf must add them to the in memory model (or something similar, I'm a newbie in emf).

But that's a serious problem because I don't know what "add notifications" are coming from the model loading or from an interaction of the user.

Is it possible to make a filter to skip all the notifications coming from the load of the model?

Thanks a lot!
Re: Filter notifications when resource is loading [message #988724 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988725 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988726 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988727 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988728 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988729 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988730 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988731 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988732 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988733 is a reply to message #988705] Sun, 02 December 2012 06:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Aarón,

How are the adapters attached? You should consider attaching them in
response to the Resource.RESOURCE__IS_LOADED notification much like
org.eclipse.emf.ecore.change.util.ChangeRecorder.notifyChanged(Notification)
does. You can also guard with
((Resource.Internal)eObject.eResource()).isLoading().

On 02/12/2012 2:25 AM, Aarón Martín wrote:
> I'm trying to create an adapter for certain models of EMF Eclipse that
> must capture the "add" notifications. What it should do is that when I
> add something to the model must show a dialog asking some questions.
>
> However when I open the model, I'm receving lots of add notifications.
> I suppose that it's normal, because when you open a model it must load
> all its features and emf must add them to the in memory model (or
> something similar, I'm a newbie in emf).
>
> But that's a serious problem because I don't know what "add
> notifications" are coming from the model loading or from an
> interaction of the user.
>
> Is it possible to make a filter to skip all the notifications coming
> from the load of the model?
>
> Thanks a lot!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Filter notifications when resource is loading [message #988743 is a reply to message #988733] Sun, 02 December 2012 12:27 Go to previous message
Aarón Martín is currently offline Aarón MartínFriend
Messages: 2
Registered: December 2012
Junior Member
Wow ten replies! Laughing

But with this piece of code:

!((Resource.Internal)notification.getNotifier().eResource()).isLoading()

It worked like a charm, thanks a lot!
Previous Topic:[EMF] Implementing Instance Model Inheritance
Next Topic:[CDO] get deleted Revision/CDOObject
Goto Forum:
  


Current Time: Fri Apr 19 20:23:29 GMT 2024

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

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

Back to the top