@Override
  public String getEventMessage(LocatableEvent event) {
    final Location location = event.location();
    String sourceName;
    try {
      sourceName = location.sourceName();
    } catch (AbsentInformationException e) {
      sourceName = getFileName();
    }

    final boolean printFullTrace = Registry.is("debugger.breakpoint.message.full.trace");

    StringBuilder builder = new StringBuilder();
    if (printFullTrace) {
      builder.append(
          DebuggerBundle.message(
              "status.line.breakpoint.reached.full.trace",
              DebuggerUtilsEx.getLocationMethodQName(location)));
      try {
        final List<StackFrame> frames = event.thread().frames();
        renderTrace(frames, builder);
      } catch (IncompatibleThreadStateException e) {
        builder.append("Stacktrace not available: ").append(e.getMessage());
      }
    } else {
      builder.append(
          DebuggerBundle.message(
              "status.line.breakpoint.reached",
              DebuggerUtilsEx.getLocationMethodQName(location),
              sourceName,
              getLineIndex() + 1));
    }
    return builder.toString();
  }
Esempio n. 2
0
 protected boolean handleMethodEvent(
     LocatableEvent event, Method method, JDXDebugTarget target, JDXThread thread) {
   try {
     if (isNativeOnly()) {
       if (!method.isNative()) {
         return true;
       }
     }
     if (getMethodName() != null) {
       if (!method.name().equals(getMethodName())) {
         return true;
       }
     }
     if (getMethodSignature() != null) {
       if (!method.signature().equals(getMethodSignature())) {
         return true;
       }
     }
     if (fPattern != null) {
       if (!fPattern.matcher(method.declaringType().name()).find()) {
         return true;
       }
     }
     Integer count = (Integer) event.request().getProperty(HIT_COUNT);
     if (count != null && handleHitCount(event, count)) {
       return true;
     }
     return !suspendForEvent(event, thread); // Resume if suspend fails
   } catch (CoreException e) {
     Plugin.log(e);
   }
   return true;
 }
  public String getEventMessage(LocatableEvent event) {
    final Location location = event.location();
    final String locationQName = location.declaringType().name() + "." + location.method().name();
    String locationFileName = "";
    try {
      locationFileName = location.sourceName();
    } catch (AbsentInformationException e) {
      locationFileName = "";
    }
    final int locationLine = location.lineNumber();

    if (event instanceof MethodEntryEvent) {
      MethodEntryEvent entryEvent = (MethodEntryEvent) event;
      final Method method = entryEvent.method();
      return DebuggerBundle.message(
          "status.method.entry.breakpoint.reached",
          method.declaringType().name() + "." + method.name() + "()",
          locationQName,
          locationFileName,
          locationLine);
    }

    if (event instanceof MethodExitEvent) {
      MethodExitEvent exitEvent = (MethodExitEvent) event;
      final Method method = exitEvent.method();
      return DebuggerBundle.message(
          "status.method.exit.breakpoint.reached",
          method.declaringType().name() + "." + method.name() + "()",
          locationQName,
          locationFileName,
          locationLine);
    }
    return "";
  }
Esempio n. 4
0
 private boolean handleHitCount(LocatableEvent event, Integer count) {
   int hitCount = count.intValue();
   if (hitCount > 0) {
     hitCount--;
     count = new Integer(hitCount);
     event.request().putProperty(HIT_COUNT, count);
     if (hitCount == 0) {
       try {
         setExpired(true);
         setEnabled(false);
       } catch (CoreException e) {
         Plugin.log(e);
       }
       return false;
     }
     return true;
   }
   return true;
 }
 public boolean matchesEvent(final LocatableEvent event) {
   final Method method = event.location().method();
   return method != null && myMethodName.equals(method.name());
 }