CommandProcessor and undo/redo questions


I've some questions regarding CommandProcessor.
I know that it is necessary for undo/redo and I've read various posts
in this forum but there are still some open questions.

What is the 'groupId' parameter in executeCommand() good for?
Should I always pass null?
Or can I use it to group commands to one undo operation?

If I modify two (or more) documents, should I make all modifications
in one executeCommand(), or should I use separate executeCommand()
for each document modification? Does this make any difference for undo?

In other words: If I modify two documents in one executeCommand() and the
user clicks 'undo', does IDEA undo changes in both documents?

I tried to modify a document in runUndoTransparentAction()
but the undo action in the toolbar gets enabled for the document
and the user can undo the change. Seems that runUndoTransparentAction()
has no effect on document changes, right?
Where is runUndoTransparentAction() useful? In file operations?

What does UndoConfirmationPolicy.DEFAULT mean?
Request or not request confirmation?

Is some documentation about the undo/redo system available
that describes the concept of the undo/redo system and what
OpenAPI methods (document modification, file creation, etc.)
are undoable?

If I use UndoManager.undoableActionPerformed() to add a custom action
to the undo queue, should/must I wrap it with CommandProcessor.executeCommand()?

Thanks in advance.


Please sign in to leave a comment.