Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wrap_multiple_changes_into_one_compound_change [2015/06/11 20:50]
wrap_multiple_changes_into_one_compound_change [2021/04/05 11:23] (current)
Line 1: Line 1:
 +====== Wrap Multiple Document Changes into one Compound Change =====
 +If multiple changes on a document of a TextViewer or SourceViewer should be undo/redo-able with a single action then it must be wrapped into a compound change.
  
 +<sxh java>
 +IRewriteTarget target= viewer.getRewriteTarget();
 +target.beginCompoundChange();
 +try {
 +    ...
 +    doTheChanges();
 +    ...
 +} finally {
 +    target.endCompoundChange();
 +}
 +</sxh>
 +
 +{{tag>java jface}}