Lines 22-27
Link Here
|
22 |
import org.eclipse.debug.internal.ui.DebugUIMessages; |
22 |
import org.eclipse.debug.internal.ui.DebugUIMessages; |
23 |
import org.eclipse.debug.internal.ui.DebugUIPlugin; |
23 |
import org.eclipse.debug.internal.ui.DebugUIPlugin; |
24 |
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; |
24 |
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; |
|
|
25 |
import org.eclipse.debug.internal.ui.memory.IMemoryBlockConnection; |
25 |
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; |
26 |
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; |
26 |
import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil; |
27 |
import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil; |
27 |
import org.eclipse.debug.internal.ui.views.memory.renderings.CopyTableRenderingToClipboardAction; |
28 |
import org.eclipse.debug.internal.ui.views.memory.renderings.CopyTableRenderingToClipboardAction; |
Lines 183-194
Link Here
|
183 |
private KeyAdapter fEditorKeyListener; |
184 |
private KeyAdapter fEditorKeyListener; |
184 |
private SelectionAdapter fCursorSelectionListener; |
185 |
private SelectionAdapter fCursorSelectionListener; |
185 |
private IWorkbenchAdapter fWorkbenchAdapter; |
186 |
private IWorkbenchAdapter fWorkbenchAdapter; |
|
|
187 |
private IMemoryBlockConnection fConnection; |
186 |
|
188 |
|
187 |
private boolean fIsShowAddressColumn = true; |
189 |
private boolean fIsShowAddressColumn = true; |
188 |
private SelectionAdapter fScrollbarSelectionListener; |
190 |
private SelectionAdapter fScrollbarSelectionListener; |
189 |
|
191 |
|
190 |
private PropertyDialogAction fPropertiesAction; |
192 |
private PropertyDialogAction fPropertiesAction; |
191 |
|
193 |
|
|
|
194 |
private int fPageSize; |
195 |
private NextPageAction fNextAction; |
196 |
private PrevPageAction fPrevAction; |
197 |
|
192 |
private class EventHandleLock |
198 |
private class EventHandleLock |
193 |
{ |
199 |
{ |
194 |
Object fOwner; |
200 |
Object fOwner; |
Lines 252-257
Link Here
|
252 |
} |
258 |
} |
253 |
} |
259 |
} |
254 |
|
260 |
|
|
|
261 |
|
262 |
private class NextPageAction extends Action |
263 |
{ |
264 |
private NextPageAction() |
265 |
{ |
266 |
super(); |
267 |
setText(DebugUIMessages.AbstractTableRendering_4); |
268 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".NextPageAction_context"); //$NON-NLS-1$ |
269 |
} |
270 |
|
271 |
public void run() { |
272 |
BigInteger address = fContentInput.getLoadAddress(); |
273 |
address = address.add(BigInteger.valueOf(getPageSizeInUnits())); |
274 |
handlePageStartAddressChanged(address); |
275 |
} |
276 |
} |
277 |
|
278 |
private class PrevPageAction extends Action |
279 |
{ |
280 |
private PrevPageAction() |
281 |
{ |
282 |
super(); |
283 |
setText(DebugUIMessages.AbstractTableRendering_6); |
284 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".PrevPageAction_context"); //$NON-NLS-1$ |
285 |
} |
286 |
|
287 |
public void run() { |
288 |
BigInteger address = fContentInput.getLoadAddress(); |
289 |
address = address.subtract(BigInteger.valueOf(getPageSizeInUnits())); |
290 |
handlePageStartAddressChanged(address); |
291 |
} |
292 |
} |
293 |
|
255 |
/** |
294 |
/** |
256 |
* Constructs a new table rendering of the specified type. |
295 |
* Constructs a new table rendering of the specified type. |
257 |
* |
296 |
* |
Lines 288-293
Link Here
|
288 |
|
327 |
|
289 |
Object evtSrc = event.getSource(); |
328 |
Object evtSrc = event.getSource(); |
290 |
|
329 |
|
|
|
330 |
if (event.getProperty().equals(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE)) { |
331 |
// always update page size, only refresh if the table is visible |
332 |
getPageSizeFromPreference(); |
333 |
} |
334 |
|
291 |
// do not handle event if the rendering is displaying an error |
335 |
// do not handle event if the rendering is displaying an error |
292 |
if (isDisplayingError()) |
336 |
if (isDisplayingError()) |
293 |
return; |
337 |
return; |
Lines 296-301
Link Here
|
296 |
if (!isVisible()) |
340 |
if (!isVisible()) |
297 |
return; |
341 |
return; |
298 |
|
342 |
|
|
|
343 |
if (event.getProperty().equals(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM)) { |
344 |
handleDyanicLoadChanged(); |
345 |
return; |
346 |
} |
347 |
|
348 |
if (event.getProperty().equals(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE)) { |
349 |
if (!isDynamicLoad()) |
350 |
{ |
351 |
// only refresh if in non-autoload mode |
352 |
refresh(); |
353 |
} |
354 |
return; |
355 |
} |
356 |
|
299 |
if (evtSrc == this) |
357 |
if (evtSrc == this) |
300 |
return; |
358 |
return; |
301 |
|
359 |
|
Lines 324-333
Link Here
|
324 |
{ |
382 |
{ |
325 |
if (needMoreLines()) |
383 |
if (needMoreLines()) |
326 |
{ |
384 |
{ |
327 |
reloadTable(getTopVisibleAddress(), false); |
385 |
if (isDynamicLoad()) |
|
|
386 |
reloadTable(getTopVisibleAddress(), false); |
328 |
} |
387 |
} |
329 |
topVisibleAddressChanged((BigInteger)value); |
388 |
topVisibleAddressChanged((BigInteger)value); |
330 |
} |
389 |
} |
|
|
390 |
else if (propertyName.equals(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS) && value instanceof BigInteger) |
391 |
{ |
392 |
handlePageStartAddressChanged((BigInteger)value); |
393 |
} |
394 |
} |
395 |
|
396 |
private void handleDyanicLoadChanged() { |
397 |
|
398 |
// if currently in dynamic load mode, update page |
399 |
// start address |
400 |
updateSyncPageStartAddress(); |
401 |
|
402 |
updateDynamicLoadProperty(); |
403 |
if (isDynamicLoad()) |
404 |
{ |
405 |
refresh(); |
406 |
} |
407 |
else |
408 |
{ |
409 |
BigInteger pageStart = (BigInteger)getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS); |
410 |
if (pageStart == null) |
411 |
pageStart = fTopRowAddress; |
412 |
handlePageStartAddressChanged(pageStart); |
413 |
} |
414 |
} |
415 |
|
416 |
private void updateDynamicLoadProperty() { |
417 |
|
418 |
boolean value = DebugUIPlugin |
419 |
.getDefault() |
420 |
.getPreferenceStore() |
421 |
.getBoolean(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM); |
422 |
|
423 |
if (value != isDynamicLoad()) |
424 |
{ |
425 |
fContentProvider.setDynamicLoad(value); |
426 |
|
427 |
if (!fIsDisposed) { |
428 |
if (isDynamicLoad()) { |
429 |
fContentInput.setPostBuffer(20); |
430 |
fContentInput.setPreBuffer(20); |
431 |
fContentInput.setDefaultBufferSize(20); |
432 |
fContentInput.setNumLines(getNumberOfVisibleLines()); |
433 |
|
434 |
} else { |
435 |
fContentInput.setPostBuffer(0); |
436 |
fContentInput.setPreBuffer(0); |
437 |
fContentInput.setDefaultBufferSize(0); |
438 |
fContentInput.setNumLines(fPageSize); |
439 |
} |
440 |
} |
441 |
} |
331 |
} |
442 |
} |
332 |
|
443 |
|
333 |
/** |
444 |
/** |
Lines 339-344
Link Here
|
339 |
// do not handle event if view tab is disabled |
450 |
// do not handle event if view tab is disabled |
340 |
if (!isVisible()) |
451 |
if (!isVisible()) |
341 |
return; |
452 |
return; |
|
|
453 |
|
454 |
// do not handle event if the base address of the memory |
455 |
// block has changed, wait for debug event to update to |
456 |
// new location |
457 |
if (isBaseAddressChanged()) |
458 |
return; |
342 |
|
459 |
|
343 |
if (!address.equals(fTopRowAddress)) |
460 |
if (!address.equals(fTopRowAddress)) |
344 |
{ |
461 |
{ |
Lines 406-417
Link Here
|
406 |
} |
523 |
} |
407 |
else |
524 |
else |
408 |
{ |
525 |
{ |
409 |
reloadTable(address, false); |
526 |
if (isDynamicLoad()) |
|
|
527 |
reloadTable(address, false); |
528 |
else |
529 |
setTopIndex(table, index); |
410 |
} |
530 |
} |
411 |
} |
531 |
} |
412 |
else if ((numInBuffer-(index+getNumberOfVisibleLines())) < 3) |
532 |
else if ((numInBuffer-(index+getNumberOfVisibleLines())) < 3) |
413 |
{ |
533 |
{ |
414 |
if (!isAtBottomLimit()) |
534 |
if (!isAtBottomLimit() && isDynamicLoad()) |
415 |
reloadTable(address, false); |
535 |
reloadTable(address, false); |
416 |
else |
536 |
else |
417 |
setTopIndex(table, index); |
537 |
setTopIndex(table, index); |
Lines 440-451
Link Here
|
440 |
*/ |
560 |
*/ |
441 |
private void selectedAddressChanged(BigInteger value) { |
561 |
private void selectedAddressChanged(BigInteger value) { |
442 |
|
562 |
|
|
|
563 |
// do not handle event if the base address of the memory |
564 |
// block has changed, wait for debug event to update to |
565 |
// new location |
566 |
if (isBaseAddressChanged()) |
567 |
return; |
568 |
|
443 |
try { |
569 |
try { |
444 |
goToAddress(value); |
570 |
// do not handle event if the event is out of range and the |
|
|
571 |
// rendering is in non-dynamic-load mode, otherwise, will |
572 |
// cause rendering to continue to scroll when it shouldn't |
573 |
if (isDynamicLoad()) |
574 |
goToAddress(value); |
575 |
else if (!isAddressOutOfRange(value)) |
576 |
goToAddress(value); |
445 |
} catch (DebugException e) { |
577 |
} catch (DebugException e) { |
446 |
// do nothing |
578 |
// do nothing |
447 |
} |
579 |
} |
448 |
} |
580 |
} |
|
|
581 |
|
582 |
private void handlePageStartAddressChanged(BigInteger address) |
583 |
{ |
584 |
// do not handle if in dynamic mode |
585 |
if (isDynamicLoad()) |
586 |
return; |
587 |
|
588 |
if (fContentInput == null) |
589 |
return; |
590 |
|
591 |
if (!(getMemoryBlock() instanceof IMemoryBlockExtension)) |
592 |
return; |
593 |
|
594 |
// do not handle event if the base address of the memory |
595 |
// block has changed, wait for debug event to update to |
596 |
// new location |
597 |
if (isBaseAddressChanged()) |
598 |
return; |
599 |
|
600 |
if(fContentProvider.getBufferTopAddress().equals(address)) |
601 |
return; |
602 |
|
603 |
BigInteger start = fContentInput.getStartAddress(); |
604 |
BigInteger end = fContentInput.getEndAddress(); |
605 |
|
606 |
// smaller than start address, load at start address |
607 |
if (address.compareTo(start) < 0) |
608 |
{ |
609 |
if (isAtTopLimit()) |
610 |
return; |
611 |
|
612 |
address = start; |
613 |
} |
614 |
|
615 |
// bigger than end address, no need to load, alread at top |
616 |
if (address.compareTo(end) > 0) |
617 |
{ |
618 |
if (isAtBottomLimit()) |
619 |
return; |
620 |
|
621 |
address = end.subtract(BigInteger.valueOf(getPageSizeInUnits())); |
622 |
} |
623 |
|
624 |
fContentInput.setLoadAddress(address); |
625 |
refresh(); |
626 |
updateSyncPageStartAddress(); |
627 |
setTopIndex(fTableViewer.getTable(), 0); |
628 |
fTopRowAddress = address; |
629 |
updateSyncTopAddress(); |
630 |
|
631 |
BigInteger selectedAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS); |
632 |
if (selectedAddress != null) |
633 |
{ |
634 |
fSelectedAddress = selectedAddress; |
635 |
if (!isAddressOutOfRange(fSelectedAddress)) |
636 |
{ |
637 |
setCursorAtAddress(fSelectedAddress); |
638 |
fTableCursor.setVisible(true); |
639 |
} |
640 |
else |
641 |
{ |
642 |
fTableCursor.setVisible(false); |
643 |
} |
644 |
} |
645 |
} |
449 |
|
646 |
|
450 |
/* (non-Javadoc) |
647 |
/* (non-Javadoc) |
451 |
* @see org.eclipse.debug.ui.memory.IMemoryRendering#createControl(org.eclipse.swt.widgets.Composite) |
648 |
* @see org.eclipse.debug.ui.memory.IMemoryRendering#createControl(org.eclipse.swt.widgets.Composite) |
Lines 480-485
Link Here
|
480 |
fTableViewer.setLabelProvider(labelProvider); |
677 |
fTableViewer.setLabelProvider(labelProvider); |
481 |
|
678 |
|
482 |
fContentProvider = new TableRenderingContentProvider(); |
679 |
fContentProvider = new TableRenderingContentProvider(); |
|
|
680 |
fContentProvider.setDynamicLoad(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM)); |
681 |
|
483 |
fTableViewer.setContentProvider(fContentProvider); |
682 |
fTableViewer.setContentProvider(fContentProvider); |
484 |
fContentProvider.setViewer(fTableViewer); |
683 |
fContentProvider.setViewer(fTableViewer); |
485 |
|
684 |
|
Lines 557-563
Link Here
|
557 |
selectedAddress = BigInteger.valueOf(address); |
756 |
selectedAddress = BigInteger.valueOf(address); |
558 |
} |
757 |
} |
559 |
} |
758 |
} |
560 |
fSelectedAddress = selectedAddress; |
759 |
setSelectedAddress(selectedAddress); |
561 |
// figure out top visible address |
760 |
// figure out top visible address |
562 |
BigInteger topVisibleAddress = (BigInteger) getSynchronizedProperty(AbstractTableRendering.PROPERTY_TOP_ADDRESS); |
761 |
BigInteger topVisibleAddress = (BigInteger) getSynchronizedProperty(AbstractTableRendering.PROPERTY_TOP_ADDRESS); |
563 |
if (topVisibleAddress == null) |
762 |
if (topVisibleAddress == null) |
Lines 575-581
Link Here
|
575 |
topVisibleAddress = BigInteger.valueOf(getMemoryBlock().getStartAddress()); |
774 |
topVisibleAddress = BigInteger.valueOf(getMemoryBlock().getStartAddress()); |
576 |
} |
775 |
} |
577 |
} |
776 |
} |
578 |
fContentInput = new TableRenderingContentInput(this, 20, 20, 20, topVisibleAddress, getNumberOfVisibleLines(), false); |
777 |
|
|
|
778 |
getPageSizeFromPreference(); |
779 |
if (isDynamicLoad()) |
780 |
fContentInput = new TableRenderingContentInput(this, 20, 20, 20, topVisibleAddress, getNumberOfVisibleLines(), false); |
781 |
else |
782 |
{ |
783 |
BigInteger addressToLoad = topVisibleAddress; |
784 |
|
785 |
// check synchronization service to see if we need to sync with another rendering |
786 |
Object obj = getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS); |
787 |
if (obj != null && obj instanceof BigInteger) |
788 |
{ |
789 |
addressToLoad = (BigInteger)obj; |
790 |
} |
791 |
fContentInput = new TableRenderingContentInput(this, 0, 0, 0, addressToLoad, fPageSize, false); |
792 |
} |
793 |
|
579 |
fTableViewer.setInput(fContentInput); |
794 |
fTableViewer.setInput(fContentInput); |
580 |
fCellModifier = new TableRenderingCellModifier(this); |
795 |
fCellModifier = new TableRenderingCellModifier(this); |
581 |
fTableViewer.setCellModifier(fCellModifier); |
796 |
fTableViewer.setCellModifier(fCellModifier); |
Lines 637-642
Link Here
|
637 |
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); |
852 |
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); |
638 |
} |
853 |
} |
639 |
|
854 |
|
|
|
855 |
private void getPageSizeFromPreference() |
856 |
{ |
857 |
fPageSize = DebugUIPlugin.getDefault().getPreferenceStore().getInt(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE); |
858 |
} |
859 |
|
640 |
private void createCursor(Table table, BigInteger address) |
860 |
private void createCursor(Table table, BigInteger address) |
641 |
{ |
861 |
{ |
642 |
fTableCursor = new TableCursor(table, SWT.NONE); |
862 |
fTableCursor = new TableCursor(table, SWT.NONE); |
Lines 758-764
Link Here
|
758 |
// when the cursor is moved, the selected address is changed |
978 |
// when the cursor is moved, the selected address is changed |
759 |
if (selectedAddress != null && !selectedAddress.equals(fSelectedAddress)) |
979 |
if (selectedAddress != null && !selectedAddress.equals(fSelectedAddress)) |
760 |
{ |
980 |
{ |
761 |
fSelectedAddress = selectedAddress; |
981 |
setSelectedAddress(selectedAddress); |
762 |
updateSyncSelectedAddress(); |
982 |
updateSyncSelectedAddress(); |
763 |
} |
983 |
} |
764 |
|
984 |
|
Lines 773-793
Link Here
|
773 |
|
993 |
|
774 |
if (row < 3) |
994 |
if (row < 3) |
775 |
{ |
995 |
{ |
776 |
|
|
|
777 |
if (!isAtTopLimit()) |
996 |
if (!isAtTopLimit()) |
778 |
{ |
997 |
{ |
779 |
refresh(); |
998 |
if (isDynamicLoad()) |
780 |
setCursorAtAddress(fSelectedAddress); |
999 |
{ |
|
|
1000 |
refresh(); |
1001 |
setCursorAtAddress(fSelectedAddress); |
1002 |
} |
781 |
} |
1003 |
} |
782 |
} |
1004 |
} |
783 |
else if (row >= fTableViewer.getTable().getItemCount() - 3) |
1005 |
else if (row >= fTableViewer.getTable().getItemCount() - 3) |
784 |
{ |
1006 |
{ |
785 |
if (!isAtBottomLimit()) |
1007 |
if (!isAtBottomLimit()) |
786 |
{ |
1008 |
{ |
787 |
refresh(); |
1009 |
if (isDynamicLoad()) |
788 |
setCursorAtAddress(fSelectedAddress); |
1010 |
{ |
|
|
1011 |
refresh(); |
1012 |
setCursorAtAddress(fSelectedAddress); |
1013 |
} |
789 |
} |
1014 |
} |
790 |
|
|
|
791 |
} |
1015 |
} |
792 |
} |
1016 |
} |
793 |
|
1017 |
|
Lines 1190-1196
Link Here
|
1190 |
|
1414 |
|
1191 |
private static void setTopIndex(Table table, int index) |
1415 |
private static void setTopIndex(Table table, int index) |
1192 |
{ |
1416 |
{ |
1193 |
MemoryViewUtil.linuxWorkAround(table); |
|
|
1194 |
table.setTopIndex(index); |
1417 |
table.setTopIndex(index); |
1195 |
} |
1418 |
} |
1196 |
|
1419 |
|
Lines 1213-1218
Link Here
|
1213 |
Object size =getSynchronizedProperty( AbstractTableRendering.PROPERTY_COL_SIZE); |
1436 |
Object size =getSynchronizedProperty( AbstractTableRendering.PROPERTY_COL_SIZE); |
1214 |
Object topAddress =getSynchronizedProperty( AbstractTableRendering.PROPERTY_TOP_ADDRESS); |
1437 |
Object topAddress =getSynchronizedProperty( AbstractTableRendering.PROPERTY_TOP_ADDRESS); |
1215 |
|
1438 |
|
|
|
1439 |
if (!isDynamicLoad()) |
1440 |
{ |
1441 |
Object pageStartAddress = getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS); |
1442 |
if (pageStartAddress == null) |
1443 |
updateSyncPageStartAddress(); |
1444 |
} |
1445 |
|
1216 |
// if info is available, some other view tab has already been |
1446 |
// if info is available, some other view tab has already been |
1217 |
// created |
1447 |
// created |
1218 |
// do not overwirte info int he synchronizer if that's the case |
1448 |
// do not overwirte info int he synchronizer if that's the case |
Lines 1233-1239
Link Here
|
1233 |
* Get properties from synchronizer and synchronize settings |
1463 |
* Get properties from synchronizer and synchronize settings |
1234 |
*/ |
1464 |
*/ |
1235 |
private void synchronize() |
1465 |
private void synchronize() |
1236 |
{ |
1466 |
{ |
|
|
1467 |
if (!isDynamicLoad()) |
1468 |
{ |
1469 |
BigInteger pageStart = (BigInteger)getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS); |
1470 |
if (pageStart != null && fContentInput != null && fContentInput.getLoadAddress() != null) |
1471 |
{ |
1472 |
if (!fContentInput.getLoadAddress().equals(pageStart)) |
1473 |
handlePageStartAddressChanged(pageStart); |
1474 |
} |
1475 |
else if (pageStart != null) |
1476 |
{ |
1477 |
handlePageStartAddressChanged(pageStart); |
1478 |
} |
1479 |
} |
1480 |
|
1237 |
Integer columnSize = (Integer) getSynchronizedProperty(AbstractTableRendering.PROPERTY_COL_SIZE); |
1481 |
Integer columnSize = (Integer) getSynchronizedProperty(AbstractTableRendering.PROPERTY_COL_SIZE); |
1238 |
BigInteger selectedAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS); |
1482 |
BigInteger selectedAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS); |
1239 |
BigInteger topAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_TOP_ADDRESS); |
1483 |
BigInteger topAddress = (BigInteger)getSynchronizedProperty(AbstractTableRendering.PROPERTY_TOP_ADDRESS); |
Lines 1315-1320
Link Here
|
1315 |
firePropertyChangedEvent(event); |
1559 |
firePropertyChangedEvent(event); |
1316 |
} |
1560 |
} |
1317 |
|
1561 |
|
|
|
1562 |
private void updateSyncPageStartAddress() { |
1563 |
|
1564 |
if (!fIsCreated) |
1565 |
return; |
1566 |
|
1567 |
if (isBaseAddressChanged()) |
1568 |
return; |
1569 |
|
1570 |
BigInteger pageStart; |
1571 |
if (isDynamicLoad()) |
1572 |
{ |
1573 |
// if dynamic loading, the page address should be the top |
1574 |
// row address |
1575 |
pageStart = fTopRowAddress; |
1576 |
} |
1577 |
else |
1578 |
{ |
1579 |
// otherwise, the address is the buffer's start address |
1580 |
pageStart = fContentProvider.getBufferTopAddress(); |
1581 |
} |
1582 |
|
1583 |
PropertyChangeEvent event = new PropertyChangeEvent(this, IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS, null, pageStart); |
1584 |
firePropertyChangedEvent(event); |
1585 |
} |
1586 |
|
1318 |
/** |
1587 |
/** |
1319 |
* Fills the context menu for this rendering |
1588 |
* Fills the context menu for this rendering |
1320 |
* |
1589 |
* |
Lines 1354-1359
Link Here
|
1354 |
} |
1623 |
} |
1355 |
} |
1624 |
} |
1356 |
} |
1625 |
} |
|
|
1626 |
if (!isDynamicLoad()) |
1627 |
{ |
1628 |
menu.add(new Separator()); |
1629 |
menu.add(fPrevAction); |
1630 |
menu.add(fNextAction); |
1631 |
} |
1357 |
|
1632 |
|
1358 |
menu.add(new Separator()); |
1633 |
menu.add(new Separator()); |
1359 |
menu.add(fReformatAction); |
1634 |
menu.add(fReformatAction); |
Lines 1366-1371
Link Here
|
1366 |
menu.add(new Separator()); |
1641 |
menu.add(new Separator()); |
1367 |
menu.add(fPropertiesAction); |
1642 |
menu.add(fPropertiesAction); |
1368 |
} |
1643 |
} |
|
|
1644 |
|
1369 |
} |
1645 |
} |
1370 |
|
1646 |
|
1371 |
/** |
1647 |
/** |
Lines 1539-1549
Link Here
|
1539 |
if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0) |
1815 |
if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0) |
1540 |
{ |
1816 |
{ |
1541 |
// get to new address |
1817 |
// get to new address |
1542 |
fSelectedAddress = address; |
1818 |
setSelectedAddress(address); |
1543 |
updateSyncSelectedAddress(); |
1819 |
updateSyncSelectedAddress(); |
|
|
1820 |
|
1544 |
reloadTable(address, true); |
1821 |
reloadTable(address, true); |
1545 |
|
1822 |
|
1546 |
fTopRowAddress = address; |
1823 |
if (!isDynamicLoad()) |
|
|
1824 |
{ |
1825 |
updateSyncPageStartAddress(); |
1826 |
setTopIndex(fTableViewer.getTable(), 0); |
1827 |
} |
1828 |
|
1829 |
fTopRowAddress = getTopVisibleAddress(); |
1547 |
updateSyncTopAddress(); |
1830 |
updateSyncTopAddress(); |
1548 |
|
1831 |
|
1549 |
fContentInput.updateContentBaseAddress(); |
1832 |
fContentInput.updateContentBaseAddress(); |
Lines 1551-1557
Link Here
|
1551 |
else |
1834 |
else |
1552 |
{ |
1835 |
{ |
1553 |
// reload at top of table |
1836 |
// reload at top of table |
1554 |
address = getTopVisibleAddress(); |
1837 |
if (isDynamicLoad()) |
|
|
1838 |
address = getTopVisibleAddress(); |
1839 |
else |
1840 |
address = fContentInput.getLoadAddress(); |
1555 |
reloadTable(address, true); |
1841 |
reloadTable(address, true); |
1556 |
} |
1842 |
} |
1557 |
} catch (DebugException e) { |
1843 |
} catch (DebugException e) { |
Lines 1575-1599
Link Here
|
1575 |
{ |
1861 |
{ |
1576 |
Table table = (Table)fTableViewer.getControl(); |
1862 |
Table table = (Table)fTableViewer.getControl(); |
1577 |
|
1863 |
|
1578 |
TableRenderingContentInput input = new TableRenderingContentInput(this, fContentInput.getPreBuffer(), fContentInput.getPostBuffer(), fContentInput.getDefaultBufferSize(), topAddress, getNumberOfVisibleLines(), updateDelta); |
1864 |
TableRenderingContentInput input; |
|
|
1865 |
if (isDynamicLoad()) |
1866 |
input = new TableRenderingContentInput(this, fContentInput.getPreBuffer(), fContentInput.getPostBuffer(), fContentInput.getDefaultBufferSize(), topAddress, getNumberOfVisibleLines(), updateDelta); |
1867 |
else |
1868 |
input = new TableRenderingContentInput(this, fContentInput.getPreBuffer(), fContentInput.getPostBuffer(), fContentInput.getDefaultBufferSize(), topAddress, fPageSize, updateDelta); |
1869 |
|
1579 |
fContentInput = input; |
1870 |
fContentInput = input; |
1580 |
fTableViewer.setInput(fContentInput); |
1871 |
fTableViewer.setInput(fContentInput); |
1581 |
|
1872 |
|
1582 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) |
1873 |
if (isDynamicLoad()) |
1583 |
{ |
1874 |
{ |
1584 |
int topIdx = findAddressIndex(topAddress); |
1875 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) |
|
|
1876 |
{ |
1877 |
int topIdx = findAddressIndex(topAddress); |
1878 |
|
1879 |
if (topIdx != -1) |
1880 |
{ |
1881 |
setTopIndex(table, topIdx); |
1882 |
} |
1883 |
} |
1585 |
|
1884 |
|
1586 |
if (topIdx != -1) |
1885 |
// cursor needs to be refreshed after reload |
|
|
1886 |
if (isAddressVisible(fSelectedAddress)) |
1887 |
setCursorAtAddress(fSelectedAddress); |
1888 |
} |
1889 |
else |
1890 |
{ |
1891 |
if (!isAddressOutOfRange(fSelectedAddress)) |
1892 |
{ |
1893 |
setCursorAtAddress(fSelectedAddress); |
1894 |
fTableCursor.setVisible(true); |
1895 |
} |
1896 |
else |
1587 |
{ |
1897 |
{ |
1588 |
setTopIndex(table, topIdx); |
1898 |
fTableCursor.setVisible(false); |
1589 |
} |
1899 |
} |
1590 |
} |
1900 |
} |
1591 |
|
|
|
1592 |
// cursor needs to be refreshed after reload |
1593 |
if (isAddressVisible(fSelectedAddress)) |
1594 |
setCursorAtAddress(fSelectedAddress); |
1595 |
|
1596 |
MemoryViewUtil.linuxWorkAround(fTableViewer.getTable()); |
1597 |
} |
1901 |
} |
1598 |
finally |
1902 |
finally |
1599 |
{ |
1903 |
{ |
Lines 1657-1671
Link Here
|
1657 |
|
1961 |
|
1658 |
private static int getTopVisibleIndex(Table table) |
1962 |
private static int getTopVisibleIndex(Table table) |
1659 |
{ |
1963 |
{ |
1660 |
MemoryViewUtil.linuxWorkAround(table); |
|
|
1661 |
int index = table.getTopIndex(); |
1964 |
int index = table.getTopIndex(); |
1662 |
|
1965 |
|
1663 |
TableItem item = table.getItem(index); |
1966 |
TableItem item = table.getItem(index); |
|
|
1967 |
int cnt = table.getItemCount(); |
1664 |
|
1968 |
|
1665 |
MemoryViewUtil.linuxWorkAround(table); |
|
|
1666 |
while (item.getBounds(0).y < 0) |
1969 |
while (item.getBounds(0).y < 0) |
1667 |
{ |
1970 |
{ |
1668 |
index++; |
1971 |
index++; |
|
|
1972 |
if (index >= cnt) |
1973 |
{ |
1974 |
index--; |
1975 |
break; |
1976 |
} |
1669 |
item = table.getItem(index); |
1977 |
item = table.getItem(index); |
1670 |
} |
1978 |
} |
1671 |
|
1979 |
|
Lines 1778-1784
Link Here
|
1778 |
// if address is within the range, highlight |
2086 |
// if address is within the range, highlight |
1779 |
if (!isAddressOutOfRange(address)) |
2087 |
if (!isAddressOutOfRange(address)) |
1780 |
{ |
2088 |
{ |
1781 |
fSelectedAddress = address; |
2089 |
setSelectedAddress(address); |
1782 |
updateSyncSelectedAddress(); |
2090 |
updateSyncSelectedAddress(); |
1783 |
setCursorAtAddress(fSelectedAddress); |
2091 |
setCursorAtAddress(fSelectedAddress); |
1784 |
|
2092 |
|
Lines 1817-1827
Link Here
|
1817 |
throw e; |
2125 |
throw e; |
1818 |
} |
2126 |
} |
1819 |
|
2127 |
|
1820 |
fSelectedAddress = address; |
2128 |
setSelectedAddress(address); |
1821 |
updateSyncSelectedAddress(); |
2129 |
updateSyncSelectedAddress(); |
1822 |
|
2130 |
|
1823 |
//otherwise, reload at the address |
2131 |
reloadTable(address, false); |
1824 |
reloadTable(address,false); |
2132 |
|
|
|
2133 |
if (!isDynamicLoad()) |
2134 |
{ |
2135 |
updateSyncPageStartAddress(); |
2136 |
} |
1825 |
|
2137 |
|
1826 |
// if the table is reloaded, the top address is chagned in this case |
2138 |
// if the table is reloaded, the top address is chagned in this case |
1827 |
fTopRowAddress = address; |
2139 |
fTopRowAddress = address; |
Lines 1900-1905
Link Here
|
1900 |
{ |
2212 |
{ |
1901 |
fPropertiesAction = new PropertyDialogAction(site.getSite(),site.getSite().getSelectionProvider()); |
2213 |
fPropertiesAction = new PropertyDialogAction(site.getSite(),site.getSite().getSelectionProvider()); |
1902 |
} |
2214 |
} |
|
|
2215 |
|
2216 |
fNextAction = new NextPageAction(); |
2217 |
fPrevAction = new PrevPageAction(); |
1903 |
} |
2218 |
} |
1904 |
|
2219 |
|
1905 |
/** |
2220 |
/** |
Lines 1927-1959
Link Here
|
1927 |
|
2242 |
|
1928 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) |
2243 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) |
1929 |
{ |
2244 |
{ |
1930 |
if (!isAddressOutOfRange(address)) |
2245 |
|
|
|
2246 |
if (isDynamicLoad()) |
1931 |
{ |
2247 |
{ |
1932 |
Table table = fTableViewer.getTable(); |
2248 |
if (!isAddressOutOfRange(address)) |
1933 |
int numInBuffer = table.getItemCount(); |
|
|
1934 |
int index = findAddressIndex(address); |
1935 |
if (index < 3) |
1936 |
{ |
2249 |
{ |
1937 |
if (isAtTopLimit()) |
2250 |
Table table = fTableViewer.getTable(); |
|
|
2251 |
int numInBuffer = table.getItemCount(); |
2252 |
int index = findAddressIndex(address); |
2253 |
if (index < 3) |
1938 |
{ |
2254 |
{ |
1939 |
setTopIndex(table, index); |
2255 |
if (isAtTopLimit()) |
|
|
2256 |
{ |
2257 |
setTopIndex(table, index); |
2258 |
} |
2259 |
else |
2260 |
{ |
2261 |
reloadTable(address, false); |
2262 |
} |
1940 |
} |
2263 |
} |
1941 |
else |
2264 |
else if ((numInBuffer-(index+getNumberOfVisibleLines())) < 3) |
1942 |
{ |
2265 |
{ |
1943 |
reloadTable(address, false); |
2266 |
if (!isAtBottomLimit()) |
|
|
2267 |
reloadTable(address, false); |
1944 |
} |
2268 |
} |
1945 |
} |
2269 |
} |
1946 |
else if ((numInBuffer-(index+getNumberOfVisibleLines())) < 3) |
2270 |
else |
1947 |
{ |
2271 |
{ |
1948 |
if (!isAtBottomLimit()) |
2272 |
// approaching limit, reload table |
1949 |
reloadTable(address, false); |
2273 |
reloadTable(address, false); |
1950 |
} |
2274 |
} |
1951 |
} |
2275 |
} |
1952 |
else |
|
|
1953 |
{ |
1954 |
// approaching limit, reload table |
1955 |
reloadTable(address, false); |
1956 |
} |
1957 |
|
2276 |
|
1958 |
if (isAddressVisible(fSelectedAddress)) |
2277 |
if (isAddressVisible(fSelectedAddress)) |
1959 |
fTableCursor.setVisible(true); |
2278 |
fTableCursor.setVisible(true); |
Lines 1971-1980
Link Here
|
1971 |
private boolean isAtTopLimit() |
2290 |
private boolean isAtTopLimit() |
1972 |
{ |
2291 |
{ |
1973 |
BigInteger startAddress = fContentInput.getStartAddress(); |
2292 |
BigInteger startAddress = fContentInput.getStartAddress(); |
1974 |
startAddress = alignDoubleWordBoundary(startAddress); |
2293 |
startAddress = MemoryViewUtil.alignDoubleWordBoundary(startAddress); |
1975 |
|
2294 |
|
1976 |
BigInteger startBufferAddress = fContentProvider.getBufferTopAddress(); |
2295 |
BigInteger startBufferAddress = fContentProvider.getBufferTopAddress(); |
1977 |
startBufferAddress = alignDoubleWordBoundary(startBufferAddress); |
2296 |
startBufferAddress = MemoryViewUtil.alignDoubleWordBoundary(startBufferAddress); |
1978 |
|
2297 |
|
1979 |
if (startAddress.compareTo(startBufferAddress) == 0) |
2298 |
if (startAddress.compareTo(startBufferAddress) == 0) |
1980 |
return true; |
2299 |
return true; |
Lines 1985-1994
Link Here
|
1985 |
private boolean isAtBottomLimit() |
2304 |
private boolean isAtBottomLimit() |
1986 |
{ |
2305 |
{ |
1987 |
BigInteger endAddress = fContentInput.getEndAddress(); |
2306 |
BigInteger endAddress = fContentInput.getEndAddress(); |
1988 |
endAddress = alignDoubleWordBoundary(endAddress); |
2307 |
endAddress = MemoryViewUtil.alignDoubleWordBoundary(endAddress); |
1989 |
|
2308 |
|
1990 |
BigInteger endBufferAddress = fContentProvider.getBufferEndAddress(); |
2309 |
BigInteger endBufferAddress = fContentProvider.getBufferEndAddress(); |
1991 |
endBufferAddress = alignDoubleWordBoundary(endBufferAddress); |
2310 |
endBufferAddress = MemoryViewUtil.alignDoubleWordBoundary(endBufferAddress); |
1992 |
|
2311 |
|
1993 |
if (endAddress.compareTo(endBufferAddress) == 0) |
2312 |
if (endAddress.compareTo(endBufferAddress) == 0) |
1994 |
return true; |
2313 |
return true; |
Lines 1996-2014
Link Here
|
1996 |
return false; |
2315 |
return false; |
1997 |
} |
2316 |
} |
1998 |
|
2317 |
|
1999 |
private BigInteger alignDoubleWordBoundary(BigInteger integer) |
|
|
2000 |
{ |
2001 |
String str =integer.toString(16); |
2002 |
if (!str.endsWith("0")) //$NON-NLS-1$ |
2003 |
{ |
2004 |
str = str.substring(0, str.length() - 1); |
2005 |
str += "0"; //$NON-NLS-1$ |
2006 |
integer = new BigInteger(str, 16); |
2007 |
} |
2008 |
|
2009 |
return integer; |
2010 |
} |
2011 |
|
2012 |
private boolean needMoreLines() |
2318 |
private boolean needMoreLines() |
2013 |
{ |
2319 |
{ |
2014 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) |
2320 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) |
Lines 2501-2510
Link Here
|
2501 |
} |
2807 |
} |
2502 |
|
2808 |
|
2503 |
super.becomesVisible(); |
2809 |
super.becomesVisible(); |
2504 |
|
|
|
2505 |
refresh(); |
2506 |
synchronize(); |
2507 |
|
2810 |
|
|
|
2811 |
boolean value = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM); |
2812 |
if (value != isDynamicLoad()) |
2813 |
// this call will cause a reload |
2814 |
handleDyanicLoadChanged(); |
2815 |
else |
2816 |
refresh(); |
2817 |
|
2818 |
synchronize(); |
2508 |
updateRenderingLabel(true); |
2819 |
updateRenderingLabel(true); |
2509 |
} |
2820 |
} |
2510 |
|
2821 |
|
Lines 2674-2688
Link Here
|
2674 |
public Object[] getChildren(Object o) { |
2985 |
public Object[] getChildren(Object o) { |
2675 |
return new Object[0]; |
2986 |
return new Object[0]; |
2676 |
} |
2987 |
} |
2677 |
|
2988 |
|
2678 |
public ImageDescriptor getImageDescriptor(Object object) { |
2989 |
public ImageDescriptor getImageDescriptor(Object object) { |
2679 |
return null; |
2990 |
return null; |
2680 |
} |
2991 |
} |
2681 |
|
2992 |
|
2682 |
public String getLabel(Object o) { |
2993 |
public String getLabel(Object o) { |
2683 |
return getInstance().getLabel(); |
2994 |
return getInstance().getLabel(); |
2684 |
} |
2995 |
} |
2685 |
|
2996 |
|
2686 |
public Object getParent(Object o) { |
2997 |
public Object getParent(Object o) { |
2687 |
return null; |
2998 |
return null; |
2688 |
} |
2999 |
} |
Lines 2691-2696
Link Here
|
2691 |
return fWorkbenchAdapter; |
3002 |
return fWorkbenchAdapter; |
2692 |
} |
3003 |
} |
2693 |
|
3004 |
|
|
|
3005 |
if (adapter == IMemoryBlockConnection.class) { |
3006 |
if (fConnection == null) { |
3007 |
fConnection = new IMemoryBlockConnection() { |
3008 |
public void update() { |
3009 |
try { |
3010 |
fContentProvider.takeContentSnapshot(); |
3011 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) |
3012 |
{ |
3013 |
BigInteger address = ((IMemoryBlockExtension)getMemoryBlock()).getBigBaseAddress(); |
3014 |
if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0) |
3015 |
{ |
3016 |
// get to new address |
3017 |
setSelectedAddress(address); |
3018 |
updateSyncSelectedAddress(); |
3019 |
fTopRowAddress = address; |
3020 |
fContentInput.updateContentBaseAddress(); |
3021 |
fContentInput.setLoadAddress(address); |
3022 |
} |
3023 |
fContentProvider.loadContentForExtendedMemoryBlock(); |
3024 |
} |
3025 |
else |
3026 |
fContentProvider.loadContentForSimpleMemoryBlock(); |
3027 |
|
3028 |
// update UI asynchrounously |
3029 |
Display display = DebugUIPlugin.getDefault().getWorkbench().getDisplay(); |
3030 |
display.asyncExec(new Runnable() { |
3031 |
public void run() { |
3032 |
updateLabels(); |
3033 |
|
3034 |
if (getMemoryBlock() instanceof IMemoryBlockExtension) { |
3035 |
int topIdx = findAddressIndex(fTopRowAddress); |
3036 |
if (topIdx != -1) { |
3037 |
setTopIndex(fTableViewer.getTable(),topIdx); |
3038 |
} |
3039 |
} |
3040 |
|
3041 |
// cursor needs to be refreshed after reload |
3042 |
if (isAddressVisible(fSelectedAddress)) |
3043 |
{ |
3044 |
setCursorAtAddress(fSelectedAddress); |
3045 |
fTableCursor.setVisible(true); |
3046 |
fTableCursor.redraw(); |
3047 |
} |
3048 |
else |
3049 |
{ |
3050 |
fTableCursor.setVisible(false); |
3051 |
} |
3052 |
|
3053 |
if (!isDynamicLoad()) |
3054 |
updateSyncPageStartAddress(); |
3055 |
|
3056 |
updateSyncTopAddress(); |
3057 |
} |
3058 |
}); |
3059 |
} catch (DebugException e) { |
3060 |
displayError(e); |
3061 |
} |
3062 |
} |
3063 |
}; |
3064 |
} |
3065 |
return fConnection; |
3066 |
} |
3067 |
|
2694 |
return super.getAdapter(adapter); |
3068 |
return super.getAdapter(adapter); |
2695 |
} |
3069 |
} |
2696 |
|
3070 |
|
Lines 2708-2713
Link Here
|
2708 |
return true; |
3082 |
return true; |
2709 |
} |
3083 |
} |
2710 |
|
3084 |
|
|
|
3085 |
private boolean isBaseAddressChanged() |
3086 |
{ |
3087 |
try { |
3088 |
IMemoryBlock mb = getMemoryBlock(); |
3089 |
if (mb instanceof IMemoryBlockExtension) |
3090 |
{ |
3091 |
BigInteger baseAddress = ((IMemoryBlockExtension)mb).getBigBaseAddress(); |
3092 |
if (baseAddress != null) |
3093 |
{ |
3094 |
if (!baseAddress.equals(fContentInput.getContentBaseAddress())) |
3095 |
return true; |
3096 |
} |
3097 |
} |
3098 |
} catch (DebugException e1) { |
3099 |
return false; |
3100 |
} |
3101 |
return false; |
3102 |
} |
3103 |
|
2711 |
/** |
3104 |
/** |
2712 |
* Returns the color provider for this rendering's memory block or |
3105 |
* Returns the color provider for this rendering's memory block or |
2713 |
* <code>null</code> if none. |
3106 |
* <code>null</code> if none. |
Lines 2774-2779
Link Here
|
2774 |
return (IMemoryBlockTablePresentation)getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class); |
3167 |
return (IMemoryBlockTablePresentation)getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class); |
2775 |
} |
3168 |
} |
2776 |
|
3169 |
|
|
|
3170 |
private boolean isDynamicLoad() |
3171 |
{ |
3172 |
return fContentProvider.isDynamicLoad(); |
3173 |
} |
3174 |
|
3175 |
private int getPageSizeInUnits() |
3176 |
{ |
3177 |
return fPageSize * getAddressableUnitPerLine(); |
3178 |
} |
3179 |
|
3180 |
private void setSelectedAddress(BigInteger address) |
3181 |
{ |
3182 |
fSelectedAddress = address; |
3183 |
} |
3184 |
|
3185 |
|
2777 |
/** |
3186 |
/** |
2778 |
* Returns text for the given memory bytes at the specified address for the specified |
3187 |
* Returns text for the given memory bytes at the specified address for the specified |
2779 |
* rendering type. This is called by the label provider for. |
3188 |
* rendering type. This is called by the label provider for. |