public static boolean evaluateFinallyBlocks(Project project,
                                              @Nls String title,
                                              JavaStackFrame stackFrame,
                                              XDebuggerEvaluator.XEvaluationCallback callback) {
    if (!DebuggerSettings.EVALUATE_FINALLY_NEVER.equals(DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME)) {
      List<PsiStatement> statements = getFinallyStatements(project, stackFrame.getDescriptor().getSourcePosition());
      if (!statements.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (PsiStatement statement : statements) {
          sb.append("\n").append(statement.getText());
        }
        if (DebuggerSettings.EVALUATE_FINALLY_ALWAYS.equals(DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME)) {
          evaluateAndAct(project, stackFrame, sb, callback);
          return true;
        }
        else {
          int res = MessageDialogBuilder
            .yesNoCancel(title,
                         JavaDebuggerBundle.message("warning.finally.block.detected") + sb)
            .icon(Messages.getWarningIcon())
            .yesText(JavaDebuggerBundle.message("button.execute.finally"))
            .noText(JavaDebuggerBundle.message("button.drop.anyway"))
            .cancelText(CommonBundle.getCancelButtonText())
            .doNotAsk(new DoNotAskOption() {
              @Override
              public boolean isToBeShown() {
                return !DebuggerSettings.EVALUATE_FINALLY_ALWAYS.equals(DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME) &&
                       !DebuggerSettings.EVALUATE_FINALLY_NEVER.equals(DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME);
              }

              @Override
              public void setToBeShown(boolean value, int exitCode) {
                if (!value) {
                  DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME =
                    exitCode == Messages.YES ? DebuggerSettings.EVALUATE_FINALLY_ALWAYS : DebuggerSettings.EVALUATE_FINALLY_NEVER;
                }
                else {
                  DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME = DebuggerSettings.EVALUATE_FINALLY_ASK;
                }
              }

              @Override
              public boolean canBeHidden() {
                return true;
              }

              @Override
              public boolean shouldSaveOptionsOnCancel() {
                return false;
              }

              @NotNull
              @Override
              public String getDoNotShowMessage() {
                return UIBundle.message("dialog.options.do.not.show");
              }
            })
            .show(project);

          switch (res) {
            case Messages.CANCEL -> {
              return true;
            }
            case Messages.NO -> {}
            case Messages.YES -> { // evaluate finally
              evaluateAndAct(project, stackFrame, sb, callback);
              return true;
            }
          }
        }
      }
    }
    return false;
  }
public static boolean evaluateFinallyBlocks(Project project,
                                              @Nls String title,
                                              JavaStackFrame stackFrame,
                                              XDebuggerEvaluator.XEvaluationCallback callback)