DefaultActionGroup (@NotNull AnActionEvent e) { Project project = e.getProject(); if (project == null) return null; Set<String> currentVcses = collectVcses(project, e.getDataContext()); if (currentVcses.isEmpty()) return null; List<StandardVcsGroup> groups = new ArrayList<>(); DefaultActionGroup vcsGroup = (DefaultActionGroup)ActionManager.getInstance().getAction("VcsGroup"); for (AnAction child : vcsGroup.getChildren(e)) { StandardVcsGroup standardGroup = ObjectUtils.tryCast(child, StandardVcsGroup.class); if (standardGroup == null) { LOG.error(MessageFormat.format("Any version control group should extend {0}. Violated by {1}, {2}.", // NON-NLS StandardVcsGroup.class, ActionManager.getInstance().getId(child), child.getClass())); continue; } String vcsName = standardGroup.getVcsName(project); if (currentVcses.contains(vcsName)) { groups.add(standardGroup); } } if (groups.isEmpty()) return null; if (groups.size() == 1) return ContainerUtil.getOnlyItem(groups); DefaultActionGroup result = DefaultActionGroup.createPopupGroup(VcsBundle.messagePointer("group.name.version.control")); result.addAll(groups); return result; }