boolean (AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { return false; } HgVcs vcs = Objects.requireNonNull(HgVcs.getInstance(project)); final VirtualFile[] roots = ProjectLevelVcsManager.getInstance(project).getRootsUnderVcs(vcs); if (roots == null || roots.length == 0) { return false; } return true; }