Adds an
UndoableEdit
to this
UndoableEdit
. This method can be used to coalesce smaller edits into a larger compound edit. For example, text editors typically allow undo operations to apply to words or sentences. The text editor may choose to generate edits on each key event, but allow those edits to be coalesced into a more user-friendly unit, such as a word. In this case, the
UndoableEdit
would override
addEdit
to return true when the edits may be coalesced.
A return value of true indicates anEdit
was incorporated into this edit. A return value of false indicates anEdit
may not be incorporated into this edit.
Typically the receiver is already in the queue of a UndoManager
(or other UndoableEditListener
), and is being given a chance to incorporate anEdit
rather than letting it be added to the queue in turn.
If true is returned, from now on anEdit
must return false from canUndo
and canRedo
, and must throw the appropriate exception on undo
or redo
.