private void updateLookupWidth(LookupElement item, LookupElementPresentation presentation) {
   final Font customFont = myCellRenderer.getFontAbleToDisplay(presentation);
   if (customFont != null) {
     myCustomFonts.put(item, customFont);
   }
   int maxWidth = myCellRenderer.updateMaximumWidth(presentation, item);
   myLookupTextWidth = Math.max(maxWidth, myLookupTextWidth);
 }
  private void updateListHeight(ListModel model) {
    myList.setFixedCellHeight(
        myCellRenderer
            .getListCellRendererComponent(myList, model.getElementAt(0), 0, false, false)
            .getPreferredSize()
            .height);

    myList.setVisibleRowCount(
        Math.min(model.getSize(), UISettings.getInstance().MAX_LOOKUP_LIST_HEIGHT));
  }