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 21 public class AddMemoryRenderingContextAction implements IViewActionDelegate { 22 23 private IMemoryRenderingSite fMemoryView; 24 25 28 public void init(IViewPart view) { 29 30 if (view instanceof IMemoryRenderingSite) 31 { 32 fMemoryView = (IMemoryRenderingSite)view; 33 } 34 } 35 36 39 public void run(IAction action) { 40 41 if (fMemoryView == null) 42 return; 43 44 IMemoryRenderingContainer[] viewPanes = fMemoryView.getMemoryRenderingContainers(); 45 String actionId = action.getId(); 46 IMemoryRenderingContainer selectedPane = null; 47 48 for (int i=0; i<viewPanes.length; i++) 49 { 50 if (actionId.indexOf(viewPanes[i].getId()) != -1) 51 { 52 selectedPane = viewPanes[i]; 53 break; 54 } 55 } 56 57 if (selectedPane == null) 58 return; 59 60 AddMemoryRenderingAction addAction = new AddMemoryRenderingAction(selectedPane); 61 addAction.run(); 62 63 addAction.dispose(); 64 } 65 66 69 public void selectionChanged(IAction action, ISelection selection) { 70 71 } 72 73 } 74 | Popular Tags |