@Override
  public void setAdText(@NotNull @NlsContexts.PopupAdvertisement String s, int alignment) {
    JLabel label;
    if (myAdComponent == null || !(myAdComponent instanceof JLabel)) {
      label = HintUtil.createAdComponent(s, JBUI.CurrentTheme.Advertiser.border(), alignment);
      setFooterComponent(label);
    } else {
      label = (JLabel)myAdComponent;
    }

    Dimension prefSize = label.isVisible() ? myAdComponent.getPreferredSize() : JBUI.emptySize();
    boolean keepSize = BasicHTML.isHTMLString(s);

    label.setVisible(StringUtil.isNotEmpty(s));
    label.setText(keepSize ? s : wrapToSize(s));
    label.setHorizontalAlignment(alignment);

    Dimension newPrefSize = label.isVisible() ? myAdComponent.getPreferredSize() : JBUI.emptySize();
    int delta = newPrefSize.height - prefSize.height;

    // Resize popup to match new advertiser size.
    if (myPopup != null && !isBusy() && delta != 0 && !keepSize) {
      Window popupWindow = getContentWindow(myContent);
      if (popupWindow != null) {
        Dimension size = popupWindow.getSize();
        size.height += delta;
        myContent.setPreferredSize(size);
        popupWindow.pack();
        updateMaskAndAlpha(popupWindow);
      }
    }
  }
@Override
  public void setAdText(@NotNull @NlsContexts.PopupAdvertisement String s, int alignment)