intellij-community icon indicating copy to clipboard operation
intellij-community copied to clipboard

Null check is added for PopupChooserBuilder.myItemChosenRunnable:crea…

Open cyberspaceru opened this issue 6 years ago • 0 comments

Null check is added for PopupChooserBuilder.myItemChosenRunnable:createPopup

When I try to create JBPopup like:

  JBPopupFactory.getInstance()
                .createPopupChooserBuilder(table)
                .setCloseOnEnter(false)
                .createPopup()
                .showInScreenCoordinates(component.getAnchor(), point);

I have to invoke setItemChoosenCallback with a stub to prevent NPE:

  JBPopupFactory.getInstance()
                .createPopupChooserBuilder(table)
                .setItemChoosenCallback(point::toString) // Stub
                .setCloseOnEnter(false)
                .createPopup()
                .showInScreenCoordinates(component.getAnchor(), point);

cyberspaceru avatar Oct 29 '19 11:10 cyberspaceru