LRUPopupBuilder<LanguageItem> (@NotNull Project project, @NotNull @NlsContexts.PopupTitle String title) { FileTypeManager fileTypeManager = FileTypeManager.getInstance(); List<LanguageItem> items = JBIterable.from(LanguageUtil.getFileLanguages()) .map(LanguageItem::fromLanguage) .append(JBIterable.of(fileTypeManager.getRegisteredFileTypes()) .filter(AbstractFileType.class) .map(o -> LanguageItem.fromAbstractFileType(o, getFileTypeExtensions(o, true, fileTypeManager).first()))) .filter(Objects::nonNull) .toList(); Comparator<LanguageItem> comparator = (o1, o2) -> StringUtil.naturalCompare(o1.getDisplayName(), o2.getDisplayName()); return new LRUPopupBuilder<LanguageItem>(project, title) { @Override public String getDisplayName(LanguageItem o) { return o.getDisplayName(); } @Override public Icon getIcon(LanguageItem o) { return ObjectUtils.notNull(o.fileType.getIcon(), AllIcons.FileTypes.Any_type); } @Override public String getStorageId(LanguageItem o) { return o.language != null ? o.language.getID() : o.fileType.getName(); } } .forValues(items) .withComparator(comparator) .withExtraSpeedSearchNamer(o -> o.fileExtension) .withSelection(null); }