public interface ICompoundEdit extends IDisposable
IUndoUnit
s, that is a collection of units that are treated as one (e.g. they are always undone or redone as
a single unit).
ICompoundEdit
s have two states: active and disposed. Whenever an ICompoundEdit
is
retrieved from the UndoEngine
or the graph instance, it automatically is active. While an edit is in the
active state, it gathers IUndoUnit
s until the commit()
or cancel()
methods are
called. Calling the commit()
method commits all gathered IUndoUnit
s to the UndoEngine
, while
canceling will dispose them. Calling either method will put the edit in the disposed state. In this state, the
edit does not gather units anymore and is not reusable.
Additionally, this interface extends the IDisposable
interface. This enables the usage in using
statements that will automatically commit()
the edit.
ICompoundEdit
s can also be nested, in this case the changes of the inner edit are not committed directly to the
UndoEngine
but to the outer edit. Only when the outer edit is committed, the units are committed to the
UndoEngine
.
UndoEngine
,
IUndoUnit
Modifier and Type | Method and Description |
---|---|
void |
cancel()
This method cancels the compound editing process.
|
void |
commit()
This method commits the compound editing process.
|
close, dispose
void cancel()
The recorded IUndoUnit
s are disposed and the edit is not usable anymore.
void commit()
The IUndoUnit
s are enqueued into the corresponding UndoEngine
instance and the edit is not usable anymore. Alternatively client code can use the IDisposable.dispose()
method
of this instance to end this instance. This can be done conveniently using a using
statement.