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