@Override
  public final void update(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    Editor editor = e.getData(CommonDataKeys.HOST_EDITOR);
    if (editor == null) editor = e.getData(CommonDataKeys.EDITOR);
    boolean isActiveEditorPresented = editor != null && !ConsoleViewUtil.isConsoleViewEditor(editor) && !editor.isViewer();
    if (project == null || isActiveEditorPresented) {
      e.getPresentation().setEnabledAndVisible(false);
      return;
    }
    ToolWindow window = getToolWindow(e);
    Window windowAncestor;
    if (window == null) {
      windowAncestor = null;
    }
    else {
      @Nullable Component component = window.getComponent();
      windowAncestor = ComponentUtil.getWindow(component);
    }
    if (windowAncestor instanceof JWindow) {
      windowAncestor = windowAncestor.getOwner(); //SearchEverywhere popup case
    }
    if (windowAncestor instanceof IdeFrame && !(windowAncestor instanceof IdeFrame.Child) &&
        window.isAvailable() && window.isVisible() &&
        window.getType() != ToolWindowType.FLOATING &&
        window.getType() != ToolWindowType.WINDOWED) {
      update(e, window);
    }
    else {
      e.getPresentation().setEnabledAndVisible(false);
    }
  }
@Override
  public final void update(@NotNull AnActionEvent e)