/** * Attempt to find the breakpoint the user has clicked on, using as much information as is * available to this popup. * * @param bpman breakpoint manager to search through. * @return breakpoint if found, null if not. * @throws ViewException if the line does not contain code. */ protected Breakpoint findBreakpoint(BreakpointManager bpman) throws ViewException { if (classLines == null) { // Fall back on the default behavior. return super.findBreakpoint(bpman); } // Get the class at this line. lastClickedClass = ClassDefinition.findClassForLine(classLines, lastClickedLine); if (lastClickedClass == null) { throw new NonCodeLineException(); } // Query existing set of breakpoints for this class and line. return bpman.getBreakpoint(lastClickedClass, lastClickedLine); } // findBreakpoint
/** * Try to add a breakpoint at the last clicked class and line. Displays an appropriate error * message if needed. * * @param session Session. * @param bpman breakpoint manager. * @return new breakpoint if successful, null if error. */ protected Breakpoint addBreakpoint(Session session, BreakpointManager bpman) { if (lastClickedClass == null) { // Fall back on default behavior. return super.addBreakpoint(session, bpman); } try { String fname = sourceSrc.getName(); Breakpoint bp = new LineBreakpoint(lastClickedClass, fname, lastClickedLine); bpman.addNewBreakpoint(bp); return bp; } catch (ClassNotFoundException cnfe) { session .getUIAdapter() .showMessage( UIAdapter.MESSAGE_ERROR, Bundle.getString("AddBreak.invalidClassMsg") + ' ' + lastClickedClass); return null; } catch (ResolveException re) { session.getUIAdapter().showMessage(UIAdapter.MESSAGE_ERROR, re.errorMessage()); return null; } } // addBreakpoint