org.eclipse.cdt.internal.ui.util
Class RemoteTreeContentManager

java.lang.Object
  extended by org.eclipse.cdt.internal.ui.util.RemoteTreeContentManager

public class RemoteTreeContentManager
extends java.lang.Object

A remote content manager that merges content into a tree rather then replacing its children with a "pending" node, and then the real children when they are available. This avoids collapsing the viewer when a refresh is performed. This implementation is currently tied to the RemoteTreeViewer.

Since:
3.1

Nested Class Summary
 class RemoteTreeContentManager.Collector
          Element collector
 
Constructor Summary
RemoteTreeContentManager(org.eclipse.jface.viewers.ITreeContentProvider provider, RemoteTreeViewer viewer, org.eclipse.ui.IWorkbenchPartSite site)
          Contructs a new content manager.
 
Method Summary
 void cancel()
          Cancels any content this provider is currently fetching.
 java.lang.Object[] getChildren(java.lang.Object parent)
          Returns the child elements of the given element, or in the case of a deferred element, returns a placeholder.
 boolean mayHaveChildren(java.lang.Object element)
          Provides an optimized lookup for determining if an element has children.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteTreeContentManager

public RemoteTreeContentManager(org.eclipse.jface.viewers.ITreeContentProvider provider,
                                RemoteTreeViewer viewer,
                                org.eclipse.ui.IWorkbenchPartSite site)
Contructs a new content manager.

Parameters:
provider - content provider
viewer - viewer
site - part site
Method Detail

getChildren

public java.lang.Object[] getChildren(java.lang.Object parent)
Returns the child elements of the given element, or in the case of a deferred element, returns a placeholder. If a deferred element is used, a job is created to fetch the children in the background.

Parameters:
parent - The parent object.
Returns:
Object[] or null if parent is not an instance of IDeferredWorkbenchAdapter.

mayHaveChildren

public boolean mayHaveChildren(java.lang.Object element)
Provides an optimized lookup for determining if an element has children. This is required because elements that are populated lazilly can't answer getChildren just to determine the potential for children. Throw an AssertionFailedException if element is null.

Parameters:
element - The Object being tested. This should not be null.
Returns:
boolean true if there are potentially children.
Throws:
java.lang.RuntimeException - if the element is null.

cancel

public void cancel()
Cancels any content this provider is currently fetching.