@Override
  protected void showList() {
    if (ApplicationManager.getApplication().isUnitTestMode()) return;

    ListModel<Object> model = myList.getModel();
    if (model == null || model.getSize() == 0) return;

    final JLayeredPane layeredPane = myTextField.getRootPane().getLayeredPane();

    Point location = layeredPane.getLocationOnScreen();
    location.y += layeredPane.getHeight();

    final Dimension preferredScrollPaneSize = myListScrollPane.getPreferredSize();
    preferredScrollPaneSize.width = Math.max(myTextFieldPanel.getWidth(), preferredScrollPaneSize.width);

    // in 'focus follows mouse' mode, to avoid focus escaping to editor, don't reduce popup size when list size is reduced
    if (myDropdownPopup != null && !isCloseByFocusLost()) {
      Dimension currentSize = myDropdownPopup.getSize();
      if (preferredScrollPaneSize.width < currentSize.width) preferredScrollPaneSize.width = currentSize.width;
      if (preferredScrollPaneSize.height < currentSize.height) preferredScrollPaneSize.height = currentSize.height;
    }

    // calculate maximal size for the popup window
    Rectangle screen = ScreenUtil.getScreenRectangle(location);
    if (preferredScrollPaneSize.width > screen.width) {
      preferredScrollPaneSize.width = screen.width;
      if (model.getSize() <= myList.getVisibleRowCount()) {
        JScrollBar hsb = myListScrollPane.getHorizontalScrollBar();
        if (hsb != null && (!SystemInfo.isMac || hsb.isOpaque())) {
          Dimension size = hsb.getPreferredSize();
          if (size != null) preferredScrollPaneSize.height += size.height;
        }
      }
    }
    if (preferredScrollPaneSize.height > screen.height) preferredScrollPaneSize.height = screen.height;

    location.x = Math.min(location.x, screen.x + screen.width - preferredScrollPaneSize.width);
    location.y = Math.min(location.y, screen.y + screen.height - preferredScrollPaneSize.height);

    String adText = getAdText();
    if (myDropdownPopup == null) {
      ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myListScrollPane, myList);
      builder.setFocusable(false)
        .setLocateWithinScreenBounds(false)
        .setRequestFocus(false)
        .setCancelKeyEnabled(false)
        .setFocusOwners(new JComponent[]{myTextField})
        .setBelongsToGlobalPopupStack(false)
        .setModalContext(false)
        .setAdText(adText)
        .setMayBeParent(true);
      builder.setCancelCallback(() -> Boolean.TRUE);
      myDropdownPopup = builder.createPopup();
      myDropdownPopup.setSize(preferredScrollPaneSize);
      myDropdownPopup.showInScreenCoordinates(layeredPane, location);
    }
    else {
      myDropdownPopup.setLocation(location);
      myDropdownPopup.setSize(preferredScrollPaneSize);
    }
  }
@Override
  protected void showList()