KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > memory > RemoveMemoryBlockAction


1 /*******************************************************************************
2  * Copyright (c) 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.debug.internal.ui.views.memory;
13
14 import org.eclipse.debug.core.model.IMemoryBlock;
15 import org.eclipse.debug.internal.core.memory.MemoryBlockManager;
16 import org.eclipse.debug.internal.ui.DebugPluginImages;
17 import org.eclipse.debug.internal.ui.DebugUIMessages;
18 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
19 import org.eclipse.debug.ui.IDebugUIConstants;
20 import org.eclipse.ui.help.WorkbenchHelp;
21
22 /**
23  * Remove Memory Block Action from Memory View
24  *
25  * @since 3.0
26  */

27 public class RemoveMemoryBlockAction extends AbstractMemoryAction {
28     
29     
30     public RemoveMemoryBlockAction()
31     {
32         setText(DebugUIMessages.getString("RemoveMemoryBlockAction.title")); //$NON-NLS-1$
33

34         setToolTipText(DebugUIMessages.getString("RemoveMemoryBlockAction.tooltip")); //$NON-NLS-1$
35
setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_MEMORY));
36         setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_REMOVE_MEMORY));
37         setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE_MEMORY));
38         WorkbenchHelp.setHelp(this, IDebugUIConstants.PLUGIN_ID + ".RemoveMemoryBlockAction_context"); //$NON-NLS-1$
39
}
40     
41     /* (non-Javadoc)
42      * @see org.eclipse.jface.action.IAction#run()
43      */

44     public void run() {
45         
46         if (getViewTab() == null)
47             return;
48         
49         // get top view tab
50
IMemoryViewTab topTab = getViewTab();
51         
52         // remove memory block from memory block manager
53
if (topTab != null)
54         {
55             IMemoryBlock mem = topTab.getMemoryBlock();
56             MemoryBlockManager.getMemoryBlockManager().removeMemoryBlock(mem);
57         }
58     }
59     /* (non-Javadoc)
60      * @see org.eclipse.debug.ui.internal.actions.AbstractMemoryAction#getViewTab()
61      */

62     IMemoryViewTab getViewTab() {
63         return getTopViewTabFromView(IInternalDebugUIConstants.ID_MEMORY_VIEW);
64     }
65 }
66
Popular Tags