/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
private boolean is64Bit;
private int addressSize;
// Includes any partially-visible row at the bottom
private int numVisibleRows;
// Frequently-used subexpression
private int numUsableRows;
// Multi-row (and multi-column) selection. Have to duplicate state
// from UI so this can work as we scroll off the screen.
private boolean haveAnchor;
private int rowAnchorIndex;
private int colAnchorIndex;
private boolean haveLead;
private int rowLeadIndex;
private int colLeadIndex;
ActionWrapper() {
}
}
return parent;
}
getParent().actionPerformed(e);
}
}
}
super();
if (is64Bit) {
addressSize = 8;
unmappedAddrString = "??????????????????";
} else {
addressSize = 4;
unmappedAddrString = "??????????";
}
setLayout(new BorderLayout());
model = new AbstractTableModel() {
public int getRowCount() {
return numVisibleRows;
}
public int getColumnCount() {
return 2;
}
switch (column) {
case 0: return bigIntToHexString(startVal.add(new BigInteger(Integer.toString((row * addressSize)))));
case 1: {
try {
Address addr = bigIntToAddress(startVal.add(new BigInteger(Integer.toString((row * addressSize)))));
}
return unmappedAddrString;
} catch (UnmappedAddressException e) {
return unmappedAddrString;
}
}
}
}
return false;
}
};
// View with JTable with no header
table.setShowGrid(false);
table.setCellSelectionEnabled(true);
table.setDragEnabled(true);
throw new RuntimeException("Error looking up monospace font Courier");
}
// Export proper data.
// We need to keep our own notion of the selection in order to
// properly export data, since the selection can go beyond the
// visible area on the screen (and since the table's model doesn't
// back all of those slots).
// Code thanks to Shannon.Hickey@sfbay
if (haveSelection()) {
if (j != getColLead()) {
}
}
if (i != getRowLead()) {
}
}
}
return null;
}
public int getSourceActions(JComponent c) {
return COPY;
}
if (canImport(c, t.getTransferDataFlavors())) {
try {
handleImport(c, str);
return true;
} catch (UnsupportedFlavorException ufe) {
} catch (IOException ioe) {
}
}
return false;
}
return true;
}
}
return false;
}
// do whatever you want with the string here
try {
} catch (NumberFormatException e) {
}
}
});
// Supporting keyboard scrolling
// search for Table.AncestorInputMap
// Actions to override:
// selectPreviousRow, selectNextRow,
// scrollUpChangeSelection, scrollDownChangeSelection,
// selectPreviousRowExtendSelection, selectNextRowExtendSelection,
// scrollDownExtendSelection, scrollUpExtendSelection (Shift-PgDn/PgUp)
// Up arrow
public void actionPerformed(ActionEvent e) {
beginUpdate();
} else {
super.actionPerformed(e);
}
endUpdate();
}
});
// Down arrow
public void actionPerformed(ActionEvent e) {
beginUpdate();
if (row >= numUsableRows) {
} else {
super.actionPerformed(e);
}
endUpdate();
}
});
// Page up
public void actionPerformed(ActionEvent e) {
beginUpdate();
if (row >= 0) {
}
endUpdate();
}
});
// Page down
public void actionPerformed(ActionEvent e) {
beginUpdate();
if (row >= 0) {
}
endUpdate();
}
});
// Shift + Up arrow
public void actionPerformed(ActionEvent e) {
beginUpdate();
if (!haveAnchor()) {
// setAnchor(table.getSelectedRow());
// setLead(table.getSelectedRow());
}
int newAnchor = getRowAnchor();
if (newLead < 0) {
++newLead;
++newAnchor;
}
// printSelection();
endUpdate();
}
});
// Shift + Left arrow
public void actionPerformed(ActionEvent e) {
beginUpdate();
if (!haveAnchor()) {
}
// printSelection();
endUpdate();
}
});
// Shift + Down arrow
public void actionPerformed(ActionEvent e) {
beginUpdate();
if (!haveAnchor()) {
// setAnchor(table.getSelectedRow());
// setLead(table.getSelectedRow());
}
int newAnchor = getRowAnchor();
if (newLead > numUsableRows) {
--newLead;
--newAnchor;
}
// printSelection();
endUpdate();
}
});
// Shift + Right arrow
public void actionPerformed(ActionEvent e) {
beginUpdate();
if (!haveAnchor()) {
}
// printSelection();
endUpdate();
}
});
// Shift + Page up
public void actionPerformed(ActionEvent e) {
beginUpdate();
if (!haveAnchor()) {
// setAnchor(table.getSelectedRow());
// setLead(table.getSelectedRow());
}
int newAnchor = getRowAnchor();
if (newLead < 0) {
newLead += numUsableRows;
}
// printSelection();
endUpdate();
}
});
// Shift + Page down
public void actionPerformed(ActionEvent e) {
beginUpdate();
if (!haveAnchor()) {
// setAnchor(table.getSelectedRow());
// setLead(table.getSelectedRow());
}
int newAnchor = getRowAnchor();
if (newLead > numUsableRows) {
newLead -= numUsableRows;
}
// printSelection();
endUpdate();
}
});
// Clear our notion of selection upon mouse press
public void mousePressed(MouseEvent e) {
if (shouldIgnore(e)) {
return;
}
// Make shift-clicking work properly
if (e.isShiftDown()) {
return;
}
// System.err.println(" Clearing selection on mouse press");
}
});
// Watch for mouse going out of bounds
public void mouseDragged(MouseEvent e) {
if (shouldIgnore(e)) {
// System.err.println(" (Ignoring consumed mouse event)");
return;
}
// Look for drag events outside table and scroll if necessary
// See whether we are above or below the table
beginUpdate();
if (p.y < rect.y) {
// System.err.println(" Scrolling up due to mouse event");
// Scroll up
} else {
// System.err.println(" Scrolling down due to mouse event");
// Scroll down
}
// printSelection();
endUpdate();
} else {
}
}
});
// Make sure we recompute number of visible rows
addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
constrain();
}
});
public void hierarchyChanged(HierarchyEvent e) {
constrain();
}
});
}
/** Makes the given address visible somewhere in the window */
}
//----------------------------------------------------------------------
// Internals only below this point
//
private void setupScrollBar() {
if (is64Bit) {
// 64-bit mode
new BigInteger(1, new byte[] {
(byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}),
new BigInteger(1, new byte[] {
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}),
new BigInteger(1, new byte[] {
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFC}));
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08}));
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x40}));
} else {
// 32-bit mode
new BigInteger(1, new byte[] {
(byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00}),
new BigInteger(1, new byte[] {
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}),
new BigInteger(1, new byte[] {
(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFC}));
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04}));
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x20}));
}
public void stateChanged(ChangeEvent e) {
}
});
}
private void updateFromScrollBar() {
beginUpdate();
constrain();
if (oldStartVal != null) {
}
endUpdate();
}
private void constrain() {
}
}
private void recomputeNumVisibleRows() {
int h = table.getRowHeight();
// FIXME: refresh selection
}
}
}
String s = bigIntToHexString(i);
return debugger.parseAddress(s);
}
String s = addressToString(a);
if (!s.startsWith("0x")) {
throw new NumberFormatException(s);
}
}
if (a == null) {
if (is64Bit) {
return "0x0000000000000000";
} else {
return "0x00000000";
}
}
return a.toString();
}
}
}
private void clearSelection() {
haveAnchor = false;
haveLead = false;
}
private int updateLevel;
private void setAnchorFromTable() {
}
private void setLeadFromTable() {
}
haveAnchor = true;
}
rowLeadIndex = row;
colLeadIndex = col;
haveLead = true;
}
}
private void maybeGrabSelection() {
// Grab selection
if (!haveAnchor()) {
// System.err.println("Updating from table's selection");
} else {
// System.err.println("Updating lead from table's selection");
}
// printSelection();
}
}
}
if (haveSelection()) {
getColAnchor(), getColLead());
}
}
private void printSelection() {
", " +
}
}