/* Remoting */
 private static void checkTargetJPDAInstalled(JavaParameters parameters)
     throws ExecutionException {
   final Sdk jdk = parameters.getJdk();
   if (jdk == null) {
     throw new ExecutionException(DebuggerBundle.message("error.jdk.not.specified"));
   }
   final JavaSdkVersion version = JavaSdk.getInstance().getVersion(jdk);
   String versionString = jdk.getVersionString();
   if (version == JavaSdkVersion.JDK_1_0 || version == JavaSdkVersion.JDK_1_1) {
     throw new ExecutionException(
         DebuggerBundle.message("error.unsupported.jdk.version", versionString));
   }
   if (SystemInfo.isWindows && version == JavaSdkVersion.JDK_1_2) {
     final VirtualFile homeDirectory = jdk.getHomeDirectory();
     if (homeDirectory == null || !homeDirectory.isValid()) {
       throw new ExecutionException(
           DebuggerBundle.message("error.invalid.jdk.home", versionString));
     }
     //noinspection HardCodedStringLiteral
     File dllFile =
         new File(
             homeDirectory.getPath().replace('/', File.separatorChar)
                 + File.separator
                 + "bin"
                 + File.separator
                 + "jdwp.dll");
     if (!dllFile.exists()) {
       GetJPDADialog dialog = new GetJPDADialog();
       dialog.show();
       throw new ExecutionException(DebuggerBundle.message("error.debug.libraries.missing"));
     }
   }
 }
  public boolean processLocatableEvent(
      final SuspendContextCommandImpl action, final LocatableEvent event)
      throws EventProcessingException {
    final SuspendContextImpl context = action.getSuspendContext();
    if (!isValid()) {
      context.getDebugProcess().getRequestsManager().deleteRequest(this);
      return false;
    }

    final String[] title = {DebuggerBundle.message("title.error.evaluating.breakpoint.condition")};

    try {
      final StackFrameProxyImpl frameProxy = context.getThread().frame(0);
      if (frameProxy == null) {
        // might be if the thread has been collected
        return false;
      }

      final EvaluationContextImpl evaluationContext =
          new EvaluationContextImpl(
              action.getSuspendContext(), frameProxy, getThisObject(context, event));

      if (!evaluateCondition(evaluationContext, event)) {
        return false;
      }

      title[0] = DebuggerBundle.message("title.error.evaluating.breakpoint.action");
      runAction(evaluationContext, event);
    } catch (final EvaluateException ex) {
      if (ApplicationManager.getApplication().isUnitTestMode()) {
        System.out.println(ex.getMessage());
        return false;
      }

      throw new EventProcessingException(title[0], ex.getMessage(), ex);
    }

    return true;
  }
  private void runAction(final EvaluationContextImpl context, LocatableEvent event) {
    if (LOG_ENABLED || LOG_EXPRESSION_ENABLED) {
      final StringBuilder buf = StringBuilderSpinAllocator.alloc();
      try {
        if (LOG_ENABLED) {
          buf.append(getEventMessage(event));
          buf.append("\n");
        }
        final DebugProcessImpl debugProcess = context.getDebugProcess();
        final TextWithImports expressionToEvaluate = getLogMessage();
        if (LOG_EXPRESSION_ENABLED
            && expressionToEvaluate != null
            && !"".equals(expressionToEvaluate.getText())) {
          if (!debugProcess.isAttached()) {
            return;
          }

          try {
            ExpressionEvaluator evaluator =
                DebuggerInvocationUtil.commitAndRunReadAction(
                    getProject(),
                    new EvaluatingComputable<ExpressionEvaluator>() {
                      public ExpressionEvaluator compute() throws EvaluateException {
                        return EvaluatorBuilderImpl.build(
                            expressionToEvaluate,
                            ContextUtil.getContextElement(context),
                            ContextUtil.getSourcePosition(context));
                      }
                    });
            final Value eval = evaluator.evaluate(context);
            final String result =
                eval instanceof VoidValue ? "void" : DebuggerUtils.getValueAsString(context, eval);
            buf.append(result);
          } catch (EvaluateException e) {
            buf.append(DebuggerBundle.message("error.unable.to.evaluate.expression"));
            buf.append(" \"");
            buf.append(expressionToEvaluate);
            buf.append("\"");
            buf.append(" : ");
            buf.append(e.getMessage());
          }
          buf.append("\n");
        }
        if (buf.length() > 0) {
          debugProcess.printToConsole(buf.toString());
        }
      } finally {
        StringBuilderSpinAllocator.dispose(buf);
      }
    }
  }