private @NotNull Pair<List<Pair<String, Icon>>, Integer> calculateCompactPresentation(@NotNull List<? extends RefGroup> refGroups,
                                                                                        @NotNull List<VcsBookmarkRef> bookmarks,
                                                                                        @NotNull FontMetrics fontMetrics,
                                                                                        @NotNull Color background,
                                                                                        int availableWidth) {
    List<Pair<String, Icon>> labels = new ArrayList<>();
    int width = LEFT_PADDING.get() + RIGHT_PADDING.get();
    int height = fontMetrics.getHeight();

    for (VcsBookmarkRef bookmark : bookmarks) {
      Icon icon = new BookmarkIcon(myComponent, height, background, bookmark);
      boolean isLast = refGroups.isEmpty() && bookmark == ContainerUtil.getLastItem(bookmarks);
      int newWidth = width + icon.getIconWidth() + (isLast ? 0 : COMPACT_MIDDLE_PADDING.get());
      newWidth += getIconTextPadding();

      labels.add(Pair.create("", icon));
      width = newWidth;
    }

    for (RefGroup group : refGroups) {
      List<Color> colors = group.getColors();
      LabelIcon labelIcon = getIcon(height, background, colors);
      boolean isLast = group == ContainerUtil.getLastItem(refGroups);
      int newWidth = width + labelIcon.getIconWidth() + (isLast ? 0 : COMPACT_MIDDLE_PADDING.get());

      String text = shortenRefName(group.getName(), fontMetrics, availableWidth - newWidth);
      newWidth += fontMetrics.stringWidth(text);
      newWidth += getIconTextPadding();

      labels.add(Pair.create(text, labelIcon));
      width = newWidth;
    }

    return Pair.create(labels, width);
  }
private @NotNull Pair<List<Pair<String, Icon>>, Integer> calculateCompactPresentation(@NotNull List<? extends RefGroup> refGroups,
                                                                                        @NotNull List<VcsBookmarkRef> bookmarks,
                                                                                        @NotNull FontMetrics fontMetrics,
                                                                                        @NotNull Color background,
                                                                                        int availableWidth)