private static boolean shouldRecordActions(@NotNull Document document) {
    if (UndoUtil.isUndoDisabledFor(document)) return false;

    VirtualFile vFile = FileDocumentManager.getInstance().getFile(document);
    if (vFile == null) return true;
    return vFile.getUserData(AbstractFileViewProvider.FREE_THREADED) != Boolean.TRUE &&
           !UndoUtil.isUndoDisabledFor(vFile);
  }
private static boolean shouldRecordActions(@NotNull Document document)