Evaluate Node Collection of Selection

Oxygen general issues.
jacobBocaj
Posts: 12
Joined: Thu May 11, 2017 10:18 pm

Evaluate Node Collection of Selection

Post by jacobBocaj »

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: 9436
Joined: Fri Jul 09, 2004 5:18 pm

Re: Evaluate Node Collection of Selection

Post by Radu »

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
Joined: Thu May 11, 2017 10:18 pm

Re: Evaluate Node Collection of Selection

Post by jacobBocaj »

Hello Radu,

Thank you for this suggestion. This solution works perfectly.

Regards,
Jacob
Post Reply