public static void showPopup(AnActionEvent e, JBPopup popup) {
   final InputEvent event = e.getInputEvent();
   if (event instanceof MouseEvent) {
     popup.showUnderneathOf(event.getComponent());
   } else {
     popup.showInBestPositionFor(e.getDataContext());
   }
 }
 @Override
 public void update(AnActionEvent e) {
   e.getPresentation().setEnabled(myScope.isValid());
 }
 @Override
 public void update(AnActionEvent e) {
   super.update(e);
   final Presentation presentation = e.getPresentation();
   presentation.setEnabled(allTargetsAreValid());
 }
 @Override
 public void update(AnActionEvent e) {
   super.update(e);
   e.getPresentation().setVisible(myContent != null);
 }