When modifying the UML data structure using the UModel API, there is no need to take care of Undo/Redo or transactions.
The following code makes three modifications:
public void ChangeClass( IUMLClass iClass )
and for every modification, a new undo-step is created, in other words: the user will have to press the "Undo" button three times in UModel to undo these three changes.
This is not always the required behavior so the UModel API supports "transaction-handling" making it possible to execute multiple modifications in one step.
IDocument has the functionality to define when a group of modifications starts ( "BeginModification" ) and when it ends ( "EndModification" ):
public void ChangeClass(IUMLClass iClass, IDocument iDoc)
This kind of transaction handling may only be used for UML data modifications. Other functions, such as e.g. 'synchronize model from code', will create one single Undo step anyway.
© 2019 Altova GmbH