private static boolean isActionEnabled(final AnActionEvent e) {
   Project project = e.getData(CommonDataKeys.PROJECT);
   if (project == null) return false;
   VirtualFile vFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
   if (vFile == null) return false;
   AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(vFile);
   if (vcs == null || vcs.getCommittedChangesProvider() == null || !vcs.allowsRemoteCalls(vFile)) {
     return false;
   }
   FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(vFile);
   return AbstractVcs.fileInVcsByFileStatus(project, filePath);
 }
  private static boolean isEnabled(
      @NotNull Project project, @NotNull FilePath path, @NotNull VirtualFile fileOrParent) {
    boolean result = false;
    AbstractVcs vcs = ChangesUtil.getVcsForFile(fileOrParent, project);

    if (vcs != null) {
      VcsHistoryProvider provider = vcs.getVcsHistoryProvider();

      result =
          provider != null
              && (provider.supportsHistoryForDirectories() || !path.isDirectory())
              && AbstractVcs.fileInVcsByFileStatus(project, fileOrParent)
              && provider.canShowHistoryFor(fileOrParent);
    }

    return result;
  }