1 11 12 package org.eclipse.debug.internal.ui.views.memory; 13 14 import org.eclipse.debug.internal.ui.DebugPluginImages; 15 import org.eclipse.debug.internal.ui.DebugUIMessages; 16 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; 17 import org.eclipse.debug.ui.memory.IMemoryRendering; 18 import org.eclipse.debug.ui.memory.IMemoryRenderingContainer; 19 import org.eclipse.jface.action.Action; 20 21 22 32 public class RemoveMemoryRenderingAction extends Action 33 { 34 private IMemoryRenderingContainer fViewPane; 35 public RemoveMemoryRenderingAction(IMemoryRenderingContainer viewPane) 36 { 37 super(DebugUIMessages.RemoveMemoryRenderingAction_Remove_rendering, AS_PUSH_BUTTON); 39 setText(DebugUIMessages.RemoveMemoryRenderingAction_Remove_rendering); 40 41 setToolTipText(DebugUIMessages.RemoveMemoryRenderingAction_Remove_rendering); 42 setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_MEMORY)); 43 setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_REMOVE_MEMORY)); 44 setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE_MEMORY)); 45 fViewPane = viewPane; 46 } 47 48 51 public void run() { 52 53 IMemoryViewTab topTab = getViewTab(); 55 56 if (topTab != null) 57 { 58 IMemoryRendering rendering = topTab.getRendering(); 59 60 if (rendering != null) 61 { 62 fViewPane.removeMemoryRendering(rendering); 63 } 64 } 65 } 66 67 70 IMemoryViewTab getViewTab() { 71 if (fViewPane instanceof IMemoryView) 72 { 73 return ((IMemoryView)fViewPane).getTopMemoryTab(); 74 } 75 return null; 76 } 77 } 78 | Popular Tags |