void (final KeyStroke keyStroke, final boolean shouldPerformAction) { registerPopupKeyboardAction(keyStroke, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (!shouldPerformAction && myChooserComponent.checkResetFilter()) return; closePopup(null, shouldPerformAction); } }); }