@Override
  public void update(@NotNull AnActionEvent e) {
    Presentation presentation = e.getPresentation();

    Optional<JBPopup> seDialog = getPopup(e);
    if (seDialog.isEmpty()) {
      presentation.setEnabled(false);
      return;
    }

    KeymapManager km = KeymapManager.getInstance();
    Keymap activeKeymap = km != null ? km.getActiveKeymap() : null;
    if (activeKeymap == null) {
      presentation.setEnabled(false);
      return;
    }

    AnAction action = e.getData(SELECTED_ACTION);
    Component component = e.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT);
    presentation.setEnabled(action != null && component != null);
  }
@Override
  public void update(@NotNull AnActionEvent e)