CommandProcessor and undo/redo questions

Hi,

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.


1)
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?


2)
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?


3)
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?


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


5)
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?


6)
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.

Karl

Please sign in to leave a comment.