/** if this line can not be current => stepOver & return true. return false on the other hand. */ boolean resolveCanBeCurrent(ThreadReference tr) { try { Location l = tr.frame(0).location(); if (l == null) return false; return resolveCanBeCurrent( tr, Utils.getLineForSource(l.declaringType().name(), l.sourceName(), l.lineNumber())); } catch (Exception e) { } return false; }
/** Executes breakpoint hit event. */ public void exec(com.sun.jdi.event.Event ev) { // S ystem.out.println ("exec "); // NOI18N removeStepRequest(); StepEvent event = (StepEvent) ev; ThreadReference tr = event.thread(); Location loc = event.location(); int ln = -1; String methodName = "?"; // NOI18N String className = "?"; // NOI18N String lineNumber = "?"; // NOI18N String threadName = tr.name(); Line l = null; if (loc != null) { if (loc.method() != null) methodName = loc.method().name(); className = loc.declaringType().name(); ln = loc.lineNumber(); if (ln >= 0) lineNumber = "" + loc.lineNumber(); } if (ln != -1) try { l = Utils.getLineForSource(className, loc.sourceName(), ln); } catch (AbsentInformationException e) { l = Utils.getLine(className, ln); } if (resolveCanBeCurrent(tr, l)) // if this line can not be current resolveCanBeCurrent () calls stepOver return; // line can be current if ((l == null) && (getLastAction() == ACTION_TRACE_INTO)) // try to find another "intelligent" line of code traceToSourceCode(tr); // you know - intelligent means that one with source code else { makeCurrent(threadName, className, methodName, lineNumber, l != null, tr); operator.stopRequest(); } }