bugfixed stacktrace tooltip

This commit is contained in:
Fredrik Osterlind 2012-03-01 16:37:26 +01:00
parent 656251a6af
commit 28bdc2fb50

View file

@ -335,14 +335,17 @@ public class BufferListener extends VisPlugin {
java.awt.Point p = e.getPoint(); java.awt.Point p = e.getPoint();
int rowIndex = rowAtPoint(p); int rowIndex = rowAtPoint(p);
int colIndex = columnAtPoint(p); int colIndex = columnAtPoint(p);
int columnIndex = convertColumnIndexToModel(colIndex); if (rowIndex < 0 || colIndex < 0) {
if (rowIndex < 0 || columnIndex < 0) { return super.getToolTipText(e);
}
int row = convertRowIndexToModel(rowIndex);
int column = convertColumnIndexToModel(colIndex);
if (row < 0 || column < 0) {
return super.getToolTipText(e); return super.getToolTipText(e);
} }
Object v = getValueAt(rowIndex, columnIndex); if (column == COLUMN_SOURCE) {
if (columnIndex == COLUMN_SOURCE) { BufferAccess ba = logs.get(row);
BufferAccess ba = logs.get(rowIndex);
if (ba.stackTrace != null) { if (ba.stackTrace != null) {
return return
"<html><pre>" + "<html><pre>" +
@ -351,24 +354,25 @@ public class BufferListener extends VisPlugin {
} }
return "No stack trace (enable in popup menu)"; return "No stack trace (enable in popup menu)";
} }
if (v instanceof BufferAccess && parser instanceof GraphicalParser) { if (column == COLUMN_DATA) {
return BufferAccess ba = logs.get(row);
"<html><font face=\"Verdana\">" + if (parser instanceof GraphicalParser) {
StringUtils.hexDump(((BufferAccess)v).mem, 4, 4).replaceAll("\n", "<br>") + return
"</html>"; "<html><pre>" +
} StringUtils.hexDump(ba.mem, 4, 4) +
if (v != null) { "</pre></html>";
String t = v.toString();
if (t.length() > 60) {
StringBuilder sb = new StringBuilder();
sb.append("<html>");
do {
sb.append(t.substring(0, 60)).append("<br>");
t = t.substring(60);
} while (t.length() > 60);
return sb.append(t).append("</html>").toString();
} }
String baString = ba.getParsedString();
StringBuilder sb = new StringBuilder();
sb.append("<html>");
while (baString.length() > 60) {
sb.append(baString.substring(0, 60)).append("<br>");
baString = baString.substring(60);
};
return sb.append(baString).append("</html>").toString();
} }
return super.getToolTipText(e); return super.getToolTipText(e);
} }
}; };