ListCellRenderer<ScopeDescriptor> () { return new GroupedComboBoxRenderer<>(this) { @NotNull @Override public @NlsContexts.ListItem String getText(ScopeDescriptor item) { String text = item.getDisplayName(); return text == null ? super.getText(item) : text; } @Nullable @Override public Icon getIcon(ScopeDescriptor item) { return item.getIcon(); } @Nullable @Override public ListSeparator separatorFor(ScopeDescriptor value) { String firstElementDisplayName = value.getDisplayName(); if (firstElementDisplayName != null) return scopeModel.getSeparatorName(value.getDisplayName()); return null; } @Override public void customize(@NotNull SimpleColoredComponent item, ScopeDescriptor value, int index, boolean isSelected, boolean cellHasFocus) { if (value == null) return; super.customize(item, value, index, isSelected, cellHasFocus); } }; }