private @NotNull RelativePoint findPositionForBulbButton() {
    RelativePoint swCorner = RelativePoint.getSouthWestOf(myLightBulbPanel);
    Point popup = swCorner.getPoint();

    Point panel = SwingUtilities.convertPoint(myLightBulbPanel, new Point(), myEditor.getContentComponent());
    Point caretLine = myEditor.offsetToXY(myEditor.getCaretModel().getOffset());
    if (panel.y + myLightBulbPanel.getHeight() <= caretLine.y) {
      // The light bulb panel is shown above the caret line.
      // The caret line should be completely visible, as it contains the interesting code.
      // The popup menu is shown below the caret line.
      popup.y += 1; // Step outside the light bulb panel.
      popup.y += myEditor.getLineHeight();
    }
    else {
      // Let the top border pixel of the popup menu overlap the bottom border pixel of the light bulb panel.
    }

    // XXX: This formula is only guessed.
    int adjust = (int)(UISettingsUtils.getInstance().getCurrentIdeScale() - 0.5);
    // Align the left border of the popup menu with the light bulb panel.
    // XXX: Where does the 1 come from?
    popup.x += 1 + adjust;
    // Align the top border of the menu bar.
    popup.y += adjust;

    return new RelativePoint(swCorner.getComponent(), popup);
  }
private @NotNull RelativePoint findPositionForBulbButton()