public static boolean isEnabled(@Nullable Project project, @Nullable VcsSelection selection) {
    if (project == null || selection == null) return false;

    VirtualFile file = FileDocumentManager.getInstance().getFile(selection.getDocument());
    if (file == null) return false;
    FilePath filePath = VcsUtil.getFilePath(file);

    AbstractVcs activeVcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(file);
    if (activeVcs == null) return false;

    VcsHistoryProvider provider = activeVcs.getVcsBlockHistoryProvider();
    if (provider == null) return false;

    if (!AbstractVcs.fileInVcsByFileStatus(project, filePath)) return false;
    return true;
  }
public static boolean isEnabled(@Nullable Project project, @Nullable VcsSelection selection)