Evaluate Node Collection of Selection

<oXygen/> general issues.
jacobBocaj
Posts: 12

Evaluate Node Collection of Selection

Tue Jun 13, 2017 9:02 pm

Hello,

I would like to prevent the deletion of <title> elements (and their content) within an xml document if the <title> element has an attribute of 'hTitle'. Thus far I have managed to prevent the deletion of element content by overidding the 'delete' method in an extension class of AuthorDocumentFilter; within this overridden 'delete' method I check the node at the caret and stop the content deletion if the 'hTitle' attribute exist. This works great if the user attempts to delete content at the cursor position.

However, when the user attempts a delete operation on a selection spanning a collection of elements I am unable to find a working approach to check the element content of the selection and stop the deletion operation. Is there a class method to access the element content of a selection? I tried to use getFullySelectedNode form WSAuthorEditorPageBase in hopes that I could parse the children of that node, but I wan't able to make that work.

Any advice will be greatly appreciated.
Thanks,
Jacob
Radu
Posts: 5217

Re: Evaluate Node Collection of Selection

Wed Jun 14, 2017 8:25 am

Hi Jacob,

You could try this API:

ro.sync.ecss.extensions.api.AuthorDocumentController.getNodesToSelect(int, int)

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jacobBocaj
Posts: 12

Re: Evaluate Node Collection of Selection

Wed Jun 14, 2017 11:47 pm

Hello Radu,

Thank you for this suggestion. This solution works perfectly.

Regards,
Jacob

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 1 guest