public final @Nullable JBPopup navigateOrCreatePopup() {
      if (myTargets.length == 0) {
        if (!allowEmptyTargets()) {
          return null; // empty initial targets are not allowed
        }
        if (myListUpdaterTask == null || myListUpdaterTask.isFinished()) {
          return null; // there will be no targets.
        }
      }
      if (myTargets.length == 1 && (myListUpdaterTask == null || myListUpdaterTask.isFinished())) {
        myTargetsConsumer.consume(myTargets);
        return null;
      }
      List<T> initialTargetsList = Arrays.asList(myTargets);
      Ref<T[]> updatedTargetsList = Ref.create(myTargets);

      IPopupChooserBuilder<T> builder = JBPopupFactory.getInstance().createPopupChooserBuilder(initialTargetsList);
      afterPopupBuilderCreated(builder);
      if (myListRenderer instanceof PsiElementListCellRenderer<?> psiElementListCellRenderer) {
        psiElementListCellRenderer.installSpeedSearch(builder, true);
        psiElementListCellRenderer.setUsedInPopup(true);
      }

      IPopupChooserBuilder<T> popupChooserBuilder = builder.
        setTitle(myTitle).
        setMovable(true).
        setFont(EditorUtil.getEditorFont()).
        setRenderer(myListRenderer).
        withHintUpdateSupply().
        setResizable(true).
        setItemsChosenCallback(
          elements -> myTargetsConsumer.consume((T[])elements.toArray(NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY))).
        setCancelCallback(() -> {
          if (myListUpdaterTask != null) {
            myListUpdaterTask.cancelTask();
          }
          return true;
        });
      Ref<UsageView> usageView = new Ref<>();
      if (myFindUsagesTitle != null) {
        popupChooserBuilder = popupChooserBuilder.setCouldPin(popup -> {
          usageView.set(FindUtil.showInUsageView(null, updatedTargetsList.get(), myFindUsagesTitle, getProject()));
          popup.cancel();
          return false;
        });
      }

      JBPopup popup = popupChooserBuilder.createPopup();
      if (builder instanceof PopupChooserBuilder<?> castedBuilder) {
        JBList<NavigatablePsiElement> list = (JBList<NavigatablePsiElement>)castedBuilder.getChooserComponent();
        list.setTransferHandler(new TransferHandler() {
          @Override
          protected Transferable createTransferable(JComponent c) {
            Object[] selectedValues = list.getSelectedValues();
            PsiElement[] copy = new PsiElement[selectedValues.length];
            for (int i = 0; i < selectedValues.length; i++) {
              copy[i] = (PsiElement)selectedValues[i];
            }
            return PsiCopyPasteManager.newTransferable(copy);
          }

          @Override
          public int getSourceActions(JComponent c) {
            return COPY;
          }
        });

        JScrollPane pane = castedBuilder.getScrollPane();
        if (ExperimentalUI.isNewUI()) {
          list.setBackground(JBUI.CurrentTheme.Popup.BACKGROUND);
        }
        else {
          pane.setBorder(null);
        }
        pane.setViewportBorder(null);
      }

      if (myListUpdaterTask != null) {
        GenericListComponentUpdater<T> popupUpdater = builder.getBackgroundUpdater();
        myListUpdaterTask.init(popup, new GenericListComponentUpdater<PsiElement>() {
          @Override
          public void replaceModel(@NotNull List<? extends PsiElement> data) {
            T[] array = (T[])data.toArray(NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY);
            updatedTargetsList.set(array);
            popupUpdater.replaceModel(Arrays.asList(array));
          }

          @Override
          public void paintBusy(boolean paintBusy) {
            popupUpdater.paintBusy(paintBusy);
          }
        }, usageView);
      }
      return popup;
    }
public final @Nullable JBPopup navigateOrCreatePopup()