LightActionGroup () { LightActionGroup popupGroup = new LightActionGroup(false); popupGroup.addSeparator(HgBundle.message("repositories")); List<ActionGroup> rootActions = DvcsUtil.sortRepositories(myRepositoryManager.getRepositories()).stream() .map(repo -> new RootAction<>(repo, new HgBranchPopupActions(repo.getProject(), repo).createActions(), getDisplayableBranchOrBookmarkText(repo))) .collect(toList()); wrapWithMoreActionIfNeeded(myProject, popupGroup, rootActions, rootActions.size() > MAX_NUM ? DEFAULT_NUM : MAX_NUM, SHOW_ALL_REPOSITORIES); return popupGroup; }