public static boolean initiateTransferToSuspendAll(@NotNull SuspendContextImpl suspendContext,
                                                     @NotNull Function<@NotNull SuspendContextImpl, Boolean> performOnSuspendAll) {
    if (suspendContext.getSuspendPolicy() != EventRequest.SUSPEND_EVENT_THREAD) {
      suspendContext.getDebugProcess().logError("Replacing for all-thread mode can be done only from the suspend-thread mode. " +
                                                "suspendContext = " + suspendContext);
      return false;
    }
    @NotNull DebugProcessImpl process = suspendContext.getDebugProcess();
    if (process.myPreparingToSuspendAll) {
      process.mySuspendAllListeners.add(() -> {
        // Now all threads are stopped. But it would be nice to report about it.
        process.getSuspendManager().voteResume(suspendContext);
        suspendContext.getDebugProcess().notifyStoppedOtherThreads();
      });
      return true;
    }

    process.myPreparingToSuspendAll = true;

    String howToSwitchStr = Registry.get("debugger.how.to.switch.to.suspend.all").getSelectedOption();
    HowToSwitchToSuspendAll how = HowToSwitchToSuspendAll.valueOf(howToSwitchStr);
    switch (how) {
      case METHOD_BREAKPOINT -> {
        process.myParametersForSuspendAllReplacing = new ParametersForSuspendAllReplacing(suspendContext, performOnSuspendAll);
        EvaluationListener listener = addFinishEvaluationListener(process);
        boolean isSuccessTry = tryToIssueSuspendContextReplacement(process);
        if (isSuccessTry) {
          process.removeEvaluationListener(listener);
        }
      }

      case PAUSE_WAITING_EVALUATION ->
        suspendWhenNoEvaluation(suspendContext, performOnSuspendAll);

      case IMMEDIATE_PAUSE -> {
        suspendContext.getVirtualMachine().suspend();
        switchToSuspendAll(suspendContext, performOnSuspendAll);
      }
    }
    return true;
  }
public static boolean initiateTransferToSuspendAll(@NotNull SuspendContextImpl suspendContext,
                                                     @NotNull Function<@NotNull SuspendContextImpl, Boolean> performOnSuspendAll)