void (@NotNull ActionEvent e) { Object source = e.getSource(); UndoManager manager = ClientProperty.get(source instanceof Component ? (Component)source : null, UNDO_MANAGER); if (manager != null && manager.canUndo()) { manager.undo(); } }