void (EqualsHashCodeTemplatesManager templatesManager, ComboBox<String> comboBox, PsiClass psiClass, Set<String> invalid) { final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(psiClass.getProject()); final GlobalSearchScope resolveScope = psiClass.getResolveScope(); final Set<String> names = new LinkedHashSet<>(); for (TemplateResource resource : templatesManager.getAllTemplates()) { final String templateBaseName = EqualsHashCodeTemplatesManager.getTemplateBaseName(resource); if (names.add(templateBaseName)) { final String className = resource.getClassName(); if (className != null && psiFacade.findClass(className, resolveScope) == null) { invalid.add(templateBaseName); } } } comboBox.setRenderer(SimpleListCellRenderer.create((@NotNull JBLabel label, @NlsContexts.Label String value, int index) -> { label.setText(value); if (invalid.contains(value)) { label.setForeground(JBColor.RED); } })); comboBox.setModel(new DefaultComboBoxModel<>(ArrayUtilRt.toStringArray(names))); comboBox.setSelectedItem(templatesManager.getDefaultTemplateBaseName()); }