[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: EContentAdapter for all new Model instances

Ed Merks schrieb:
Now I want to observe *any* new model instance of my metamodel. Is there a way to automatically add such adapter to the model at creation or loading? Where is the best point to hook that in?
You can add an EContentAdapter to a ResourceSet and then it will be added to all objects contained by that resource set.

But I want to add it also automatically to all new resources created for a specific metamodel.


I'm tempted to ask what you're trying to accomplish though. For example, the XSD model is "self adapting" because it uses notifications internally to keep the DOM in sync with the model, but it doesn't do that by attaching adapters...

It sounds something like exactly that.

I have a metamodel with a String attribute in some object and a lot of complicated child objects. The String is a convenience represenation of those child objects and I have a String parser and serializer that is able to convert the String into the child object set and vice versa.
So what I wanna do is whenever somebody changes such a String, it should trigger my parser and vice versa if any of the child object have changed, the serializer should update the String.


Additionally the serialization is dependent on some referenced objects somewhere else so I have also to monitor them.

So how can such "self adapting" be done. Sounds like something I could also use.

Cheers,
Hauke