Hello,
I have a question about how to use the Memory View in
Eclipse programmatically.
I want to read/display memory for a given address
using the Memory View.
So far I have been following the advice given in the
Bugzilla Bug 87374:
>To programatically open the memory view:
>PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView
>("org.eclipse.debug.ui.MemoryView");
>
>To add memory blocks to the view, you need to add
memory blocks to the memory
>block manager:
>
>DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks(new
>IMemoryBlock[] {memoryBlocks});
>
>In addition to persisting the memory blocks, you
may also want to persist the
>renderings that are opened. You will need to
persist the rendering id and id
>of the containers in which a rendering is hosted.
>
>IViewPart part =
PlatformUI.getWorkbench().getActiveWorkbenchWindow>().
>getActivePage().showView("org.eclipse.debug.ui.memoryview");
>IMemoryRenderingSite memoryView =
(IMemoryRenderingSite)part;
>IMemoryRenderingContainer container =
memoryView.getContainer("containerId");
>IMemoryRendering[] renderings =
container.getRenderings[];
>
>When restoring the renderings, you will need to
create the rendering, and add
>the rendering to the appropriate container within
the memory view.
>
>To create a rendering:
>IMemoryRenderingType renderingType =
DebugUITools.getMemoryRenderingManager().
>getRenderingType("rendeirng id");
>IMemoryRendering rendering =
renderingType.createRendering();
>
>Then to add the rendering to the Memory View:
>IViewPart part =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().
>getActivePage().showView("org.eclipse.debug.ui.memoryview");
>IMemoryRenderingSite memoryView =
(IMemoryRenderingSite)part;
>IMemoryRenderingContainer container =
memoryView.getContainer("containerId");
>container.addMemoryRendering(rendering);
>
>Hope this helps...
>Samantha
If my IMemoryBlock implementation is correctly
implemented and I have added it with
DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks(),
wouldn't that be enough to render it with the default
"raw" memory renderer?
I could not get this to work, so I tried adding a
memory renderer to a memory rendering container,
but I can not get hold of a non-null container. What
default memory rendering containers are available?
My code so far looks like this (the container =
null):
IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page != null)
{
try
{
IViewPart view =
page.showView("org.eclipse.debug.ui.MemoryView");
IMemoryRenderingSite memoryView =
(IMemoryRenderingSite) view;
MemoryBlockExtentsion mbe = new
MemoryBlockExtentsion(new DummyDebugTarget(), 0);
DebugPlugin.getDefault().getMemoryBlockManager().
addMemoryBlocks(new
IMemoryBlock[] {mbe});
IMemoryRenderingType renderingType =
DebugUITools.getMemoryRenderingManager().
getRenderingType("org.eclipse.debug.ui.rendering.raw_memory");
IMemoryRendering rendering =
renderingType.createRendering();
IMemoryRenderingContainer container =
memoryView.getContainer(
DebugUIPlugin.getUniqueIdentifier()
+ ".MemoryView.RenderingViewPane.1");
container.addMemoryRendering(rendering); //
<------------- null!!!
}
catch ...
In summary, what are the minimal steps required in
order to display a block of memory
in the Memory View?
- Elin Karasalo
(I posted this message to the eclipse.tools.cdt
newsgroup, and was told to mail the
eclipse-debug-dev@xxxxxxxxxxx mailing list. I could
not find this mailing list and
am now trying this list.)