String (@NotNull @NlsSafe String refName, @NotNull FontMetrics fontMetrics, int availableWidth) { if (fontMetrics.stringWidth(refName) > availableWidth && refName.length() > MAX_LENGTH) { int separatorIndex = refName.indexOf(SEPARATOR); if (separatorIndex > TWO_DOTS.length()) { refName = TWO_DOTS + refName.substring(separatorIndex); } if (availableWidth > 0) { return VcsLogUiUtil.shortenTextToFit(refName, fontMetrics, availableWidth, MAX_LENGTH, StringUtil.ELLIPSIS); } return StringUtil.shortenTextWithEllipsis(refName, MAX_LENGTH, 0, StringUtil.ELLIPSIS); } return refName; }