Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantha Chan2008-01-22 23:39:00 +0000
committerSamantha Chan2008-01-22 23:39:00 +0000
commit1a81568acd878d40fc0b520b45152116c4c18ff3 (patch)
treeb46f0536ffc6bde54986f0d91d3fba3ec9d4b4be /org.eclipse.debug.ui
parent434926d82334101cb5835754465dc5fa9bdac492 (diff)
downloadeclipse.platform.debug-1a81568acd878d40fc0b520b45152116c4c18ff3.tar.gz
eclipse.platform.debug-1a81568acd878d40fc0b520b45152116c4c18ff3.tar.xz
eclipse.platform.debug-1a81568acd878d40fc0b520b45152116c4c18ff3.zip
Bug 200033 - [Memory View] Better support for flexible hiearchy in the memory view framework
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java2
7 files changed, 45 insertions, 41 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
index 4d68993ad..60641845e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -235,8 +235,7 @@ public class MemoryBlockContentAdapter extends AsynchronousContentAdapter {
// is already terminated
IDebugTarget target = descriptor.getMemoryBlock().getDebugTarget();
- // TODO: [MEMORY VIEW] This null check is not valid
- // revisit when looking at supporting flexible hierarchy
+ // check for null target to not calculate and retrieve memory for standard debug model
if (target != null && (target.isDisconnected() || target.isTerminated()))
return new Object[0];
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
index a73902a7f..c0188450b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -325,6 +325,14 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
setEnabled(false);
}
}
+ // handle change event from memory block retrieval object
+ // to allow non-standard debug models to update the action
+ else if (event.getKind() == DebugEvent.CHANGE && event.getDetail() == DebugEvent.STATE)
+ {
+ Object evtSrc = event.getSource();
+ if (evtSrc == MemoryViewUtil.getMemoryBlockRetrieval(fCurrentContext))
+ updateAction(fCurrentContext);
+ }
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
index ae3d3beaa..cca7244a4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -217,20 +217,35 @@ public class MemoryViewUtil {
* @param object
* @return the memory block retrieval of the given object or <code>null</code>
* if no memory block retrieval can be found
+ *
+ * Returning null for the memory block retrieval will result in errors in operations
+ * that follow.
+ *
+ * Non-standard debug models must provide a memory block retrieval via
+ * <code>getAdapter(IMemoryBlockRetrieval.class</code>
*/
public static IMemoryBlockRetrieval getMemoryBlockRetrieval(Object object)
{
IMemoryBlockRetrieval retrieval = null;
+ // if memory block extension, retrieval must be queired throught its interface
if (object instanceof IMemoryBlockExtension)
return ((IMemoryBlockExtension)object).getMemoryBlockRetrieval();
+ // check if the object can adapt to a memory block retrieval
if (object instanceof IAdaptable)
{
IAdaptable adaptable = (IAdaptable)object;
retrieval = (IMemoryBlockRetrieval)adaptable.getAdapter(IMemoryBlockRetrieval.class);
}
+ // if cannot adapt and the object itself is already an IMemoryBlockRetrieval, return that.
+ if (retrieval == null && object instanceof IMemoryBlockRetrieval)
+ {
+ retrieval = (IMemoryBlockRetrieval)object;
+ }
+
+ // otherewise, default back to the debug target
if (retrieval == null && object instanceof IDebugElement)
{
IDebugElement de = (IDebugElement)object;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
index 01e833df6..cd1d27b03 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -564,12 +564,12 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
IDebugTarget target = memory.getDebugTarget();
// do not create if the target is already terminated or if the memory block is removed
- if (!target.isDisconnected() && !target.isTerminated() && !isMeomryBlockRemoved(memory))
+ if (target != null && !target.isDisconnected() && !target.isTerminated() && !isMeomryBlockRemoved(memory))
{
TabItem newItem = new TabItem(tabFolder, SWT.NULL);
CreateRendering createRendering = new CreateRendering(getInstance());
createRendering.init(getInstance(), memory);
-
+
MemoryViewTab viewTab = new MemoryViewTab(newItem, createRendering, getInstance());
tabFolder.setSelection(0);
setRenderingSelection(viewTab.getRendering());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
index e19bf5aeb..a6d135739 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -76,18 +76,8 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
if (fAction != null) {
IAdaptable context = DebugUITools.getDebugContext();
if (context != null) {
- IMemoryBlockRetrieval retrieval = null;
- if (context.getAdapter(IMemoryBlockRetrieval.class) != null) {
- retrieval = (IMemoryBlockRetrieval)context.getAdapter(IMemoryBlockRetrieval.class);
- }
- if (retrieval == null) {
- if(context instanceof IMemoryBlockRetrieval) {
- retrieval = (IMemoryBlockRetrieval)context;
- }
- else if(context instanceof IDebugElement) {
- retrieval = ((IDebugElement)context).getDebugTarget();
- }
- }
+ IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
+
if (retrieval != null) {
IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(retrieval);
fAction.setEnabled(memoryBlocks.length > 0);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java
index 530d9859e..c078b7a20 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,9 +17,9 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
+import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
import org.eclipse.debug.core.model.IMemoryBlockRetrievalExtension;
import org.eclipse.debug.internal.ui.DebugUIMessages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
@@ -130,18 +130,14 @@ public class GoToAddressAction extends Action
// of the memory block
if (address.compareTo(mbStart) < 0)
{
- IMemoryBlockRetrievalExtension retrieval = (IMemoryBlockRetrievalExtension)mbExt.getAdapter(IMemoryBlockRetrievalExtension.class);
- IDebugTarget dt = mbExt.getDebugTarget();
-
- if (retrieval == null && dt instanceof IMemoryBlockRetrievalExtension)
- retrieval = (IMemoryBlockRetrievalExtension)dt;
+ IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(mbExt);
// add a new memory block and then the same rendering as fRendering
// in the same container.
- if (retrieval != null)
+ if (retrieval != null && retrieval instanceof IMemoryBlockRetrievalExtension)
{
- addNewMemoryBlock(expression, retrieval);
- return;
+ addNewMemoryBlock(expression, (IMemoryBlockRetrievalExtension)retrieval);
+ return;
}
}
}
@@ -151,18 +147,14 @@ public class GoToAddressAction extends Action
// of the memory block
if (address.compareTo(mbEnd) > 0)
{
- IMemoryBlockRetrievalExtension retrieval = (IMemoryBlockRetrievalExtension)mbExt.getAdapter(IMemoryBlockRetrievalExtension.class);
- IDebugTarget dt = mbExt.getDebugTarget();
-
- if (retrieval == null && dt instanceof IMemoryBlockRetrievalExtension)
- retrieval = (IMemoryBlockRetrievalExtension)dt;
-
+ IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(mbExt);
+
// add a new memory block and then the same rendering as fRendering
// in the same container.
- if (retrieval != null)
+ if (retrieval != null && retrieval instanceof IMemoryBlockRetrievalExtension)
{
- addNewMemoryBlock(expression, retrieval);
- return;
+ addNewMemoryBlock(expression, (IMemoryBlockRetrievalExtension)retrieval);
+ return;
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
index 8aff1e4a0..b97cf42ba 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
@@ -38,7 +38,7 @@ import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
/**
- * Content provider for MemoryViewTab
+ * Content Provider used by AbstractTableRendering
*
* @since 3.0
*/

Back to the top