private void chooseTargetClass(List<PsiClass> classes, final Editor editor, Consumer<? super PsiClass> invokeImpl) {
    final PsiClass firstClass = classes.get(0);
    final Project project = firstClass.getProject();

    final PsiClass preselection = AnonymousTargetClassPreselectionUtil.getPreselection(classes, firstClass);
    PsiClassListCellRenderer renderer = new PsiClassListCellRenderer();
    IPopupChooserBuilder<PsiClass> builder = JBPopupFactory.getInstance()
      .createPopupChooserBuilder(classes)
      .setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
      .setSelectedValue(preselection, true)
      .setRenderer(renderer)
      .setItemChosenCallback((aClass) -> {
        AnonymousTargetClassPreselectionUtil.rememberSelection(aClass, firstClass);
        CommandProcessor.getInstance().executeCommand(project, () -> doInvoke(aClass, invokeImpl), getText(), null);
      })
      .setTitle(QuickFixBundle.message("target.class.chooser.title"));

    renderer.installSpeedSearch(builder);
    builder.createPopup().showInBestPositionFor(editor);
  }
private void chooseTargetClass(List<PsiClass> classes, final Editor editor, Consumer<? super PsiClass> invokeImpl)