1 11 12 13 package org.eclipse.debug.internal.ui.views.memory; 14 15 import org.eclipse.debug.internal.ui.DebugUIPlugin; 16 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; 17 import org.eclipse.jface.action.Action; 18 import org.eclipse.ui.IViewPart; 19 import org.eclipse.ui.IWorkbenchPage; 20 import org.eclipse.ui.IWorkbenchPart; 21 import org.eclipse.ui.PartInitException; 22 23 24 33 abstract public class AbstractMemoryAction extends Action 34 { 35 public AbstractMemoryAction() 36 { 37 super(); 38 } 39 40 public AbstractMemoryAction(String label) 41 { 42 super(label); 43 } 44 45 public AbstractMemoryAction(String label, int style){ 46 super(label, style); 47 } 48 49 52 abstract IMemoryViewTab getViewTab(); 53 54 60 public IMemoryViewTab getTopViewTabFromView(String viewId){ 61 62 if (viewId.equals(IInternalDebugUIConstants.ID_MEMORY_VIEW)) 63 { 64 IWorkbenchPage p= DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); 66 if (p == null) { 67 return null; 68 } 69 IViewPart view = null; 70 view= p.findView(viewId); 71 72 if (view == null) { 73 try { 74 IWorkbenchPart activePart= p.getActivePart(); 75 view= (MemoryView) p.showView(viewId); 76 p.activate(activePart); 77 } catch (PartInitException e) { 78 return null; 79 } 80 81 } 82 83 if (view instanceof IMemoryView) 84 { 85 IMemoryViewTab topTap = ((IMemoryView)view).getTopMemoryTab(); 86 87 return topTap; 88 } 89 else 90 { 91 return null; 92 } 93 } 94 else 95 return null; 96 } 97 } 98 | Popular Tags |