Gettinng the currently selected XML Element (Oxygen Plugin)
Posted: Wed Jun 02, 2010 11:32 am
Hi,
an application I'm working on will have XML documents with references to other documents or images in them. When the user left clicks on an element that has such a reference I would like to have an option in the contextmenu that allows him to open the referenced object.
In eclipses wst xml Editor I can do this rather easily by listening for SelectionEvents and processing the IStructuredSelections thrown, however this won't work with the Oxygen Plugin since its Editor seems to throw TextSelections.
The Outline uses StructuredSelections, so I tried to work with those, but since the contained elements are internal classes of the plugin (Package ro.sync.outline.xml) I couldn't get it to work that way either.
Is there any way to get the Element that is selected in the Editor from outside of the Plugin?
Alternatively, is there a way to get the Editors DocumentProvider so that I can use the TextSelections to get the element from the document?
an application I'm working on will have XML documents with references to other documents or images in them. When the user left clicks on an element that has such a reference I would like to have an option in the contextmenu that allows him to open the referenced object.
In eclipses wst xml Editor I can do this rather easily by listening for SelectionEvents and processing the IStructuredSelections thrown, however this won't work with the Oxygen Plugin since its Editor seems to throw TextSelections.
The Outline uses StructuredSelections, so I tried to work with those, but since the contained elements are internal classes of the plugin (Package ro.sync.outline.xml) I couldn't get it to work that way either.
Is there any way to get the Element that is selected in the Editor from outside of the Plugin?
Alternatively, is there a way to get the Editors DocumentProvider so that I can use the TextSelections to get the element from the document?