void (final List<? extends DomElement> files, final Consumer<? super DomElement> onChoose) { switch (files.size()) { case 0 -> {} case 1 -> onChoose.consume(files.iterator().next()); default -> JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<DomElement>(XmlDomBundle.message( "dom.quickfix.create.new.element.choose.file.title"), files) { @Override public PopupStep onChosen(final DomElement selectedValue, final boolean finalChoice) { onChoose.consume(selectedValue); return super.onChosen(selectedValue, finalChoice); } @Override public Icon getIconFor(final DomElement aValue) { return DomUtil.getFile(aValue).getIcon(0); } @Override @NotNull public String getTextFor(final DomElement value) { return DomUtil.getFile(value).getName(); } }).showInBestPositionFor(DataManager.getInstance().getDataContext()); } }