1 11 12 package org.eclipse.debug.internal.ui.elements.adapters; 13 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.debug.core.DebugPlugin; 16 import org.eclipse.debug.core.model.IMemoryBlockRetrieval; 17 import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; 18 import org.eclipse.debug.internal.ui.viewers.provisional.AsynchronousContentAdapter; 19 import org.eclipse.debug.ui.IDebugUIConstants; 20 21 public class MemoryRetrievalContentAdapter extends AsynchronousContentAdapter{ 22 23 protected Object [] getChildren(Object parent, IPresentationContext context) throws CoreException { 24 String id = context.getId(); 25 if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) 26 { 27 if (parent instanceof IMemoryBlockRetrieval) 28 { 29 return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)parent); 30 } 31 } 32 return EMPTY; 33 } 34 35 protected boolean hasChildren(Object element, IPresentationContext context) throws CoreException { 36 String id = context.getId(); 37 if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) 38 { 39 if (element instanceof IMemoryBlockRetrieval) 40 { 41 if (((IMemoryBlockRetrieval)element).supportsStorageRetrieval()) 42 return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)element).length > 0; 43 } 44 } 45 return false; 46 } 47 48 protected boolean supportsPartId(String id) { 49 return id.equals(IDebugUIConstants.ID_MEMORY_VIEW); 50 } 51 52 } 53 | Popular Tags |