CreateListPopupBuilder deprecated

Answered

Hello,

Not a long time ago I've noticed that

JBPopupFactory.createListPopupBuilder(JList list)

is now deprecated, and users should use

JBPopupFactory.createPopupChooserBuilder(List list)

instead.

However, in my case I customize the JList before constructing the popup with some additional fancy icons, etc.:

list.setEmptyText(...);
list.setCellRenderer(...);

JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list)...

With recommended replacement, I cannot get such behaviour, because there a new JBList is created internally and cannot be modified:

public <T> IPopupChooserBuilder<T> createPopupChooserBuilder(@NotNull List<T> list) {
return new PopupChooserBuilder<>(new JBList<>(new CollectionListModel<>(list)));
}

Can you give me other options on how to remove deprecated method and still be able to use my approach?

Thank you!

0
2 comments

Does com.intellij.openapi.ui.popup.PopupChooserBuilder#setRenderer work for you?

1

Yes, it's sufficient for now. Thanks

0

Please sign in to leave a comment.