Best Practice to check readOnly elements

Post here questions and problems related to oXygen frameworks/document types.
Denis
Posts: 47

Best Practice to check readOnly elements

Wed Oct 15, 2014 4:34 pm

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: 5876

Re: Best Practice to check readOnly elements

Thu Oct 16, 2014 9:10 am

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

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 1 guest