AbstractAction (Ref<LightCalloutPopup> ref) { return new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { final LightCalloutPopup popup = ref.get(); if (popup != null) { popup.close(); } } }; }