Пример #1
0
  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;
  }
Пример #2
0
  protected static boolean scheduleCommand(
      EvaluationContextImpl evaluationContext,
      @NotNull final XCompositeNode node,
      final SuspendContextCommandImpl command) {
    evaluationContext
        .getManagerThread()
        .schedule(
            new SuspendContextCommandImpl(command.getSuspendContext()) {
              @Override
              public void contextAction() throws Exception {
                command.contextAction();
              }

              @Override
              protected void commandCancelled() {
                node.setErrorMessage(DebuggerBundle.message("error.context.has.changed"));
              }
            });
    return true;
  }