AnAction (@NotNull Project project, @NotNull VcsRef ref, @NotNull GitRepository repository, @NotNull List<? extends GitRepository> allRepositories, @NotNull Set<String> commonBranches, @NotNull GitVcsSettings settings, boolean showBranchesPopup) { boolean isSyncBranch = settings.getSyncSetting() != DvcsSyncSettings.Value.DONT_SYNC && allRepositories.size() > 1 && commonBranches.contains(ref.getName()); boolean isLocal = ref.getType() == GitRefManager.LOCAL_BRANCH; List<AnAction> actions = new ArrayList<>(3); if (isSyncBranch) { ActionGroup allReposActions = createBranchActions(project, allRepositories, ref, repository, isLocal); allReposActions.getTemplatePresentation().setText(GitBundle.message("in.branches.all.repositories")); allReposActions.setPopup(true); actions.add(allReposActions); actions.add(Separator.getInstance()); } ActionGroup singleRepoActions = createBranchActions(project, Collections.singletonList(repository), ref, repository, isLocal); singleRepoActions.setPopup(false); actions.add(singleRepoActions); String text = showBranchesPopup ? ref.getName() : GitBundle.message("branches.branch.0", ref.getName()); ActionGroup group = new DefaultActionGroup(actions); group.getTemplatePresentation().setText(text, false); group.setPopup(true); return group; }