void () { removeAll(); int height = getIconHeight(); JBLabel firstLabel = null; for (Map.Entry<VcsRefType, Collection<VcsRef>> typeAndRefs : myGroupedVisibleReferences.entrySet()) { VcsRefType type = typeAndRefs.getKey(); Collection<VcsRef> refs = typeAndRefs.getValue(); int refIndex = 0; for (VcsRef reference : refs) { Icon icon = createIcon(type, refs, refIndex, height); String ending = (refIndex != refs.size() - 1) ? "," : ""; String text = reference.getName() + ending; JBLabel label = createLabel(text, icon); if (firstLabel == null) { firstLabel = label; add(label); } else { addWrapped(label, firstLabel); } refIndex++; } } if (getHiddenReferencesSize() > 0) { JBLabel label = createRestLabel(getHiddenReferencesSize()); addWrapped(label, Objects.requireNonNull(firstLabel)); } setVisible(!myGroupedVisibleReferences.isEmpty()); revalidate(); repaint(); }