public static @Nls String truncateStringWithEllipsis(final @Nls String text, final int maxWidth, final FontMetrics fm) {
    return truncateStringWithEllipsis(text, maxWidth, new WidthCalculator() {
      @Override
      public int stringWidth(String s) {
        return fm.stringWidth(s);
      }

      @Override
      public int charWidth(char c) {
        return fm.charWidth(c);
      }
    });
  }
public static @Nls String truncateStringWithEllipsis(final @Nls String text, final int maxWidth, final FontMetrics fm)