Disabling menuitems when the editor view is not editable

Hi I have an implementation when I open a file. When this file cannot be edited I lock the author view using the setEditable function on the WSTextBasedEditorPage class. This locks the editor view as expected. But I can still use the menu items and try to insert for example a topicref. Is there a way on greying out these items through the api? Thanks Jan Bevers | Developer | SDL | Content Management Technologies Division | +32 (0)15 400 970 | jbevers@sdl.com

Hi Jan, The current editable API disables the modifications in the editor at a very low level. The actions are still enabled but they actually cannot affect the edited content. We cannot automatically disable actions which come from Author extensions (like the DITA bold, italic, insert conref, etc) because we do not exactly know what those actions might be doing (as they might be implemented by other developers). For example an extension action (implementation of AuthorOperation) might be sending a query to a server and might not be used for modifying the current document, and thus would still need to be enabled. We have some API like: ro.sync.exml.workspace.api.editor.page.author.WSAuthorEditorPageBase.getActionsProvider() which would allow you to gain access to all general (cut/copy/paste, undo...) actions and also to all extension actions (defined for a particular XML vocabulary in a document type association/framework). Those are regular Swing actions so you could try to disable them. The problem is that those actions might get enabled by our code when the caret is moved for example, but you could try to add property changed listeners to every action and when an action is enabled from another part of the code you could disable it back. Regards, Radu Radu Coravu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 3/15/2013 1:51 PM, Jan Bevers wrote:
Hi
I have an implementation when I open a file. When this file cannot be edited I lock the author view using the setEditable function on the WSTextBasedEditorPage class. This locks the editor view as expected.
But I can still use the menu items and try to insert for example a topicref. Is there a way on greying out these items through the api?
Thanks
*Jan Bevers |* Developer *|*SDL *| *Content Management Technologies Division *| *+32 (0)15 400 970*|* jbevers@sdl.com Description: image001
_______________________________________________ oXygen-sdk mailing list oXygen-sdk@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk
participants (2)
-
Jan Bevers
-
Oxygen XML Editor Support