private UndoManager undo = new UndoManager();
UndoRedoSupport(JTextComponent textComponent) {
undoAction = new UndoAction();
redoAction = new RedoAction();
textComponent.getDocument().addUndoableEditListener(new UndoableEditListener() {
@Override
public void undoableEditHappened(UndoableEditEvent e) {
undo.addEdit(e.getEdit());
undoAction.updateUndoState();
redoAction.updateRedoState();