public static void showCompletionPopup(JComponent toolbarComponent,
                                         JList<String> list,
                                         @NlsContexts.PopupTitle String title,
                                         JTextComponent textField,
                                         @NlsContexts.PopupAdvertisement String ad) {

    final Runnable callback = () -> {
      String selectedValue = list.getSelectedValue();
      if (selectedValue != null) {
        textField.setText(selectedValue);
        IdeFocusManager.getGlobalInstance().requestFocus(textField, false);
      }
    };

    final PopupChooserBuilder<String> builder = JBPopupFactory.getInstance().createListPopupBuilder(list);
    if (title != null) {
      builder.setTitle(title);
    }
    final JBPopup popup = builder
      .setMovable(false)
      .setResizable(false)
      .setRequestFocus(true)
      .setItemChosenCallback(callback)
      .setRenderer(new GroupedItemsListRenderer<>(new ListItemDescriptorAdapter<>() {
        @Override
        public @Nullable String getTextFor(@NlsContexts.ListItem String item) { return item; }
      }))
      .createPopup();

    if (ad != null) {
      popup.setAdText(ad, SwingConstants.LEFT);
    }

    JComponent parent = toolbarComponent != null ? toolbarComponent : textField;
    AlignedPopup.showUnderneathWithoutAlignment(popup, parent);
  }
public static void showCompletionPopup(JComponent toolbarComponent,
                                         JList<String> list,
                                         @NlsContexts.PopupTitle String title,
                                         JTextComponent textField,
                                         @NlsContexts.PopupAdvertisement String ad)