Best Practice to check readOnly elements

Post here questions and problems related to oXygen frameworks/document types.
Denis
Posts: 47
Joined: Thu Jun 19, 2014 3:55 pm

Best Practice to check readOnly elements

Post by Denis »

Hi

we are using the Eclipse Oxygen Author in Version 15.2

I want to drag an element. If I move the cursor over an readOnly element, there will be no DND.DROP_NONE symbol. So I implemented this:

Code: Select all

 
AuthorViewToModelInfo authorViewToModelInfo = getAuthorViewToModelInfo(event);
AuthorNode node = authorViewToModelInfo.getAuthorNode();
boolean editable = authorAccess.getDocumentController()
.isEditable(node);
if (!editable) {
event.detail = DND.DROP_NONE;
}
Is there a better way to figure out, if the element is read-only?

Best regards,
Denis
Denis Zygann
KGU Consulting GmbH
http://www.kgu-consulting.com
Radu
Posts: 9100
Joined: Fri Jul 09, 2004 5:18 pm

Re: Best Practice to check readOnly elements

Post by Radu »

Hi Denis,

From where exactly do you drag that element? From a custom view? Did you already have a custom drop handler for it?

Basically the isEditable API method checks that:
* Test if a node is editable or not. A node is not editable for one of the following cases:
* <ul>
* <li>the CSS property 'editable' is to 'false';</li>
* <li>the node is entirely included into a DELETED change marker.</li>
* <ul>
The API also convers content references or xi:included sections (basically content which comes from another XML file).
Is it insufficient for your needs?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply