AbstractVcs (@Nullable Project project, @NotNull DataContext dataContext) { if (project == null) return null; ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project); AbstractVcs[] activeVcss = vcsManager.getAllActiveVcss(); if (activeVcss.length == 0) return null; if (activeVcss.length == 1) return activeVcss[0]; VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) return null; return ProjectLevelVcsManager.getInstance(project).getVcsFor(file); }