protected ObjectReference getThisObject(SuspendContextImpl context, LocatableEvent event)
     throws EvaluateException {
   ThreadReferenceProxyImpl thread = context.getThread();
   if (thread != null) {
     StackFrameProxyImpl stackFrameProxy = thread.frame(0);
     if (stackFrameProxy != null) {
       return stackFrameProxy.thisObject();
     }
   }
   return null;
 }
  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 unsetPausedIfNeeded(DebuggerContextImpl context) {
   SuspendContextImpl suspendContext = context.getSuspendContext();
   if (suspendContext != null && context.getThreadProxy() != suspendContext.getThread()) {
     ((XDebugSessionImpl) getSession()).unsetPaused();
   }
 }