I'm working on a "Show In Design" action via the Web Tools SSE right click menu.
The plan is to set the focus on a certain Sapphire ModelElement node in the tree when user the user right clicks an XML node in the document source and clicks the action.
I was wondering if there was an simple way to find a certain ModelElement in the Sapphire editor from the XML's org.w3c.dom.Node object.
Hoping to avoid traversing trees and searching for nodes manually if possible.
XmlEditorResourceStore maintains a mapping of DOM Node to Sapphire IModelElement that it uses for triggering element refresh when the underlying DOM Node changes. See XmlEditorResourceStore.getModelElements() method. This method is protected, but you can subclass XmlEditorResourceStore to gain the access you need or we can make the method public if there is an external user of this data.