On 07/27/2011 03:41 PM, Fabián Mandelbaum wrote:
>
> I've written a custom (Java) command for XXE. This command changes the
> readOnly property of the parent of the selected element temporarily,
> deletes the selected element, and changes the parent property back.
>
> this is the execute implementation:
>
> protected Object doExecute(DocumentView docView,
> String parameter, int x, int y) {
> Document doc = docView.getDocument();
> Element parent = toDelete.getParentElement();
> doc.beginEdit();
> parent.putProperty(RO_PROP, Boolean.FALSE);
> parent.removeChild(toDelete);
> parent.putProperty(RO_PROP, Boolean.TRUE);
> doc.endEdit();
> docView.describeUndo("Remove Section");
> toDelete = null;
> return null;
> }
>
>
> What am I doing wrong?
Nothing wrong.
> Why is the undo button disabled after running
> the above command? (The document is marked dirty and the command does
> remove the element in question)
>
The undo manager cannot cope with most cases where some XML nodes are
marked read-only by a command. When it detects such cases, the undo
manager automatically clears it internal stacks. Of course, doing this
causes the Undo button to become disabled (grayed).
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support