DefaultActionGroup (@NotNull Groups groups) { List<AnAction> actionGroup = new ArrayList<>(); for (Map.Entry<@NlsActions.ActionText String, Collection<VcsRef>> entry : groups.singletonGroups.entrySet()) { actionGroup.add(createAction(entry.getKey(), entry.getValue())); } if (!groups.recentGroups.isEmpty()) { List<AnAction> recents = new ArrayList<>(); for (List<String> recentItem : groups.recentGroups) { createRecentAction(recents, recentItem); } DefaultActionGroup recentGroup = new DefaultActionGroup(VcsLogBundle.message("vcs.log.filter.recent"), recents); recentGroup.setPopup(true); actionGroup.add(recentGroup); } if (groups.favoriteGroups.size() > 1) { createFavoritesAction(actionGroup, new ArrayList<>(ContainerUtil.map2LinkedSet(ContainerUtil.flatten(groups.favoriteGroups.values()), ref -> ref.getName()))); } for (Map.Entry<@NlsActions.ActionText String, Collection<VcsRef>> entry : groups.favoriteGroups.entrySet()) { actionGroup.add(createAction(entry.getKey(), entry.getValue())); } for (Map.Entry<@NlsContexts.Separator String, TreeMap<@NlsActions.ActionText String, Collection<VcsRef>>> group : groups.expandedGroups.entrySet()) { actionGroup.add(Separator.create(group.getKey())); for (Map.Entry<@NlsActions.ActionText String, Collection<VcsRef>> entry : group.getValue().entrySet()) { actionGroup.add(createAction(entry.getKey(), entry.getValue())); } } actionGroup.add(Separator.getInstance()); for (Map.Entry<@NlsActions.ActionText String, TreeMap<@NlsActions.ActionText String, Collection<VcsRef>>> group : groups.collapsedGroups.entrySet()) { List<AnAction> collapsed = new ArrayList<>(); for (Map.Entry<@NlsActions.ActionText String, Collection<VcsRef>> entry : group.getValue().entrySet()) { collapsed.add(createCollapsedAction(entry.getKey(), entry.getValue())); } DefaultActionGroup popupGroup = new DefaultActionGroup(group.getKey(), collapsed); popupGroup.setPopup(true); actionGroup.add(popupGroup); } return new DefaultActionGroup(actionGroup); }