public static void supportUndo(final JTextComponent tc) {
		final UndoManager undoManager = new UndoManager();
		onContentEdit(tc.getDocument(), new P1<UndoableEditEvent> () {public void e(UndoableEditEvent e) {
			if (e.getEdit().getPresentationName().startsWith("st")) {
				return;
			}
			
			undoManager.addEdit(e.getEdit());
		}});
		
		tc.addKeyListener(new KeyAdapter() {
			public void keyPressed(KeyEvent e) {
                if (e.isControlDown()) {
					if ('Z' == e.getKeyCode()) {
						if (undoManager.canUndo()) {
							undoManager.undo();
						}
					} else if ('Y' == e.getKeyCode()) {
						if (undoManager.canRedo()) {
							undoManager.redo();
						}
					}
				}
			}
		});
	}