SchemaManagerFilter.filterAttributeValues(...) element text
Oxygen general issues.
-
- Posts: 3
- Joined: Fri May 28, 2010 7:59 pm
- Location: London, UK
- Contact:
SchemaManagerFilter.filterAttributeValues(...) element text
Post by adamretter »
I have created an implementation of SchemaManagerFilter and am specifically interested in the filterAttributeValues method for suggesting attribute values for content completion.
I have created a basic filter and have it installed into a Document Type in oXygen and its working well. However I would now like to make my suggestions based on the existing text content of the element.
How can I get the text of the element that the attribute is attached to? I can get the element, but cannot see how to get the text!
I am using -
ContextElement element = context.getParentElement();
But how can I retrieve the text of that element?
Thanks Adam.
I have created a basic filter and have it installed into a Document Type in oXygen and its working well. However I would now like to make my suggestions based on the existing text content of the element.
How can I get the text of the element that the attribute is attached to? I can get the element, but cannot see how to get the text!
I am using -
ContextElement element = context.getParentElement();
But how can I retrieve the text of that element?
Thanks Adam.
Re: SchemaManagerFilter.filterAttributeValues(...) element text
Hi Adam,
The context passed to the WhatAttributesCanGoHereContext object which comes on the filterAttributeValues only contains a path of XML elements in which the last element is the current one. So you cannot obtain the text of the current element from this context.
If you want to implement this only for the Text page:
You have to get access to the JTextArea in which the user is editing.
You can do this by something like:
KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()
Then looking at the caret position in the JTextArea maybe you can search in it for the text after the first >.
Regards,
Radu
The context passed to the WhatAttributesCanGoHereContext object which comes on the filterAttributeValues only contains a path of XML elements in which the last element is the current one. So you cannot obtain the text of the current element from this context.
If you want to implement this only for the Text page:
You have to get access to the JTextArea in which the user is editing.
You can do this by something like:
KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()
Then looking at the caret position in the JTextArea maybe you can search in it for the text after the first >.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
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