LRUPopupBuilder<Language> (@NotNull Project project, @NotNull @PopupTitle String title, @Nullable Function<? super Language, ? extends Icon> iconProvider) { return new LRUPopupBuilder<Language>(project, title) { @Override public String getDisplayName(Language language) { return language.getDisplayName(); } @Override public Icon getIcon(Language language) { if (iconProvider != null) return iconProvider.apply(language); LanguageFileType fileType = language.getAssociatedFileType(); Icon icon = fileType == null ? null : fileType.getIcon(); return icon != null ? icon : AllIcons.FileTypes.Any_type; } @Override public String getStorageId(Language language) { return language.getID(); } }.withComparator(LanguageUtil.LANGUAGE_COMPARATOR); }