Page 1 of 1

Best Practice to check readOnly elements

Posted: Wed Oct 15, 2014 4:34 pm
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

Re: Best Practice to check readOnly elements

Posted: Thu Oct 16, 2014 9:10 am
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