void (@NotNull Project project, @Nullable Editor editor, PsiFile file) { if (myLibraries.size() == 1) { addLibrary(project, editor, ContainerUtil.getFirstItem(myLibraries.keySet())); } else { JBPopup popup = JBPopupFactory.getInstance() .createPopupChooserBuilder(new ArrayList<>(myLibraries.keySet())) .setRenderer(new SimpleListCellRenderer<>() { @Override public void customize(@NotNull JList<? extends Library> list, Library lib, int index, boolean selected, boolean hasFocus) { if (lib != null) { setText(lib.getPresentableName()); setIcon(AllIcons.Nodes.PpLib); } } }) .setTitle(QuickFixBundle.message("popup.title.choose.library.to.add.dependency.on")) .setMovable(false) .setResizable(false) .setRequestFocus(true) .setItemChosenCallback(selectedValue -> addLibrary(project, editor, selectedValue)) .createPopup(); if (editor != null) { popup.showInBestPositionFor(editor); } else { popup.showCenteredInCurrentWindow(project); } } }