void (@Nullable Project project, @NotNull Document document) { UndoManager undoManager = project != null ? UndoManager.getInstance(project) : UndoManager.getGlobalInstance(); if (undoManager != null) { DocumentReference ref = DocumentReferenceManager.getInstance().create(document); undoManager.nonundoableActionPerformed(ref, false); } }