Gettinng the currently selected XML Element (Oxygen Plugin)
Oxygen general issues.
Gettinng the currently selected XML Element (Oxygen Plugin)
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?
Re: Gettinng the currently selected XML Element (Oxygen Plugin)
Hi Florian,
The text page of our multi-page XML editor is based on Eclipse's TextEditor, and there is no DOM model behind it.
The multipage editor is derived from the org.eclipse.ui.part.MultiPageEditorPart so casting to it and requesting getSelectedPage() shoud give you the XML text editor, which at its turn is derived from the Eclipse's org.eclipse.ui.editors.text.TextEditor.
This should help,
Mircea
The text page of our multi-page XML editor is based on Eclipse's TextEditor, and there is no DOM model behind it.
The multipage editor is derived from the org.eclipse.ui.part.MultiPageEditorPart so casting to it and requesting getSelectedPage() shoud give you the XML text editor, which at its turn is derived from the Eclipse's org.eclipse.ui.editors.text.TextEditor.
This should help,
Mircea
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service