private void popTask() {
    if (tasks.isEmpty() || mostRecentTarget != null) {
      return;
    }

    tasks.pop();

    if (!tasks.isEmpty()) {
      detailCallback.setDetail(tasks.peek());
    } else {
      detailCallback.setDetail(null);
    }
  }
  private void pushTarget(String name, boolean setMostRecentTarget) {
    if (setMostRecentTarget) {
      mostRecentTarget = name;
      junitTotal = 0;
      junitFailures = 0;
      junitErrors = 0;
    } else if (mostRecentTarget != null) {
      return;
    }

    tasks.push(name);
    detailCallback.setDetail(name);
  }
  private void popTarget() {
    if (tasks.isEmpty()) {
      return;
    }

    tasks.pop();

    if (!tasks.isEmpty()) {
      mostRecentTarget = tasks.peek();
    } else {
      mostRecentTarget = null;
    }
    detailCallback.setDetail(mostRecentTarget);
  }
  private void parseMessage(AntEventSummary event) {
    final String message = event.getMessage();

    if (message == null) {
      return;
    }

    final int priority = event.getPriority();

    if (priority == Project.MSG_ERR) {
      detailCallback.reportError(message, event.getFile(), event.getLineNumber(), event.getCode());
    } else if (priority == Project.MSG_WARN) {
      detailCallback.reportWarning(
          message, event.getFile(), event.getLineNumber(), event.getCode());
    }

    final Matcher matcher = JUNIT_SUMMARY.matcher(message);
    if (matcher.matches()) {
      matcher.start();

      junitTotal += Integer.parseInt(matcher.group(1));
      junitFailures += Integer.parseInt(matcher.group(2));
      junitErrors += Integer.parseInt(matcher.group(3));

      final StringBuffer buf =
          new StringBuffer(mostRecentTarget == null ? "junit" : mostRecentTarget);

      buf.append(" (");
      buf.append(junitTotal);
      buf.append("/");
      buf.append(junitFailures);
      buf.append("/");
      buf.append(junitErrors);
      buf.append(")");

      detailCallback.setDetail(buf.toString());
    }
  }