void (Editor editor, List<? extends TestFramework> frameworks, final Consumer<? super TestFramework> consumer) { if (frameworks.size() == 1) { consumer.consume(frameworks.get(0)); return; } DefaultListCellRenderer cellRenderer = new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component result = super.getListCellRendererComponent(list, "", index, isSelected, cellHasFocus); if (value == null) return result; TestFramework framework = (TestFramework)value; setIcon(framework.getIcon()); setText(framework.getName()); return result; } }; JBPopupFactory.getInstance() .createPopupChooserBuilder(frameworks) .setRenderer(cellRenderer) .setNamerForFiltering(o -> o.getName()) .setTitle(JavaBundle.message("popup.title.choose.framework")) .setItemChosenCallback(consumer) .setMovable(true) .createPopup().showInBestPositionFor(editor); }