Pergunta

I'm trying to develop 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).

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!

Foi útil?

Solução

The people from the eclipse emf forums has answered me, this is the answer:

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().

I have made the second option, the guard with isLoading and it worked like a charm.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top