public Object getValueAt(int rowIndex, int columnIndex) {
   final Breakpoint bp = breakPoints.get(rowIndex);
   switch (columnIndex) {
     case COL_BP_ENABLED:
       return bp.isEnabled();
     case COL_BP_ADDRESS:
       return Misc.toHexString(bp.getAddress());
     case COL_BP_EXPRESSION:
       return bp.hasCondition() ? bp.getCondition() : UNCONDITIONAL_BREAKPOINT;
     default:
       return "<unknown column>";
   }
 }
示例#2
0
  private String createLinePrefix(Address pc, Address realAddress, DisassembledLine line) {
    /*
     * The prefix may contain a flag indicating that
     * a breakpoint is present on this line as well
     * as a caret for the current program counter (PC) position.
     *
     * Example:
     *
     * [B] >> 0000: SET a,1
     */

    final Breakpoint breakpoint = emulator.getBreakPoint(realAddress);
    String prefix1 = breakpoint != null ? breakpoint.isEnabled() ? "[B] " : "[_] " : "    ";
    String prefix2 = realAddress.equals(pc) ? ">> " : "   ";
    return prefix1 + prefix2;
  }
 public int getRow(Breakpoint breakpoint) {
   for (int index = 0; index < breakPoints.size(); index++) {
     if (breakPoints.get(index).getAddress().equals(breakpoint.getAddress())) {
       return index;
     }
   }
   throw new IllegalArgumentException("Unknown breakpoint: " + breakpoint);
 }
 public void addBreakpoint(Breakpoint bp) {
   int pos = 0;
   for (; pos < breakPoints.size(); pos++) {
     if (breakPoints.get(pos).getAddress().isGreaterThan(bp.getAddress())) {
       breakPoints.add(pos, bp);
       fireTableRowsInserted(pos, pos);
       return;
     }
   }
   pos = breakPoints.size();
   breakPoints.add(bp);
   fireTableRowsInserted(pos, pos);
 }
    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
      final Breakpoint bp = getBreakpoint(rowIndex);

      switch (columnIndex) {
        case COL_BP_ENABLED:
          bp.setEnabled((Boolean) aValue);
          break;
        case COL_BP_EXPRESSION:
          if (UNCONDITIONAL_BREAKPOINT.equals(aValue)) {
            return;
          }
          try {
            bp.setCondition((String) aValue);
          } catch (ParseException e) {
            e.printStackTrace();
            return;
          }
          break;
        default:
          throw new UnsupportedOperationException("Unhandled column edited: " + columnIndex);
      }
      emulator.breakpointChanged(bp);
    }