Helpful error messages for Actions
Are you missing a feature? Request its implementation here.
Helpful error messages for Actions
Hi there,
Actions are very flexible and useful and I'm creating bunches of them. I do sometimes find myself wanting to be able to specify a helpful error message sometimes. E.g. Say I write the xpath such that a PI can only be the child of an entry (because this PI controls the rotation of text in table cells). I'd like to be able to specify a message like "These PIs must be the direct children of table cells." Which would be more helpful than "The Action...is not available in the current context"
Thanks,
David
Actions are very flexible and useful and I'm creating bunches of them. I do sometimes find myself wanting to be able to specify a helpful error message sometimes. E.g. Say I write the xpath such that a PI can only be the child of an entry (because this PI controls the rotation of text in table cells). I'd like to be able to specify a message like "These PIs must be the direct children of table cells." Which would be more helpful than "The Action...is not available in the current context"
Thanks,
David
Re: Helpful error messages for Actions
Hi David,
The solution for this would be to use a very permissive XPath for your operation (like true()) which will mean that your operation is always called.
Then on the
implementation you can check for yourself if the caret position is inside a valid XML element.
The ro.sync.ecss.extensions.api.AuthorDocumentController has methods which can be used to evaluate an XPath at the caret position.
Then you have full control over the error message to report either by throwing an AuthorOperationException or by showing the error message yourself:
Regards,
Radu
The solution for this would be to use a very permissive XPath for your operation (like true()) which will mean that your operation is always called.
Then on the
Code: Select all
/**
* @see ro.sync.ecss.extensions.api.AuthorOperation#doOperation(ro.sync.ecss.extensions.api.AuthorAccess, ro.sync.ecss.extensions.api.ArgumentsMap)
*/
public void doOperation(AuthorAccess authorAccess, ArgumentsMap args)
throws IllegalArgumentException, AuthorOperationException {
The ro.sync.ecss.extensions.api.AuthorDocumentController has methods which can be used to evaluate an XPath at the caret position.
Then you have full control over the error message to report either by throwing an AuthorOperationException or by showing the error message yourself:
Code: Select all
authorAccess.getWorkspaceAccess().showErrorMessage(message)
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