Esempio n. 1
0
            public override object getValueAt(int rowIndex, int columnIndex)
            {
                MemoryBreakpoint mbp = outerInstance.memoryBreakpoints[rowIndex];

                switch (columnIndex)
                {
                case outerInstance.COL_STARTADDRESS:
                    return(string.Format("0x{0:X8}", mbp.StartAddress));

                case outerInstance.COL_ENDADDRESS:
                    return(string.Format("0x{0:X8}", mbp.EndAddress));

                case outerInstance.COL_ACCESSTYPE:
                    switch (mbp.Access)
                    {
                    case READ:
                        return("READ");

                    case WRITE:
                        return("WRITE");

                    case READWRITE:
                        return("READWRITE");

                    default:
                        throw new System.ArgumentException("unknown access type");
                    }

                case outerInstance.COL_ACTIVE:
                    return((mbp.Enabled) ? true : false);

                default:
                    throw new System.ArgumentException("column out of range: " + columnIndex);
                }
            }
Esempio n. 2
0
        }         //GEN-LAST:event_chkPauseOnHitItemStateChanged

        private void btnAddActionPerformed([email protected] evt)
        {         //GEN-FIRST:event_btnAddActionPerformed
            MemoryBreakpoint mbp = new MemoryBreakpoint();

            memoryBreakpoints.Add(mbp);
            memoryBreakpointsModel.fireTableRowsInserted(memoryBreakpoints.Count - 1, memoryBreakpoints.Count - 1);
        }         //GEN-LAST:event_btnAddActionPerformed
Esempio n. 3
0
        }         //GEN-LAST:event_btnAddActionPerformed

        private void btnRemoveActionPerformed([email protected] evt)
        {         //GEN-FIRST:event_btnRemoveActionPerformed
            int row = tblBreakpoints.SelectedRow;
            MemoryBreakpoint mbp = memoryBreakpoints.RemoveAt(row);

            // make sure breakpoint is uninstalled after being removed
            mbp.Enabled = false;
            memoryBreakpointsModel.fireTableRowsDeleted(row, row);

            // after removal no item is selected - so disable the button once again
            btnRemove.Enabled = false;
        }         //GEN-LAST:event_btnRemoveActionPerformed
Esempio n. 4
0
            public override void setValueAt(object aValue, int rowIndex, int columnIndex)
            {
                MemoryBreakpoint mbp = outerInstance.memoryBreakpoints[rowIndex];

                switch (columnIndex)
                {
                case outerInstance.COL_STARTADDRESS:
                case outerInstance.COL_ENDADDRESS:
                    int address = 0;
                    if (aValue is string)
                    {
                        try
                        {
                            address = Integer.decode((string)aValue);
                        }
                        catch (System.FormatException)
                        {
                            // do nothing - cell will revert to previous value
                            return;
                        }
                    }
                    else if (aValue is int?)
                    {
                        address = ((int?)aValue).Value;
                    }
                    else
                    {
                        throw new System.ArgumentException("only String or Integer values allowed");
                    }

                    if (columnIndex == outerInstance.COL_STARTADDRESS)
                    {
                        mbp.StartAddress = address;
                    }
                    else if (columnIndex == outerInstance.COL_ENDADDRESS)
                    {
                        mbp.EndAddress = address;
                    }
                    break;

                case outerInstance.COL_ACCESSTYPE:
                    string value = ((string)aValue).ToUpper();
                    if (value.Equals("READ"))
                    {
                        mbp.Access = AccessType.READ;
                    }
                    else if (value.Equals("WRITE"))
                    {
                        mbp.Access = AccessType.WRITE;
                    }
                    else if (value.Equals("READWRITE"))
                    {
                        mbp.Access = AccessType.READWRITE;
                    }
                    break;

                case outerInstance.COL_ACTIVE:
                    // TODO check if ranges overlap and prevent update
                    mbp.Enabled = (bool?)aValue.Value;
                    break;

                default:
                    throw new System.ArgumentException("column out of range: " + columnIndex);
                }
                fireTableCellUpdated(rowIndex, columnIndex);
            }