1 11 package org.eclipse.debug.internal.ui.views.memory; 12 13 import org.eclipse.debug.ui.memory.IMemoryRenderingContainer; 14 import org.eclipse.debug.ui.memory.IMemoryRenderingSite; 15 import org.eclipse.jface.action.IAction; 16 import org.eclipse.jface.viewers.ISelection; 17 import org.eclipse.ui.IViewActionDelegate; 18 import org.eclipse.ui.IViewPart; 19 20 24 public class RemoveRenderingContextAction implements IViewActionDelegate { 25 26 private IMemoryRenderingSite fMemoryView; 27 28 31 public void init(IViewPart view) { 32 if (view instanceof IMemoryRenderingSite) 33 { 34 fMemoryView = (IMemoryRenderingSite)view; 35 } 36 } 37 38 41 public void run(IAction action) { 42 if (fMemoryView == null) 43 return; 44 45 IMemoryRenderingContainer[] viewPanes = fMemoryView.getMemoryRenderingContainers(); 46 String actionId = action.getId(); 47 IMemoryRenderingContainer selectedPane = null; 48 49 for (int i=0; i<viewPanes.length; i++) 50 { 51 if (actionId.indexOf(viewPanes[i].getId()) != -1) 52 { 53 selectedPane = viewPanes[i]; 54 break; 55 } 56 } 57 58 if (selectedPane == null) 59 return; 60 61 RemoveMemoryRenderingAction removeAction = new RemoveMemoryRenderingAction(selectedPane); 62 removeAction.run(); 63 } 64 65 68 public void selectionChanged(IAction action, ISelection selection) { 69 } 70 71 } 72 | Popular Tags |