Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.debug.ui/plugin.properties6
-rw-r--r--org.eclipse.debug.ui/plugin.xml20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java251
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ToggleViewPaneAction.java40
7 files changed, 353 insertions, 6 deletions
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties
index 04a407b88..a64a273a8 100644
--- a/org.eclipse.debug.ui/plugin.properties
+++ b/org.eclipse.debug.ui/plugin.properties
@@ -359,4 +359,8 @@ exportBreakpoints.label=E&xport Breakpoints...
importBreakpoints.label=I&mport Breakpoints...
exportBreakpoints.name=Breakpoints
importBreakpoints.description=Import breakpoints from the local file system.
-exportBreakpoints.description=Export breakpoints to the local file system. \ No newline at end of file
+exportBreakpoints.description=Export breakpoints to the local file system.
+
+switchMemoryBlock.label = Switch &Memory Monitor
+toggleMemoryMonitorsPane.label = Toggle Memory Monitors Pane
+toggleMemoryMonitorsPane.description = Toggle visibility of the Memory Monitors Pane \ No newline at end of file
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index fa3ff8d57..39900eb73 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -923,6 +923,16 @@
menubarPath="additions"
style="push"
tooltip="%SelectCodepagesAction.label"/>
+ <action
+ class="org.eclipse.debug.internal.ui.views.memory.SwitchMemoryBlockAction"
+ disabledIcon="icons/full/dlcl16/memoryreset_tsk.gif"
+ helpContextId="switchMemoryBlockAction_context"
+ hoverIcon="icons/full/elcl16/memoryreset_tsk.gif"
+ icon="icons/full/elcl16/memoryreset_tsk.gif"
+ id="org.eclipse.debug.ui.switchMemoryBlock"
+ label="%switchMemoryBlock.label"
+ toolbarPath="switchMonitorGroup"
+ tooltip="%switchMemoryBlock.label"/>
</viewContribution>
</extension>
<extension
@@ -1787,6 +1797,11 @@ M4 = Platform-specific fourth key
categoryId="org.eclipse.debug.ui.category.run"
name="%ActionDefinition.removeAllBreakpoints.name"
id="org.eclipse.debug.ui.commands.RemoveAllBreakpoints"/>
+ <command
+ categoryId="org.eclipse.debug.ui.category.run"
+ description="%toggleMemoryMonitorsPane.description"
+ id="org.eclipse.debug.ui.commands.toggleMemoryMonitorsPane"
+ name="%toggleMemoryMonitorsPane.label"/>
</extension>
<extension point="org.eclipse.ui.bindings">
<key
@@ -1877,6 +1892,11 @@ M4 = Platform-specific fourth key
contextId="org.eclipse.debug.ui.memoryview"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M3+M"/>
+ <key
+ commandId="org.eclipse.debug.ui.commands.toggleMemoryMonitorsPane"
+ contextId="org.eclipse.debug.ui.memoryview"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+T"/>
</extension>
<extension
point="org.eclipse.ui.editors.annotationTypes">
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
index 7145fafd1..af3a33e0b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java
@@ -211,6 +211,8 @@ public class DebugUIMessages extends NLS {
public static String AddMemoryBlocksComposite_0;
public static String AddMemoryBlocksComposite_1;
public static String AddMemoryBlocksComposite_2;
+ public static String SwitchMemoryBlockAction_0;
+ public static String SwitchMemoryBlockAction_3;
static {
// load message values from bundle file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
index be3ab5470..29c9a8e56 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
@@ -204,3 +204,5 @@ TableRenderingPreferencePage_2=Number of Lines per Page:
TableRenderingPreferencePage_3=Page size cannot be less than 1.
TableRenderingPreferencePage_4=Page size is invalid.
TableRenderingPrefAction_0=Table Renderings
+SwitchMemoryBlockAction_0=Unknown
+SwitchMemoryBlockAction_3=Unknown
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
index 0c2512dd4..73cd77734 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
@@ -82,6 +82,7 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
private static final String VISIBILITY_PREF = IInternalDebugUIConstants.ID_MEMORY_VIEW+".viewPanesVisibility"; //$NON-NLS-1$
private static final String ID_MEMORY_VIEW_CONTEXT = "org.eclipse.debug.ui.memoryview"; //$NON-NLS-1$
private static final String ID_ADD_MEMORY_BLOCK_COMMAND = "org.eclipse.debug.ui.commands.addMemoryMonitor"; //$NON-NLS-1$
+ private static final String ID_TOGGLE_MEMORY_MONITORS_PANE_COMMAND = "org.eclipse.debug.ui.commands.toggleMemoryMonitorsPane"; //$NON-NLS-1$
private String[] defaultVisiblePaneIds ={MemoryBlocksTreeViewPane.PANE_ID, IInternalDebugUIConstants.ID_RENDERING_VIEW_PANE_1};
@@ -95,6 +96,10 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
private IContextActivation fContext;
private Set fRegisteredMemoryBlocks = new HashSet();
+
+ private AbstractHandler fAddHandler;
+ private AbstractHandler fToggleMonitorsHandler;
+
private IMemoryBlockListener fMemoryBlockListener = new IMemoryBlockListener() {
public void memoryBlocksAdded(IMemoryBlock[] memory) {
@@ -105,7 +110,6 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
// clean up registered memory blocks
unRegisterMemoryBlocks(memory);
}};
- private AbstractHandler fAddHandler;
class MemoryViewSelectionProvider implements ISelectionProvider, ISelectionChangedListener
{
@@ -339,6 +343,7 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
// restore view pane after finishing creating all the view panes
restoreView();
}
+
public void activated() {
IWorkbench workbench = PlatformUI.getWorkbench();
@@ -348,7 +353,7 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
if (commandSupport != null && contextSupport != null)
{
fContext = contextSupport.activateContext(ID_MEMORY_VIEW_CONTEXT);
- Command command = commandSupport.getCommand(ID_ADD_MEMORY_BLOCK_COMMAND);
+ Command addCommand = commandSupport.getCommand(ID_ADD_MEMORY_BLOCK_COMMAND);
// dynamically change handler on Add Memory Monitor command based
// on which Memory View is active
@@ -366,7 +371,23 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
return null;
}};
}
- command.setHandler(fAddHandler);
+ addCommand.setHandler(fAddHandler);
+
+ final MemoryView view = this;
+ Command toggleCommand = commandSupport.getCommand(ID_TOGGLE_MEMORY_MONITORS_PANE_COMMAND);
+ if (fToggleMonitorsHandler == null)
+ {
+ fToggleMonitorsHandler = new AbstractHandler() {
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ToggleMemoryMonitorsAction action = new ToggleMemoryMonitorsAction();
+ action.init(view);
+ action.run();
+ action.dispose();
+ return null;
+ }
+ };
+ }
+ toggleCommand.setHandler(fToggleMonitorsHandler);
}
}
@@ -382,6 +403,9 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
Command command = commandSupport.getCommand(ID_ADD_MEMORY_BLOCK_COMMAND);
command.setHandler(null);
+ Command toggleCommand = commandSupport.getCommand(ID_TOGGLE_MEMORY_MONITORS_PANE_COMMAND);
+ toggleCommand.setHandler(null);
+
if (fContext != null)
contextSupport.deactivateContext(fContext);
}
@@ -441,6 +465,7 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
{
renderingViewMgr.add(renderingActions[i]);
}
+
ToolBar renderingToolbar = renderingViewMgr.createControl(renderingViewForm);
renderingViewForm.setTopRight(renderingToolbar);
@@ -479,6 +504,12 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
fRegisteredMemoryBlocks.clear();
+ if (fAddHandler != null)
+ fAddHandler.dispose();
+
+ if (fToggleMonitorsHandler != null)
+ fToggleMonitorsHandler.dispose();
+
super.dispose();
}
@@ -705,4 +736,5 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite {
{
return fRegisteredMemoryBlocks.contains(memoryBlock);
}
+
}
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
new file mode 100644
index 000000000..bbf0230eb
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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.internal.ui.views.memory;
+
+import org.eclipse.core.runtime.IAdaptable;
+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.IMemoryBlock;
+import org.eclipse.debug.core.model.IMemoryBlockExtension;
+import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
+import org.eclipse.debug.internal.ui.DebugUIMessages;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.memory.IMemoryRendering;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.PlatformUI;
+
+public class SwitchMemoryBlockAction extends Action implements IViewActionDelegate, IActionDelegate2 {
+
+ private IViewPart fView;
+ private MenuCreator fMenuCreator;
+
+ /**
+ * Switch tab folder for fMemoryBlock to the top in Memory Rendering View
+ */
+ class SwitchToAction extends Action
+ {
+ private IMemoryBlock fMemoryblock;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+
+ // tell the view to switch memory block
+ fView.getSite().getSelectionProvider().setSelection(new StructuredSelection(fMemoryblock));
+ }
+
+ public SwitchToAction(IMemoryBlock memBlk)
+ {
+ super();
+ try {
+ String text;
+ if (memBlk instanceof IMemoryBlockExtension)
+ {
+ text = ((IMemoryBlockExtension)memBlk).getExpression();
+
+ if (text == null)
+ {
+ text = DebugUIMessages.SwitchMemoryBlockAction_0;
+ }
+
+ if (((IMemoryBlockExtension)memBlk).getBigBaseAddress() != null)
+ {
+ text += " : 0x"; //$NON-NLS-1$
+ text += ((IMemoryBlockExtension)memBlk).getBigBaseAddress().toString(16);
+ }
+ }
+ else
+ {
+ long address = memBlk.getStartAddress();
+ text = Long.toHexString(address);
+ }
+ super.setText(text);
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, DebugUIPlugin.getUniqueIdentifier() + ".switchToAction_context"); //$NON-NLS-1$
+
+ } catch (DebugException e) {
+
+ super.setText(DebugUIMessages.SwitchMemoryBlockAction_3);
+ }
+ fMemoryblock = memBlk;
+ }
+ }
+
+ class MenuCreator implements IMenuCreator
+ {
+ Menu dropdown;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#dispose()
+ */
+ public void dispose() {
+ if (dropdown != null)
+ dropdown.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent) {
+
+ if (dropdown != null)
+ {
+ dropdown.dispose();
+ dropdown = null;
+ }
+
+ if (dropdown == null)
+ {
+ dropdown = new Menu(parent);
+
+ ISelection selection = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(IDebugUIConstants.ID_DEBUG_VIEW);
+
+ if (selection == null)
+ return dropdown;
+
+ if (selection instanceof StructuredSelection && !selection.isEmpty())
+ {
+ if (((StructuredSelection)selection).getFirstElement() instanceof IDebugElement)
+ {
+ IDebugElement element = (IDebugElement)((StructuredSelection)selection).getFirstElement();
+ IMemoryBlockRetrieval retrieval = (IMemoryBlockRetrieval)element.getAdapter(IMemoryBlockRetrieval.class);
+
+ if (retrieval == null)
+ retrieval = element.getDebugTarget();
+
+ if (retrieval != null)
+ {
+ // get all memory blocks associated with selected debug target
+ IMemoryBlock[] allMemoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(retrieval);
+
+ // get selection from memory view
+ IMemoryBlock memoryBlock = getCurrentMemoryBlock();
+
+ for (int i=0; i<allMemoryBlocks.length; i++)
+ {
+ SwitchToAction action = new SwitchToAction(allMemoryBlocks[i]);
+
+ if (allMemoryBlocks[i] == memoryBlock)
+ action.setChecked(true);
+
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(dropdown, -1);
+ }
+ }
+ }
+ }
+ }
+
+ return dropdown;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ }
+
+ public void init(IViewPart view) {
+ fView = view;
+ }
+
+ public void run(IAction action) {
+ IAdaptable context = DebugUITools.getDebugContext();
+ if (context instanceof IDebugElement)
+ {
+ IDebugElement debugContext = (IDebugElement)context;
+ IMemoryBlockRetrieval retrieval = (IMemoryBlockRetrieval)debugContext.getAdapter(IMemoryBlockRetrieval.class);
+ if (retrieval == null)
+ retrieval = debugContext.getDebugTarget();
+
+ if (retrieval != null)
+ {
+ IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(retrieval);
+ IMemoryBlock current = getCurrentMemoryBlock();
+
+ int next = 0;
+ if (current != null)
+ {
+ for (int i=0; i<memoryBlocks.length; i++)
+ {
+ if (memoryBlocks[i] == current)
+ next = i+1;
+ }
+ }
+
+ if (next > memoryBlocks.length-1)
+ next = 0;
+
+ SwitchToAction switchAction = new SwitchToAction(memoryBlocks[next]);
+ switchAction.run();
+ }
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ public void init(IAction action) {
+ fMenuCreator = new MenuCreator();
+ action.setMenuCreator(fMenuCreator);
+ }
+
+ public void dispose() {
+ fMenuCreator.dispose();
+ }
+
+ public void runWithEvent(IAction action, Event event) {
+ run(action);
+ }
+
+ private IMemoryBlock getCurrentMemoryBlock() {
+ ISelection memBlkSelection = fView.getSite().getSelectionProvider().getSelection();
+ IMemoryBlock memoryBlock = null;
+
+ if (memBlkSelection != null)
+ {
+ if (!memBlkSelection.isEmpty() && memBlkSelection instanceof IStructuredSelection)
+ {
+ Object obj = ((IStructuredSelection)memBlkSelection).getFirstElement();
+
+ if (obj instanceof IMemoryBlock)
+ {
+ memoryBlock = (IMemoryBlock)obj;
+ }
+ else if (obj instanceof IMemoryRendering){
+ memoryBlock = ((IMemoryRendering)obj).getMemoryBlock();
+ }
+ }
+ }
+ return memoryBlock;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ToggleViewPaneAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ToggleViewPaneAction.java
index 5b38c55cb..645c2d706 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ToggleViewPaneAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ToggleViewPaneAction.java
@@ -10,18 +10,24 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.memory;
+import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
/**
* @since 3.1
*/
-abstract public class ToggleViewPaneAction extends Action implements IViewActionDelegate {
+abstract public class ToggleViewPaneAction extends Action implements IViewActionDelegate, IActionDelegate2, IPropertyChangeListener {
MemoryView fView;
+ IAction fAction;
/* (non-Javadoc)
@@ -50,6 +56,13 @@ abstract public class ToggleViewPaneAction extends Action implements IViewActio
action.setChecked(false);
}
+
+ public void run() {
+ if (fView == null)
+ return;
+
+ fView.showViewPane(!fView.isViewPaneVisible(getPaneId()), getPaneId());
+ }
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
@@ -60,6 +73,29 @@ abstract public class ToggleViewPaneAction extends Action implements IViewActio
else
action.setChecked(false);
}
+
+ public void dispose() {
+ DebugUITools.getPreferenceStore().removePropertyChangeListener(this);
+ }
+
+ public void init(IAction action) {
+ fAction = action;
+ DebugUITools.getPreferenceStore().addPropertyChangeListener(this);
+ }
+
+ public void runWithEvent(IAction action, Event event) {
+ run(action);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if (fView != null && fAction != null)
+ {
+ if (fView.isViewPaneVisible(getPaneId()))
+ fAction.setChecked(true);
+ else
+ fAction.setChecked(false);
+ }
+ }
- abstract public String getPaneId();
+ abstract public String getPaneId();
}

Back to the top