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 /org.eclipse.debug.examples.ui
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
Diffstat (limited to 'org.eclipse.debug.examples.ui')
-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
3 files changed, 119 insertions, 1 deletions
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