Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2010-09-24 17:17:56 -0400
committerDarin Wright2010-09-24 17:17:56 -0400
commit60eed8be58af6a1378c2f7e62049e3ac705e139c (patch)
tree06be8c4b9c6116cf1c278209fab44301fa154ca3
parentcbacf44a4092b759d29aeb53c2fab97e1cbf96ff (diff)
downloadeclipse.platform.debug-60eed8be58af6a1378c2f7e62049e3ac705e139c.tar.gz
eclipse.platform.debug-60eed8be58af6a1378c2f7e62049e3ac705e139c.tar.xz
eclipse.platform.debug-60eed8be58af6a1378c2f7e62049e3ac705e139c.zip
Bug 326152 - [Memory View] new monitors added while Memory view is hidden or closed are not shown in the tree
-rw-r--r--org.eclipse.debug.examples.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java4
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java81
-rw-r--r--org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.examples.ui/plugin.xml17
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AddPDAMemoryBlockAction.java101
6 files changed, 203 insertions, 4 deletions
diff --git a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
index a7f7a8a56..af515714a 100644
--- a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Example Debug Core Plug-in
Bundle-SymbolicName: org.eclipse.debug.examples.core;singleton:=true
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.3.0.qualifier
Bundle-Activator: org.eclipse.debug.examples.core.pda.DebugCorePlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
index 92a5a9955..cd275b7ff 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
@@ -394,13 +394,13 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
* @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval()
*/
public boolean supportsStorageRetrieval() {
- return false;
+ return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
*/
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
- return null;
+ return new PDAMemoryBlock(this, startAddress, length);
}
/**
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java
new file mode 100644
index 000000000..822f5faf4
--- /dev/null
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAMemoryBlock.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.core.pda.model;
+
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IMemoryBlock;
+
+/**
+ * Example memory block
+ */
+public class PDAMemoryBlock extends PDADebugElement implements IMemoryBlock {
+
+ /**
+ * The bytes
+ */
+ private byte[] fBytes = null;
+ private long fStart, fLength;
+
+ /**
+ * Constructs a new memory block
+ */
+ public PDAMemoryBlock(PDADebugTarget target, long start, long length) {
+ super(target);
+ fBytes = new byte[(int)length];
+ fStart = start;
+ fLength = length;
+ byte b = 0;
+ for (int i = 0; i < fBytes.length; i++) {
+ fBytes[i] = b++;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IMemoryBlock#getStartAddress()
+ */
+ public long getStartAddress() {
+ return fStart;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IMemoryBlock#getLength()
+ */
+ public long getLength() {
+ return fLength;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IMemoryBlock#getBytes()
+ */
+ public byte[] getBytes() throws DebugException {
+ return fBytes;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IMemoryBlock#supportsValueModification()
+ */
+ public boolean supportsValueModification() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IMemoryBlock#setValue(long, byte[])
+ */
+ public void setValue(long offset, byte[] bytes) throws DebugException {
+ int i = 0;
+ while (offset < fBytes.length && i < bytes.length) {
+ fBytes[(int)offset++] = bytes[i++];
+ }
+ fireChangeEvent(DebugEvent.CONTENT);
+ }
+
+}
diff --git a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
index e6dba7270..4c0b1ba38 100644
--- a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Example Debug UI Plug-in
Bundle-SymbolicName: org.eclipse.debug.examples.ui;singleton:=true
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.3.0.qualifier
Bundle-Activator: org.eclipse.debug.examples.ui.pda.DebugUIPlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
diff --git a/org.eclipse.debug.examples.ui/plugin.xml b/org.eclipse.debug.examples.ui/plugin.xml
index 8129e2156..a079cc67c 100644
--- a/org.eclipse.debug.examples.ui/plugin.xml
+++ b/org.eclipse.debug.examples.ui/plugin.xml
@@ -196,6 +196,16 @@
class="org.eclipse.debug.examples.ui.pda.editor.PopFrameActionDelegate"
id="pda.dropToFrame"
label="Pop Frame"/>
+ </objectContribution>
+ <objectContribution
+ adaptable="false"
+ id="pda.addMemoryBlock"
+ objectClass="org.eclipse.debug.examples.core.pda.model.PDADebugTarget">
+ <action
+ class="org.eclipse.debug.examples.ui.pda.adapters.AddPDAMemoryBlockAction"
+ id="pda.addMemoryBlock"
+ label="Add Memory Block">
+ </action>
</objectContribution>
<!--#endif -->
</extension>
@@ -455,4 +465,11 @@
</command>
</menuContribution>
</extension>
+ <extension
+ point="org.eclipse.debug.ui.memoryRenderings">
+ <renderingBindings
+ defaultIds="org.eclipse.debug.ui.rendering.raw_memory"
+ renderingIds="org.eclipse.debug.ui.rendering.raw_memory, org.eclipse.debug.ui.rendering.ascii">
+ </renderingBindings>
+ </extension>
</plugin>
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AddPDAMemoryBlockAction.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AddPDAMemoryBlockAction.java
new file mode 100644
index 000000000..1a8ff182d
--- /dev/null
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AddPDAMemoryBlockAction.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.ui.pda.adapters;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IMemoryBlock;
+import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
+import org.eclipse.debug.examples.ui.pda.DebugUIPlugin;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchWindow;
+
+/**
+ * Action to add a memory block when a PDA debug target is selected
+ */
+public class AddPDAMemoryBlockAction implements IActionDelegate2{
+
+ public AddPDAMemoryBlockAction() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
+ if (window != null) {
+ ISelectionService service = window.getSelectionService();
+ ISelection selection = service.getSelection();
+ PDADebugTarget target = getTarget(selection);
+ if (target != null) {
+ try {
+ IMemoryBlock block = target.getMemoryBlock(0, 1024);
+ DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks(new IMemoryBlock[]{block});
+ } catch (DebugException e) {
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Returns the selected debug target or <code>null</code>.
+ *
+ * @param selection selection
+ * @return debug target from the selection or <code>null</code>
+ */
+ private PDADebugTarget getTarget(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ if (ss.size() == 1) {
+ Object element = ss.getFirstElement();
+ if (element instanceof PDADebugTarget) {
+ return (PDADebugTarget) element;
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ PDADebugTarget target = getTarget(selection);
+ action.setEnabled(target != null && !target.isTerminated());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ run(action);
+ }
+
+
+}

Back to the top