Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2005-01-10 13:53:33 -0500
committerDarin Wright2005-01-10 13:53:33 -0500
commit958f114f5926ae9b443bc1d1a44cdaadc37ba9e6 (patch)
treeb59589c045cbd91e922485ca79f19127a71584ba
parentadeb508727d0c55d0e655cd7a15b4c1ca602a354 (diff)
downloadeclipse.platform.debug-958f114f5926ae9b443bc1d1a44cdaadc37ba9e6.tar.gz
eclipse.platform.debug-958f114f5926ae9b443bc1d1a44cdaadc37ba9e6.tar.xz
eclipse.platform.debug-958f114f5926ae9b443bc1d1a44cdaadc37ba9e6.zip
Bug 82403 - [Memory View] Unable to remove more than one memory monitor
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java73
4 files changed, 71 insertions, 8 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
index 5c6b54bf0..1481cfc51 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
@@ -96,7 +96,6 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_RESET_MEMORY, ELCL + "memoryreset_tsk.gif"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_COPY_VIEW_TO_CLIPBOARD, ELCL + "copyviewtoclipboard_tsk.gif"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_LCL_PRINT_TOP_VIEW_TAB, ELCL + "printview_tsk.gif"); //$NON-NLS-1$
-
// disabled local toolbars
declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_DETAIL_PANE, DLCL + "toggledetailpane_co.gif"); //$NON-NLS-1$
@@ -131,6 +130,7 @@ public class DebugPluginImages {
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESET_MEMORY, ELCL + "memoryreset_tsk.gif"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_COPY_VIEW_TO_CLIPBOARD, ELCL + "copyviewtoclipboard_tsk.gif"); //$NON-NLS-1$
declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_PRINT_TOP_VIEW_TAB, ELCL + "printview_tsk.gif"); //$NON-NLS-1$
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_REMOVE_ALL, ELCL + "rem_all_co.gif"); //$NON-NLS-1$
//Object
declareRegistryImage(IDebugUIConstants.IMG_OBJS_LAUNCH_DEBUG, OBJECT + "ldebug_obj.gif"); //$NON-NLS-1$
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 63825351c..168387fcb 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
@@ -105,6 +105,9 @@ MemoryViewTab.Format_is_invalid = Format is invalid.
MemoryViewTab.Column_size = Column Size
MemoryViewTab.Add_rendering = Add Rendering
MemoryView.Memory_monitors=Memory Monitors
+MemoryBlocksTreeViewPane.0=Remove All Memory Monitors
+MemoryBlocksTreeViewPane.1=Are you sure you want to remove all memory monitors?
+MemoryBlocksTreeViewPane.2=Remove All
MemoryView.Memory_renderings=Memory Renderings
MemoryViewTab.Unable_to_retrieve_base_address = Unable to retrieve base address from the memory monitor.
MemoryViewTab.Unknown = <Unknown>
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
index 6d28096fb..7f60cc874 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
@@ -79,6 +79,7 @@ public interface IInternalDebugUIConstants {
public static final String IMG_ELCL_RESET_MEMORY= "IMG_ELCL_RESET_MEMORY"; //$NON-NLS-1$
public static final String IMG_ELCL_COPY_VIEW_TO_CLIPBOARD= "IMG_ELCL_COPY_VIEW_TO_CLIPBOARD"; //$NON-NLS-1$
public static final String IMG_ELCL_PRINT_TOP_VIEW_TAB= "IMG_ELCL_PRINT_TOP_VIEW_TAB"; //$NON-NLS-1$
+ public static final String IMG_ELCL_REMOVE_ALL = "IMG_ELCL_REMOVE_ALL"; //$NON-NLS-1$
// object images
public static final String IMG_OBJS_INSTRUCTION_POINTER_TOP = "IMG_OBJS_INSTRUCTION_POINTER_TOP"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
index fbcfdfcda..dbe5ff0b3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
@@ -33,9 +33,12 @@ import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
@@ -51,6 +54,7 @@ import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.help.WorkbenchHelp;
@@ -68,6 +72,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, IMemoryView
private ViewPaneSelectionProvider fSelectionProvider;
private AddMemoryBlockAction fAddMemoryBlockAction;
private IAction fRemoveMemoryBlockAction;
+ private IAction fRemoveAllMemoryBlocksAction;
private Hashtable fTargetMemoryBlockMap = new Hashtable();
private String fPaneId;
private boolean fVisible = true;
@@ -88,7 +93,7 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, IMemoryView
setEnabled(true);
}
- /* (non-Javadoc)
+ /* (non-Javadoc)
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
@@ -96,15 +101,54 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, IMemoryView
if (selected != null && selected instanceof IStructuredSelection)
{
- Object selectedObj = ((IStructuredSelection)selected).getFirstElement();
+ Object[] selectedMemBlks = ((IStructuredSelection)selected).toArray();
+ IMemoryBlock[] memBlocks = new IMemoryBlock[selectedMemBlks.length];
+
+ System.arraycopy(selectedMemBlks, 0, memBlocks, 0, selectedMemBlks.length);
+ DebugPlugin.getDefault().getMemoryBlockManager().removeMemoryBlocks(memBlocks);
+ }
+ }
+ }
+
+ class TreeViewerRemoveAllMemoryBlocksAction extends Action
+ {
+ TreeViewerRemoveAllMemoryBlocksAction()
+ {
+ super();
+ setText(DebugUIMessages.getString(DebugUIMessages.getString("MemoryBlocksTreeViewPane.2"))); //$NON-NLS-1$
+
+ setToolTipText(DebugUIMessages.getString("MemoryBlocksTreeViewPane.2")); //$NON-NLS-1$
+ setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_ALL));
+ setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_ALL));
+ setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE_ALL));
+ WorkbenchHelp.setHelp(this, IDebugUIConstants.PLUGIN_ID + ".RemoveAllMemoryBlocksAction_context"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ public void run() {
+
+ IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow();
+ if (window == null) {
+ return;
+ }
+ boolean proceed = MessageDialog.openQuestion(window.getShell(), DebugUIMessages.getString("MemoryBlocksTreeViewPane.0"), DebugUIMessages.getString("MemoryBlocksTreeViewPane.1")); //$NON-NLS-1$ //$NON-NLS-2$
+ if (proceed) {
+ IMemoryBlock[] memBlocks;
+
+ IContentProvider contentProvider = fTreeViewer.getContentProvider();
- if (selectedObj != null && selectedObj instanceof IMemoryBlock)
+ if (contentProvider instanceof IStructuredContentProvider)
{
- DebugPlugin.getDefault().getMemoryBlockManager().removeMemoryBlocks(new IMemoryBlock[]{(IMemoryBlock)selectedObj});
+ IStructuredContentProvider strucContentProv = (IStructuredContentProvider)contentProvider;
+ Object[] elements = strucContentProv.getElements(fDebugTarget);
+ memBlocks = new IMemoryBlock[elements.length];
+ System.arraycopy(elements, 0, memBlocks, 0, elements.length);
+ DebugPlugin.getDefault().getMemoryBlockManager().removeMemoryBlocks(memBlocks);
}
-
}
- }
+ }
}
class MemoryBlocksViewerContentProvider extends BasicDebugViewContentProvider implements IMemoryBlockListener, ITreeContentProvider
@@ -491,9 +535,15 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, IMemoryView
{
fRemoveMemoryBlockAction = new TreeViewerRemoveMemoryBlocksAction();
}
+
+ if (fRemoveAllMemoryBlocksAction == null)
+ {
+ fRemoveAllMemoryBlocksAction = new TreeViewerRemoveAllMemoryBlocksAction();
+ }
+
updateActionsEnablement();
- return new IAction[]{fAddMemoryBlockAction, fRemoveMemoryBlockAction};
+ return new IAction[]{fAddMemoryBlockAction, fRemoveMemoryBlockAction, fRemoveAllMemoryBlocksAction};
}
/* (non-Javadoc)
@@ -575,10 +625,19 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, IMemoryView
if (fMemoryBlocks == null)
return;
+ if (fRemoveAllMemoryBlocksAction == null)
+ return;
+
if (fMemoryBlocks.size() > 0)
+ {
fRemoveMemoryBlockAction.setEnabled(true);
+ fRemoveAllMemoryBlocksAction.setEnabled(true);
+ }
else
+ {
fRemoveMemoryBlockAction.setEnabled(false);
+ fRemoveAllMemoryBlocksAction.setEnabled(false);
+ }
}
}

Back to the top