@Override
  public void update(@NotNull AnActionEvent e) {
    EditorSearchSession search = e.getData(EditorSearchSession.SESSION_KEY);
    if (search == null) {
      e.getPresentation().setEnabledAndVisible(false);
      return;
    }

    boolean visible = !search.getFindModel().isReplaceState() || availableForReplace();
    boolean hasMatches = search.hasMatches();
    e.getPresentation().setVisible(visible);
    e.getPresentation().setEnabled(visible && hasMatches && (availableForSelection() || search.getFindModel().isGlobal()));
  }
@Override
  public void update(@NotNull AnActionEvent e)