void showNotEmpty(@NotNull Project project, @NotNull GotoData gotoData, @NotNull Consumer<? super JBPopup> showPopup) {
    PsiElement[] targets = gotoData.targets;
    List<AdditionalAction> additionalActions = gotoData.additionalActions;

    boolean finished = gotoData.listUpdaterTask == null || gotoData.listUpdaterTask.isFinished();
    if (targets.length == 1 && additionalActions.isEmpty() && finished) {
      navigateToElement(targets[0]);
      return;
    }

    final String name = ((NavigationItem)gotoData.source).getName();
    final String title = getChooserTitle(gotoData.source, name, targets.length, finished);

    gotoData.initPresentations();
    List<ItemWithPresentation> allElements = new ArrayList<>(targets.length + additionalActions.size());
    allElements.addAll(gotoData.getItems());
    if (shouldSortTargets()) {
      allElements.sort(createComparator(gotoData));
    }
    allElements.addAll(ContainerUtil.map(additionalActions, action -> new ItemWithPresentation(action,
                                                                                               TargetPresentation.builder(action.getText())
                                                                                                 .icon(action.getIcon()).presentation())));

    final IPopupChooserBuilder<ItemWithPresentation> builder = JBPopupFactory.getInstance().createPopupChooserBuilder(allElements);
    final Ref<UsageView> usageView = new Ref<>();
    builder.setNamerForFiltering(item -> {
      if (item.getItem() instanceof AdditionalAction) {
        return ((AdditionalAction)item.getItem()).getText();
      }
      return item.getPresentation().getPresentableText();
    }).setTitle(title);
    if (useEditorFont()) {
      builder.setFont(EditorUtil.getEditorFont());
    }
    var renderer = new GotoTargetRendererNew(o -> ((ItemWithPresentation)o).getPresentation());
    builder.setRenderer(renderer).
      setItemsChosenCallback(selectedElements -> {
        for (ItemWithPresentation element : selectedElements) {
          if (element.getItem() instanceof AdditionalAction) {
            ((AdditionalAction)element.getItem()).execute();
          }
          else {
            navigate(project, element, navigatable -> navigateToElement(navigatable));
          }
        }
      }).
      withHintUpdateSupply().
      setMovable(true).
      setCancelCallback(() -> {
        final BackgroundUpdaterTaskBase<ItemWithPresentation> task = gotoData.listUpdaterTask;
        if (task != null) {
          task.cancelTask();
        }
        return true;
      }).
      setCouldPin(popup1 -> {
        usageView.set(FindUtil.showInUsageView(gotoData.source, gotoData.targets,
                                               getFindUsagesTitle(gotoData.source, name, gotoData.targets.length),
                                               gotoData.source.getProject()));
        popup1.cancel();
        return false;
      }).
      setAdText(getAdText(gotoData.source, targets.length));
    final JBPopup popup = builder.createPopup();

    JScrollPane pane = builder instanceof PopupChooserBuilder ? ((PopupChooserBuilder<?>)builder).getScrollPane() : null;
    if (pane != null) {
      if (!ExperimentalUI.isNewUI()) {
        pane.setBorder(null);
      }
      pane.setViewportBorder(null);
    }

    if (gotoData.listUpdaterTask != null) {
      Alarm alarm = new Alarm(popup);
      alarm.addRequest(() -> showPopup.accept(popup), 300);
      gotoData.listUpdaterTask.init(popup, builder.getBackgroundUpdater(), usageView);
      ProgressManager.getInstance().run(gotoData.listUpdaterTask);
    }
    else {
      showPopup.accept(popup);
    }
    if (ApplicationManager.getApplication().isUnitTestMode()) {
      popup.closeOk(null);
    }
  }
void showNotEmpty(@NotNull Project project, @NotNull GotoData gotoData, @NotNull Consumer<? super JBPopup> showPopup)