void () { CodeInsightUtil.sortIdenticalShortNamedMembers(myTargetClasses, myReference); final BaseListPopupStep<PsiClass> step = new BaseListPopupStep<>(QuickFixBundle.message("class.to.import.chooser.title"), myTargetClasses) { @Override public boolean isAutoSelectionEnabled() { return false; } @Override public boolean isSpeedSearchEnabled() { return true; } @Override public PopupStep<?> onChosen(PsiClass selectedValue, boolean finalChoice) { if (selectedValue == null) { return FINAL_CHOICE; } if (finalChoice) { return doFinalStep(() -> { PsiDocumentManager.getInstance(myProject).commitAllDocuments(); addImport(myReference, selectedValue); }); } return getExcludesStep(myProject, selectedValue.getQualifiedName()); } @Override public boolean hasSubstep(PsiClass selectedValue) { return true; } @NotNull @Override public String getTextFor(PsiClass value) { return Objects.requireNonNull(value.getQualifiedName()); } @Override public Icon getIconFor(PsiClass aValue) { return ReadAction.compute(() -> aValue.getIcon(0)); } }; JBPopup popup = JBPopupFactory.getInstance().createListPopup(myProject, step, superRenderer -> { GroupedItemsListRenderer<Object> baseRenderer = (GroupedItemsListRenderer<Object>)superRenderer; ListCellRenderer<Object> psiRenderer = new DefaultPsiElementCellRenderer(); return (list, value, index, isSelected, cellHasFocus) -> { baseRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); JPanel panel = new JPanel(new BorderLayout()) { private final AccessibleContext myAccessibleContext = baseRenderer.getAccessibleContext(); @Override public AccessibleContext getAccessibleContext() { if (myAccessibleContext == null) { return super.getAccessibleContext(); } return myAccessibleContext; } }; panel.add(baseRenderer.getNextStepLabel(), BorderLayout.EAST); panel.add(psiRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus)); return panel; }; }); NavigationUtil.hidePopupIfDumbModeStarts(popup, myProject); popup.showInBestPositionFor(myEditor); }