[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.webtools] Re: Questions about building on top of the XML Editor

Konstantin Komissarchik wrote:
Nope. The XML editor infrastructure does not implement org.w3c.dom.events.* interfaces. I did find an example plugin from an old EclipseCon talk and from there was able to figure out that the relevant listener interfaces are apparently INodeNotifier and INodeAdapter. Getting them configured properly for notification was a pain, but at least I am now getting events.

Correct, the DOM Nodes all implement INodeNotifier and tell their registered INodeAdapters of changes to attributes and children. The adapters are created by INodeAdapterFactory instances.


So it's actually not that painful for adding *UI* functionality--once you have the model, you can add your own adapter factory through its FactoryRegistry object. This is usually done when the model is first set as the input on a viewer. Your factory will then be asked to lazily create an adapter when someone, meaning your UI code, attempts to get that adapter from the Node using INodeNotifier.getAdapterFor(Object). Under extreme circumstances, you may also get the factory for the PropagatingAdapterFactory.class type and add your factory to its list. This will exchange some performance when Nodes are created for your factory being called right then.

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational