Lines 114-125
Link Here
|
114 |
|
114 |
|
115 |
private int fBytePerLine; // number of bytes per line: 16 |
115 |
private int fBytePerLine; // number of bytes per line: 16 |
116 |
private int fColumnSize; // number of bytes per column: 1,2,4,8 |
116 |
private int fColumnSize; // number of bytes per column: 1,2,4,8 |
|
|
117 |
private int fAddressibleSize; |
117 |
|
118 |
|
118 |
// font change listener |
119 |
// font change listener |
119 |
private FontChangeListener fFontChangeListener; |
120 |
private FontChangeListener fFontChangeListener; |
120 |
private TabFolderDisposeListener fTabFolderDisposeListener; |
121 |
private TabFolderDisposeListener fTabFolderDisposeListener; |
121 |
|
122 |
|
122 |
private boolean fUpdateTabLabel = true; |
123 |
private boolean fUpdateTabLabel = true; |
|
|
124 |
|
125 |
private EventHandleLock fEvtHandleLock = new EventHandleLock(); |
123 |
|
126 |
|
124 |
private static final int[] ignoreEvents = |
127 |
private static final int[] ignoreEvents = |
125 |
{ |
128 |
{ |
Lines 158-164
Link Here
|
158 |
SWT.CTRL, |
161 |
SWT.CTRL, |
159 |
SWT.ALT |
162 |
SWT.ALT |
160 |
}; |
163 |
}; |
161 |
private int fAddressibleSize; |
164 |
|
|
|
165 |
private class EventHandleLock |
166 |
{ |
167 |
Object fOwner; |
168 |
|
169 |
public boolean acquireLock(Object client) |
170 |
{ |
171 |
if (fOwner == null) |
172 |
{ |
173 |
fOwner = client; |
174 |
return true; |
175 |
} |
176 |
return false; |
177 |
} |
178 |
|
179 |
public boolean releaseLock(Object client) |
180 |
{ |
181 |
if (fOwner == client) |
182 |
{ |
183 |
fOwner = null; |
184 |
return true; |
185 |
} |
186 |
return false; |
187 |
} |
188 |
|
189 |
public boolean isLocked() |
190 |
{ |
191 |
return (fOwner != null); |
192 |
} |
193 |
} |
162 |
|
194 |
|
163 |
private final class TabFolderDisposeListener implements DisposeListener |
195 |
private final class TabFolderDisposeListener implements DisposeListener |
164 |
{ |
196 |
{ |
Lines 218-224
Link Here
|
218 |
|
250 |
|
219 |
if (fTableViewer != null) |
251 |
if (fTableViewer != null) |
220 |
{ |
252 |
{ |
221 |
fTableViewer.getTable().setTopIndex(TABLE_PREBUFFER); |
253 |
setTopIndex(fTableViewer.getTable(), TABLE_PREBUFFER); |
222 |
} |
254 |
} |
223 |
|
255 |
|
224 |
addViewTabToSynchronizer(); |
256 |
addViewTabToSynchronizer(); |
Lines 255-260
Link Here
|
255 |
displayError(e); |
287 |
displayError(e); |
256 |
} |
288 |
} |
257 |
} |
289 |
} |
|
|
290 |
|
291 |
if (!isDisplayingError()) |
292 |
{ |
293 |
updateSyncColSize(); |
294 |
updateSyncTopAddress(true); |
295 |
updateSyncSelectedAddress(true); |
296 |
} |
258 |
} |
297 |
} |
259 |
|
298 |
|
260 |
private void addViewTabToSynchronizer() |
299 |
private void addViewTabToSynchronizer() |
Lines 289-303
Link Here
|
289 |
*/ |
328 |
*/ |
290 |
private void updateSyncSelectedAddress(boolean update) { |
329 |
private void updateSyncSelectedAddress(boolean update) { |
291 |
|
330 |
|
|
|
331 |
if (!fTabCreated) |
332 |
return; |
333 |
|
292 |
if (update) |
334 |
if (update) |
293 |
getMemoryBlockViewSynchronizer().setSynchronizedProperty(getMemoryBlock(), IMemoryViewConstants.PROPERTY_SELECTED_ADDRESS, fSelectedAddress); |
335 |
getMemoryBlockViewSynchronizer().setSynchronizedProperty(this, getMemoryBlock(), IMemoryViewConstants.PROPERTY_SELECTED_ADDRESS, fSelectedAddress); |
294 |
} |
336 |
} |
295 |
|
337 |
|
296 |
/** |
338 |
/** |
297 |
* update column size in synchronizer |
339 |
* update column size in synchronizer |
298 |
*/ |
340 |
*/ |
299 |
private void updateSyncColSize() { |
341 |
private void updateSyncColSize() { |
300 |
getMemoryBlockViewSynchronizer().setSynchronizedProperty(getMemoryBlock(), IMemoryViewConstants.PROPERTY_COL_SIZE, new Integer(fColumnSize)); |
342 |
|
|
|
343 |
if (!fTabCreated) |
344 |
return; |
345 |
|
346 |
getMemoryBlockViewSynchronizer().setSynchronizedProperty(this, getMemoryBlock(), IMemoryViewConstants.PROPERTY_COL_SIZE, new Integer(fColumnSize)); |
301 |
} |
347 |
} |
302 |
|
348 |
|
303 |
/** |
349 |
/** |
Lines 305-313
Link Here
|
305 |
*/ |
351 |
*/ |
306 |
protected void updateSyncTopAddress(boolean updateToSynchronizer) { |
352 |
protected void updateSyncTopAddress(boolean updateToSynchronizer) { |
307 |
|
353 |
|
|
|
354 |
if (!fTabCreated) |
355 |
return; |
356 |
|
308 |
if (updateToSynchronizer) |
357 |
if (updateToSynchronizer) |
309 |
{ |
358 |
{ |
310 |
getMemoryBlockViewSynchronizer().setSynchronizedProperty(getMemoryBlock(), IMemoryViewConstants.PROPERTY_TOP_ADDRESS, getTopVisibleAddress()); |
359 |
getMemoryBlockViewSynchronizer().setSynchronizedProperty(this, getMemoryBlock(), IMemoryViewConstants.PROPERTY_TOP_ADDRESS, getTopVisibleAddress()); |
311 |
} |
360 |
} |
312 |
} |
361 |
} |
313 |
|
362 |
|
Lines 436-442
Link Here
|
436 |
private Control createFolderPage(AbstractMemoryRenderer renderer) { |
485 |
private Control createFolderPage(AbstractMemoryRenderer renderer) { |
437 |
|
486 |
|
438 |
contentProvider = new MemoryViewContentProvider(fMemoryBlock, fTabItem); |
487 |
contentProvider = new MemoryViewContentProvider(fMemoryBlock, fTabItem); |
439 |
fTableViewer= new TableViewer(fTabItem.getParent(), SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.HIDE_SELECTION | SWT.BORDER); |
488 |
fTableViewer= new TableViewer(fTabItem.getParent(), SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.HIDE_SELECTION | SWT.BORDER); |
440 |
fTableViewer.setContentProvider(contentProvider); |
489 |
fTableViewer.setContentProvider(contentProvider); |
441 |
|
490 |
|
442 |
if (renderer != null) |
491 |
if (renderer != null) |
Lines 726-739
Link Here
|
726 |
*/ |
775 |
*/ |
727 |
private void refreshTableViewer() { |
776 |
private void refreshTableViewer() { |
728 |
|
777 |
|
729 |
int i = fTableViewer.getTable().getTopIndex(); |
778 |
int i = getTopVisibleIndex(fTableViewer.getTable()); |
730 |
|
779 |
|
731 |
// refresh if the view is already created |
780 |
// refresh if the view is already created |
732 |
fTableViewer.refresh(); |
781 |
fTableViewer.refresh(); |
733 |
|
782 |
|
734 |
// if top index has changed, restore it |
783 |
// if top index has changed, restore it |
735 |
if (i != fTableViewer.getTable().getTopIndex()) |
784 |
if (i != getTopVisibleIndex(fTableViewer.getTable())) |
736 |
fTableViewer.getTable().setTopIndex(i); |
785 |
setTopIndex(fTableViewer.getTable(), i); |
737 |
} |
786 |
} |
738 |
|
787 |
|
739 |
private void setColumnHeadings() |
788 |
private void setColumnHeadings() |
Lines 902-920
Link Here
|
902 |
*/ |
951 |
*/ |
903 |
protected void updateTableSelection() |
952 |
protected void updateTableSelection() |
904 |
{ |
953 |
{ |
|
|
954 |
|
955 |
MemoryViewUtil.linuxWorkAround(fTableViewer.getTable()); |
956 |
|
905 |
// do not update selection if address is out of range |
957 |
// do not update selection if address is out of range |
906 |
// otherwise, screws up top index |
958 |
// otherwise, screws up top index |
907 |
if (isAddressOutOfRange(fSelectedAddress)) |
959 |
if (isAddressOutOfRange(fSelectedAddress)) |
908 |
return; |
960 |
return; |
909 |
|
961 |
|
910 |
int index = findAddressIndex(getTopVisibleAddress()); |
962 |
int index = findAddressIndex(getTopVisibleAddress()); |
911 |
|
|
|
912 |
// update table selection |
963 |
// update table selection |
913 |
fTableViewer.getTable().setSelection(fCursorManager.fRow); |
964 |
fTableViewer.getTable().setSelection(fCursorManager.fRow); |
|
|
965 |
|
966 |
|
967 |
MemoryViewUtil.linuxWorkAround(fTableViewer.getTable()); |
914 |
|
968 |
|
915 |
// if top index has changed, restore |
969 |
// if top index has changed, restore |
916 |
if (fTableViewer.getTable().getTopIndex() != index) |
970 |
if (getTopVisibleIndex(fTableViewer.getTable()) != index) |
917 |
fTableViewer.getTable().setTopIndex(index); |
971 |
setTopIndex(fTableViewer.getTable(), index); |
|
|
972 |
|
973 |
MemoryViewUtil.linuxWorkAround(fTableViewer.getTable()); |
918 |
} |
974 |
} |
919 |
|
975 |
|
920 |
/** |
976 |
/** |
Lines 1015-1020
Link Here
|
1015 |
case SWT.PAGE_DOWN : |
1071 |
case SWT.PAGE_DOWN : |
1016 |
case SWT.ARROW_DOWN : |
1072 |
case SWT.ARROW_DOWN : |
1017 |
case SWT.ARROW_RIGHT: |
1073 |
case SWT.ARROW_RIGHT: |
|
|
1074 |
|
1075 |
if (!fEvtHandleLock.acquireLock(this)) |
1076 |
return; |
1077 |
|
1018 |
// If blocking an extended memory block, |
1078 |
// If blocking an extended memory block, |
1019 |
// check to see if additional memory needs to be obtained. |
1079 |
// check to see if additional memory needs to be obtained. |
1020 |
if (fMemoryBlock instanceof IMemoryBlockExtension) |
1080 |
if (fMemoryBlock instanceof IMemoryBlockExtension) |
Lines 1032-1037
Link Here
|
1032 |
updateSyncSelectedAddress(true); |
1092 |
updateSyncSelectedAddress(true); |
1033 |
|
1093 |
|
1034 |
fCursorManager.setCursorFocus(); |
1094 |
fCursorManager.setCursorFocus(); |
|
|
1095 |
fEvtHandleLock.releaseLock(this); |
1035 |
break; |
1096 |
break; |
1036 |
} |
1097 |
} |
1037 |
//if we are approaching the limits of the currently loaded memory, reload the table |
1098 |
//if we are approaching the limits of the currently loaded memory, reload the table |
Lines 1044-1049
Link Here
|
1044 |
if (topAddress.equals(BigInteger.valueOf(0))) |
1105 |
if (topAddress.equals(BigInteger.valueOf(0))) |
1045 |
{ |
1106 |
{ |
1046 |
// do not reload if we are already at zero |
1107 |
// do not reload if we are already at zero |
|
|
1108 |
fEvtHandleLock.releaseLock(this); |
1047 |
break; |
1109 |
break; |
1048 |
} |
1110 |
} |
1049 |
reloadTable(BigInteger.valueOf(0), false); |
1111 |
reloadTable(BigInteger.valueOf(0), false); |
Lines 1077-1083
Link Here
|
1077 |
// when it is selected |
1139 |
// when it is selected |
1078 |
} |
1140 |
} |
1079 |
} |
1141 |
} |
1080 |
|
1142 |
fEvtHandleLock.releaseLock(this); |
1081 |
break; |
1143 |
break; |
1082 |
default : |
1144 |
default : |
1083 |
|
1145 |
|
Lines 1112-1118
Link Here
|
1112 |
return BigInteger.valueOf(0); |
1174 |
return BigInteger.valueOf(0); |
1113 |
|
1175 |
|
1114 |
Table table = fTableViewer.getTable(); |
1176 |
Table table = fTableViewer.getTable(); |
1115 |
int topIndex = table.getTopIndex(); |
1177 |
int topIndex = getTopVisibleIndex(table); |
1116 |
|
1178 |
|
1117 |
if (topIndex < 1) { topIndex = 0; } |
1179 |
if (topIndex < 1) { topIndex = 0; } |
1118 |
|
1180 |
|
Lines 1131-1137
Link Here
|
1131 |
} |
1193 |
} |
1132 |
|
1194 |
|
1133 |
BigInteger bigInt = new BigInteger(calculatedAddress, 16); |
1195 |
BigInteger bigInt = new BigInteger(calculatedAddress, 16); |
1134 |
|
|
|
1135 |
return bigInt; |
1196 |
return bigInt; |
1136 |
} |
1197 |
} |
1137 |
return BigInteger.valueOf(0); |
1198 |
return BigInteger.valueOf(0); |
Lines 1171-1177
Link Here
|
1171 |
numLines = getNumberOfVisibleLines()+TABLE_PREBUFFER+TABLE_POSTBUFFER; |
1232 |
numLines = getNumberOfVisibleLines()+TABLE_PREBUFFER+TABLE_POSTBUFFER; |
1172 |
} |
1233 |
} |
1173 |
|
1234 |
|
1174 |
|
|
|
1175 |
// tell content provider to get memory and refresh |
1235 |
// tell content provider to get memory and refresh |
1176 |
contentProvider.getMemoryToFitTable(topBufferAddress, numLines, updateDelta); |
1236 |
contentProvider.getMemoryToFitTable(topBufferAddress, numLines, updateDelta); |
1177 |
contentProvider.forceRefresh(); |
1237 |
contentProvider.forceRefresh(); |
Lines 1183-1189
Link Here
|
1183 |
|
1243 |
|
1184 |
if (topIdx != -1) |
1244 |
if (topIdx != -1) |
1185 |
{ |
1245 |
{ |
1186 |
table.setTopIndex(topIdx); |
1246 |
setTopIndex(table, topIdx); |
1187 |
} |
1247 |
} |
1188 |
|
1248 |
|
1189 |
// TODO: Revisit this part again |
1249 |
// TODO: Revisit this part again |
Lines 1203-1210
Link Here
|
1203 |
|
1263 |
|
1204 |
if (newIdx != topIdx && topIdx != -1) |
1264 |
if (newIdx != topIdx && topIdx != -1) |
1205 |
{ |
1265 |
{ |
1206 |
table.setTopIndex(topIdx); |
1266 |
setTopIndex(table, topIdx); |
1207 |
} |
1267 |
} |
|
|
1268 |
|
1269 |
MemoryViewUtil.linuxWorkAround(table); |
1208 |
|
1270 |
|
1209 |
if (isAddressVisible(fSelectedAddress)) |
1271 |
if (isAddressVisible(fSelectedAddress)) |
1210 |
{ |
1272 |
{ |
Lines 1223-1228
Link Here
|
1223 |
|
1285 |
|
1224 |
// try to display the table every time it's reloaded |
1286 |
// try to display the table every time it's reloaded |
1225 |
displayTable(); |
1287 |
displayTable(); |
|
|
1288 |
|
1289 |
MemoryViewUtil.linuxWorkAround(fTableViewer.getTable()); |
1226 |
} |
1290 |
} |
1227 |
|
1291 |
|
1228 |
private int findAddressIndex(BigInteger address) |
1292 |
private int findAddressIndex(BigInteger address) |
Lines 1283-1301
Link Here
|
1283 |
// setting cursor selection or table selection changes |
1347 |
// setting cursor selection or table selection changes |
1284 |
// the top index of the table... and may mess up top index in the talbe |
1348 |
// the top index of the table... and may mess up top index in the talbe |
1285 |
// save up old top index |
1349 |
// save up old top index |
1286 |
int oldTop = fTableViewer.getTable().getTopIndex(); |
1350 |
int oldTop = getTopVisibleIndex(fTableViewer.getTable()); |
1287 |
|
1351 |
|
1288 |
// update cursor position and table selection |
1352 |
// update cursor position and table selection |
1289 |
fCursorManager.updateCursorPosition(row, col, isAddressVisible(fSelectedAddress)); |
1353 |
fCursorManager.updateCursorPosition(row, col, isAddressVisible(fSelectedAddress)); |
1290 |
updateTableSelection(); |
1354 |
updateTableSelection(); |
1291 |
|
1355 |
|
1292 |
// reset top index to make sure the table is not moved |
1356 |
// reset top index to make sure the table is not moved |
1293 |
fTableViewer.getTable().setTopIndex(oldTop); |
1357 |
if (!MemoryViewUtil.isLinuxGTK()) |
|
|
1358 |
setTopIndex(fTableViewer.getTable(), oldTop); |
1294 |
|
1359 |
|
1295 |
if (isAddressVisible(fSelectedAddress)) |
1360 |
if (isAddressVisible(fSelectedAddress)) |
1296 |
{ |
1361 |
{ |
1297 |
fCursorManager.showCursor(); |
1362 |
fCursorManager.showCursor(); |
1298 |
fTableViewer.getTable().deselectAll(); |
1363 |
|
|
|
1364 |
if (!MemoryViewUtil.isLinuxGTK()) |
1365 |
fTableViewer.getTable().deselectAll(); |
1299 |
} |
1366 |
} |
1300 |
else |
1367 |
else |
1301 |
fCursorManager.hideCursor(); |
1368 |
fCursorManager.hideCursor(); |
Lines 1423-1429
Link Here
|
1423 |
if (table.isDisposed()) |
1490 |
if (table.isDisposed()) |
1424 |
return; |
1491 |
return; |
1425 |
|
1492 |
|
1426 |
int topIndex = table.getTopIndex(); |
1493 |
int topIndex = getTopVisibleIndex(table); |
1427 |
if (topIndex < 0) |
1494 |
if (topIndex < 0) |
1428 |
{ |
1495 |
{ |
1429 |
return; |
1496 |
return; |
Lines 1468-1481
Link Here
|
1468 |
// since the position may change |
1535 |
// since the position may change |
1469 |
|
1536 |
|
1470 |
updateCursorPosition(); |
1537 |
updateCursorPosition(); |
1471 |
fTableViewer.getTable().deselectAll(); |
1538 |
|
|
|
1539 |
// this is commented out to reduce the amount |
1540 |
// of flashing happening on Linux GTK |
1541 |
if (!MemoryViewUtil.isLinuxGTK()) |
1542 |
fTableViewer.getTable().deselectAll(); |
1472 |
|
1543 |
|
1473 |
if (!getTopVisibleAddress().equals(oldTopAddress)) |
1544 |
if (!getTopVisibleAddress().equals(oldTopAddress)) |
1474 |
{ |
1545 |
{ |
1475 |
int i = findAddressIndex(oldTopAddress); |
1546 |
int i = findAddressIndex(oldTopAddress); |
1476 |
|
1547 |
|
1477 |
if (i != -1) |
1548 |
if (i != -1) |
1478 |
fTableViewer.getTable().setTopIndex(i); |
1549 |
setTopIndex(fTableViewer.getTable(), i); |
1479 |
} |
1550 |
} |
1480 |
} |
1551 |
} |
1481 |
|
1552 |
|
Lines 1488-1495
Link Here
|
1488 |
* Handle scrollling and reload table if necessary |
1559 |
* Handle scrollling and reload table if necessary |
1489 |
* @param event |
1560 |
* @param event |
1490 |
*/ |
1561 |
*/ |
1491 |
private void handleScrollBarSelection(SelectionEvent event) |
1562 |
private synchronized void handleScrollBarSelection(SelectionEvent event) |
1492 |
{ |
1563 |
{ |
|
|
1564 |
if (fEvtHandleLock.isLocked()) |
1565 |
return; |
1566 |
|
1567 |
if (!fTabCreated) |
1568 |
return; |
1569 |
|
1493 |
if (!(fMemoryBlock instanceof IMemoryBlockExtension)) |
1570 |
if (!(fMemoryBlock instanceof IMemoryBlockExtension)) |
1494 |
{ |
1571 |
{ |
1495 |
// if not instance of extended memory block |
1572 |
// if not instance of extended memory block |
Lines 1503-1509
Link Here
|
1503 |
|
1580 |
|
1504 |
// Must run on UI Thread asynchronously |
1581 |
// Must run on UI Thread asynchronously |
1505 |
// Otherwise, another event could have been recevied before the reload is completed |
1582 |
// Otherwise, another event could have been recevied before the reload is completed |
1506 |
Display.getDefault().asyncExec(new Runnable() |
1583 |
Display.getDefault().syncExec(new Runnable() |
1507 |
{ |
1584 |
{ |
1508 |
public void run() |
1585 |
public void run() |
1509 |
{ |
1586 |
{ |
Lines 1511-1516
Link Here
|
1511 |
{ |
1588 |
{ |
1512 |
switch (evt.detail) |
1589 |
switch (evt.detail) |
1513 |
{ |
1590 |
{ |
|
|
1591 |
case 0: |
1514 |
case SWT.DRAG : |
1592 |
case SWT.DRAG : |
1515 |
case SWT.END : |
1593 |
case SWT.END : |
1516 |
case SWT.PAGE_DOWN : |
1594 |
case SWT.PAGE_DOWN : |
Lines 1518-1523
Link Here
|
1518 |
case SWT.HOME : |
1596 |
case SWT.HOME : |
1519 |
case SWT.PAGE_UP : |
1597 |
case SWT.PAGE_UP : |
1520 |
case SWT.ARROW_UP : |
1598 |
case SWT.ARROW_UP : |
|
|
1599 |
|
1600 |
if (!fEvtHandleLock.acquireLock(this)) |
1601 |
return; |
1602 |
|
1521 |
if (fMemoryBlock instanceof IMemoryBlockExtension) |
1603 |
if (fMemoryBlock instanceof IMemoryBlockExtension) |
1522 |
{ |
1604 |
{ |
1523 |
updateSyncTopAddress(true); |
1605 |
updateSyncTopAddress(true); |
Lines 1525-1536
Link Here
|
1525 |
if (needMoreLines()) |
1607 |
if (needMoreLines()) |
1526 |
{ |
1608 |
{ |
1527 |
BigInteger topAddress = getTopVisibleAddress(); |
1609 |
BigInteger topAddress = getTopVisibleAddress(); |
|
|
1610 |
|
1528 |
//if we're near 0, just go there immediately (hard stop at 0, don't try to scroll/wrap) |
1611 |
//if we're near 0, just go there immediately (hard stop at 0, don't try to scroll/wrap) |
1529 |
if (topAddress.compareTo(BigInteger.valueOf(96)) <= 0) |
1612 |
if (topAddress.compareTo(BigInteger.valueOf(96)) <= 0) |
1530 |
{ |
1613 |
{ |
1531 |
if (topAddress.equals(BigInteger.valueOf(0))) |
1614 |
if (topAddress.equals(BigInteger.valueOf(0))) |
1532 |
{ |
1615 |
{ |
1533 |
// do not reload if we are already at zero |
1616 |
// do not reload if we are already at zero |
|
|
1617 |
fEvtHandleLock.releaseLock(this); |
1534 |
break; |
1618 |
break; |
1535 |
} |
1619 |
} |
1536 |
reloadTable(BigInteger.valueOf(0), false); |
1620 |
reloadTable(BigInteger.valueOf(0), false); |
Lines 1548-1553
Link Here
|
1548 |
updateCursorPosition(); |
1632 |
updateCursorPosition(); |
1549 |
fCursorManager.setCursorFocus(); |
1633 |
fCursorManager.setCursorFocus(); |
1550 |
} |
1634 |
} |
|
|
1635 |
fEvtHandleLock.releaseLock(this); |
1551 |
break; |
1636 |
break; |
1552 |
default: |
1637 |
default: |
1553 |
break; |
1638 |
break; |
Lines 1819-1825
Link Here
|
1819 |
// go to top of the table |
1904 |
// go to top of the table |
1820 |
BigInteger address = BigInteger.valueOf(mem.getStartAddress()); |
1905 |
BigInteger address = BigInteger.valueOf(mem.getStartAddress()); |
1821 |
setSelectedAddress(address, true); |
1906 |
setSelectedAddress(address, true); |
1822 |
getTableViewer().getTable().setTopIndex(0); |
1907 |
setTopIndex(fTableViewer.getTable(), 0); |
1823 |
updateCursorPosition(); |
1908 |
updateCursorPosition(); |
1824 |
updateTableSelection(); |
1909 |
updateTableSelection(); |
1825 |
setCursorFocus(); |
1910 |
setCursorFocus(); |
Lines 1938-1954
Link Here
|
1938 |
*/ |
2023 |
*/ |
1939 |
public void setFont(Font font) |
2024 |
public void setFont(Font font) |
1940 |
{ |
2025 |
{ |
1941 |
int oldIdx = fTableViewer.getTable().getTopIndex(); |
2026 |
int oldIdx = getTopVisibleIndex(fTableViewer.getTable()); |
1942 |
|
2027 |
|
1943 |
// BUG in table, if font is changed when table is not starting |
2028 |
// BUG in table, if font is changed when table is not starting |
1944 |
// from the top, causes table gridline to be misaligned. |
2029 |
// from the top, causes table gridline to be misaligned. |
1945 |
fTableViewer.getTable().setTopIndex(0); |
2030 |
setTopIndex(fTableViewer.getTable(), 0); |
1946 |
|
2031 |
|
1947 |
// set font |
2032 |
// set font |
1948 |
fTableViewer.getTable().setFont(font); |
2033 |
fTableViewer.getTable().setFont(font); |
1949 |
fCursorManager.setFont(font); |
2034 |
fCursorManager.setFont(font); |
1950 |
|
2035 |
|
1951 |
fTableViewer.getTable().setTopIndex(oldIdx); |
2036 |
setTopIndex(fTableViewer.getTable(), oldIdx); |
1952 |
|
2037 |
|
1953 |
packColumns(); |
2038 |
packColumns(); |
1954 |
|
2039 |
|
Lines 2012-2017
Link Here
|
2012 |
return; |
2097 |
return; |
2013 |
} |
2098 |
} |
2014 |
|
2099 |
|
|
|
2100 |
if (!fEvtHandleLock.acquireLock(this)) |
2101 |
return; |
2102 |
|
2015 |
try |
2103 |
try |
2016 |
{ |
2104 |
{ |
2017 |
if (!fSelectedAddress.equals(address)) |
2105 |
if (!fSelectedAddress.equals(address)) |
Lines 2034-2039
Link Here
|
2034 |
{ |
2122 |
{ |
2035 |
displayError(e); |
2123 |
displayError(e); |
2036 |
} |
2124 |
} |
|
|
2125 |
fEvtHandleLock.releaseLock(this); |
2037 |
} |
2126 |
} |
2038 |
|
2127 |
|
2039 |
/** |
2128 |
/** |
Lines 2048-2053
Link Here
|
2048 |
if (!isEnabled()) |
2137 |
if (!isEnabled()) |
2049 |
return; |
2138 |
return; |
2050 |
|
2139 |
|
|
|
2140 |
if (!fEvtHandleLock.acquireLock(this)) |
2141 |
return; |
2142 |
|
2051 |
if (!address.equals(getTopVisibleAddress())) |
2143 |
if (!address.equals(getTopVisibleAddress())) |
2052 |
{ |
2144 |
{ |
2053 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) |
2145 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) |
Lines 2074-2080
Link Here
|
2074 |
if (index >= 3 && table.getItemCount() - (index+getNumberOfVisibleLines()) >= 3) |
2166 |
if (index >= 3 && table.getItemCount() - (index+getNumberOfVisibleLines()) >= 3) |
2075 |
{ |
2167 |
{ |
2076 |
// update cursor position |
2168 |
// update cursor position |
2077 |
table.setTopIndex(index); |
2169 |
setTopIndex(table, index); |
2078 |
|
2170 |
|
2079 |
if (!isAddressVisible(fSelectedAddress)) |
2171 |
if (!isAddressVisible(fSelectedAddress)) |
2080 |
{ |
2172 |
{ |
Lines 2084-2090
Link Here
|
2084 |
{ |
2176 |
{ |
2085 |
updateCursorPosition(); |
2177 |
updateCursorPosition(); |
2086 |
updateTableSelection(); |
2178 |
updateTableSelection(); |
2087 |
table.setTopIndex(index); |
2179 |
setTopIndex(table, index); |
2088 |
|
2180 |
|
2089 |
// BUG 64831: to get around SWT problem with |
2181 |
// BUG 64831: to get around SWT problem with |
2090 |
// the table cursor not painted properly after |
2182 |
// the table cursor not painted properly after |
Lines 2127-2133
Link Here
|
2127 |
|
2219 |
|
2128 |
if (index >= 0) |
2220 |
if (index >= 0) |
2129 |
{ |
2221 |
{ |
2130 |
table.setTopIndex(index); |
2222 |
setTopIndex(table, index); |
2131 |
|
2223 |
|
2132 |
if (!isAddressVisible(fSelectedAddress)) |
2224 |
if (!isAddressVisible(fSelectedAddress)) |
2133 |
{ |
2225 |
{ |
Lines 2137-2143
Link Here
|
2137 |
{ |
2229 |
{ |
2138 |
updateCursorPosition(); |
2230 |
updateCursorPosition(); |
2139 |
updateTableSelection(); |
2231 |
updateTableSelection(); |
2140 |
table.setTopIndex(index); |
2232 |
setTopIndex(table, index); |
2141 |
|
2233 |
|
2142 |
// BUG 64831: to get around SWT problem with |
2234 |
// BUG 64831: to get around SWT problem with |
2143 |
// the table cursor not painted properly after |
2235 |
// the table cursor not painted properly after |
Lines 2153-2158
Link Here
|
2153 |
{ |
2245 |
{ |
2154 |
displayError(e); |
2246 |
displayError(e); |
2155 |
} |
2247 |
} |
|
|
2248 |
fEvtHandleLock.releaseLock(this); |
2156 |
} |
2249 |
} |
2157 |
|
2250 |
|
2158 |
/** |
2251 |
/** |
Lines 2238-2248
Link Here
|
2238 |
/* (non-Javadoc) |
2331 |
/* (non-Javadoc) |
2239 |
* @see org.eclipse.debug.ui.ISynchronizedMemoryBlockView#propertyChanged(java.lang.String, java.lang.Object) |
2332 |
* @see org.eclipse.debug.ui.ISynchronizedMemoryBlockView#propertyChanged(java.lang.String, java.lang.Object) |
2240 |
*/ |
2333 |
*/ |
2241 |
public void propertyChanged(String propertyName, Object value) |
2334 |
public void propertyChanged(Object evtSrc, String propertyName, Object value) |
2242 |
{ |
2335 |
{ |
2243 |
if (isDisplayingError()) |
2336 |
if (isDisplayingError()) |
2244 |
return; |
2337 |
return; |
2245 |
|
2338 |
|
|
|
2339 |
if (evtSrc == this) |
2340 |
return; |
2341 |
|
2246 |
if (propertyName.equals(IMemoryViewConstants.PROPERTY_SELECTED_ADDRESS) && value instanceof BigInteger) |
2342 |
if (propertyName.equals(IMemoryViewConstants.PROPERTY_SELECTED_ADDRESS) && value instanceof BigInteger) |
2247 |
{ |
2343 |
{ |
2248 |
try { |
2344 |
try { |
Lines 2441-2446
Link Here
|
2441 |
// an error and if it's enabled |
2537 |
// an error and if it's enabled |
2442 |
if (!isDisplayingError() && enabled && fEnabled) |
2538 |
if (!isDisplayingError() && enabled && fEnabled) |
2443 |
synchronize(); |
2539 |
synchronize(); |
|
|
2540 |
} |
2541 |
|
2542 |
private static int getTopVisibleIndex(Table table) |
2543 |
{ |
2544 |
MemoryViewUtil.linuxWorkAround(table); |
2545 |
int index = table.getTopIndex(); |
2546 |
|
2547 |
TableItem item = table.getItem(index); |
2548 |
|
2549 |
MemoryViewUtil.linuxWorkAround(table); |
2550 |
while (item.getBounds(0).y < 0) |
2551 |
{ |
2552 |
index++; |
2553 |
item = table.getItem(index); |
2554 |
} |
2555 |
|
2556 |
return index; |
2557 |
} |
2558 |
|
2559 |
private static void setTopIndex(Table table, int index) |
2560 |
{ |
2561 |
MemoryViewUtil.linuxWorkAround(table); |
2562 |
table.setTopIndex(index); |
2444 |
} |
2563 |
} |
2445 |
} |
2564 |
} |
2446 |
|
2565 |
|