jsyntaxpane
Class CompoundUndoMan

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by javax.swing.undo.UndoManager
              extended by jsyntaxpane.CompoundUndoMan
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.swing.event.UndoableEditListener, javax.swing.undo.UndoableEdit

public class CompoundUndoMan
extends javax.swing.undo.UndoManager

A revised UndoManager that groups undos based on positions. If the change is relatively next to the previous change, like when continuous typing, then the undoes are grouped together. This is cutomized from the http://www.camick.com/java/source/CompoundUndoMan.java from the blog: http://tips4java.wordpress.com/2008/10/27/compound-undo-manager/

Author:
Ayman Al-Sairafi
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
CompoundUndoMan(SyntaxDocument doc)
           
 
Method Summary
 void startCombine()
          Start to combine the next operations together.
 void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
          Whenever an UndoableEdit happens the edit will either be absorbed by the current compound edit or a new compound edit will be started
 
Methods inherited from class javax.swing.undo.UndoManager
addEdit, canRedo, canUndo, canUndoOrRedo, discardAllEdits, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redo, redoTo, setLimit, toString, trimEdits, trimForLimit, undo, undoOrRedo, undoTo
 
Methods inherited from class javax.swing.undo.CompoundEdit
die, getPresentationName, isInProgress, isSignificant, lastEdit
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompoundUndoMan

public CompoundUndoMan(SyntaxDocument doc)
Method Detail

undoableEditHappened

public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
Whenever an UndoableEdit happens the edit will either be absorbed by the current compound edit or a new compound edit will be started

Specified by:
undoableEditHappened in interface javax.swing.event.UndoableEditListener
Overrides:
undoableEditHappened in class javax.swing.undo.UndoManager

startCombine

public void startCombine()
Start to combine the next operations together. Only the next operation is combined. The flag is then automatically reset.