private void updatePopupHeight(@NotNull Window popupWindow) {
    Rectangle screenRectangle = ScreenUtil.getScreenRectangle(myToolbar);

    int newHeight = myToolbar.getPreferredSize().height;
    Editor editor = myTextViewer.getEditor();
    if (editor != null) {
      newHeight += editor.getContentComponent().getHeight();
    }
    else {
      newHeight += getMediumTextViewerHeight();
    }

    newHeight = Math.min(newHeight, getMaxPopupHeight(screenRectangle));
    newHeight = Math.max(newHeight, getMinPopupHeight(screenRectangle));

    updatePopupBounds(popupWindow, popupWindow.getWidth(), newHeight);
  }
private void updatePopupHeight(@NotNull Window popupWindow)