1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[214956] [Memory View] Memory View workflow enhancements: quick address navigation; simplified use defaults; fewer clicks

This commit is contained in:
Ted Williams 2008-09-01 02:27:55 +00:00
parent 6958d0987f
commit 2ad6225eb4

View file

@ -96,25 +96,19 @@ public class TraditionalGoToAddressRendering extends AbstractMemoryRendering {
} }
IMemoryRenderingContainer containers[] = fSite.getMemoryRenderingContainers(); IMemoryRenderingContainer containers[] = fSite.getMemoryRenderingContainers();
IMemoryRenderingContainer firstRenderingViewPane = null;
for(int i = 0; i < containers.length; i++) for(int i = 0; i < containers.length; i++)
{ {
if(containers[i] instanceof RenderingViewPane) if(containers[i] instanceof RenderingViewPane)
{ {
firstRenderingViewPane = containers[i];
break;
}
}
BigInteger absoluteAddress = null; BigInteger absoluteAddress = null;
if(fGotoAddress.isGoToAddress()) if(fGotoAddress.isGoToAddress())
absoluteAddress = address; absoluteAddress = address;
IMemoryBlock activeMemoryBlock = null; IMemoryBlock activeMemoryBlock = null;
if(address != null && firstRenderingViewPane != null) if(address != null && containers[i] != null)
{ {
IMemoryRendering activeRendering = firstRenderingViewPane.getActiveRendering(); IMemoryRendering activeRendering = containers[i].getActiveRendering();
if(activeRendering != null) if(activeRendering != null)
{ {
activeMemoryBlock = activeRendering.getMemoryBlock(); activeMemoryBlock = activeRendering.getMemoryBlock();
@ -148,64 +142,17 @@ public class TraditionalGoToAddressRendering extends AbstractMemoryRendering {
try try
{ {
((IRepositionableMemoryRendering) activeRendering).goToAddress(absoluteAddress); ((IRepositionableMemoryRendering) activeRendering).goToAddress(absoluteAddress);
return;
} }
catch(DebugException de) catch(DebugException de)
{ {
// TODO ? // do nothing
}
}
} }
} }
} }
} }
// 2) Fallback: Remove existing memory block; Add new memory block
IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(DebugUITools.getDebugContext());
final BigInteger absoluteAddressFinal = absoluteAddress;
final IMemoryBlock activeMemoryBlockFinal = activeMemoryBlock;
final IMemoryBlockRetrieval retrievalFinal = retrieval;
if(retrieval instanceof IMemoryBlockRetrievalExtension)
{
String absoluteAddressExpression = fGotoAddress.getExpressionText();
if(absoluteAddressFinal != null)
absoluteAddressExpression = (radix == 16 ? "0x" : "") + absoluteAddressFinal.toString(radix);
final String absoluteAddressExpressionFinal = absoluteAddressExpression;
new Thread() { // upgrade to Job ?
public void run()
{
try
{
final IMemoryBlockExtension memBlock = ((IMemoryBlockRetrievalExtension) retrievalFinal)
.getExtendedMemoryBlock(absoluteAddressExpressionFinal, DebugUITools.getDebugContext());
if (memBlock != null)
{
Display.getDefault().asyncExec(new Runnable(){
public void run()
{
IMemoryRenderingContainer container = fSite.getContainer(IDebugUIConstants.ID_RENDERING_VIEW_PANE_1);
IMemoryRendering createRendering = new CreateRendering(container);
createRendering.init(container, memBlock);
container.addMemoryRendering(createRendering);
}
});
}
else
{
// open error if it failed to retrieve a memory block
MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, DebugUIMessages.AddMemoryBlockAction_noMemoryBlock, null);
}
}
catch(DebugException de)
{
MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, DebugUIMessages.AddMemoryBlockAction_noMemoryBlock, de);
}
}
}.start();
}
} }
}; };