Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.ui.progress
Class DeferredTreeContentManager  view DeferredTreeContentManager download DeferredTreeContentManager.java

java.lang.Object
  extended byorg.eclipse.ui.progress.DeferredTreeContentManager

public class DeferredTreeContentManager
extends java.lang.Object

The DeferredContentManager is a class that helps an ITreeContentProvider get its deferred input. NOTE AbstractTreeViewer#isExpandable may need to be implemented in AbstractTreeViewer subclasses with deferred content that use filtering as a call to #getChildren may be required to determine the correct state of the expanding control. AbstractTreeViewers which use this class may wish to sacrifice accuracy of the expandable state indicator for the performance benefits of defering content.

Since:
3.0

Field Summary
(package private)  org.eclipse.jface.viewers.ITreeContentProvider contentProvider
           
(package private)  IWorkbenchSiteProgressService progressService
           
(package private)  org.eclipse.jface.viewers.AbstractTreeViewer treeViewer
           
 
Constructor Summary
DeferredTreeContentManager(org.eclipse.jface.viewers.ITreeContentProvider provider, org.eclipse.jface.viewers.AbstractTreeViewer viewer)
          Create a new instance of the receiver using the supplied content provider and viewer.
DeferredTreeContentManager(org.eclipse.jface.viewers.ITreeContentProvider provider, org.eclipse.jface.viewers.AbstractTreeViewer viewer, org.eclipse.ui.IWorkbenchPartSite site)
          Create a new instance of the receiver using the supplied content provider and viewer.
 
Method Summary
protected  void addChildren(java.lang.Object parent, java.lang.Object[] children, org.eclipse.core.runtime.IProgressMonitor monitor)
          Create a UIJob to add the children to the parent in the tree viewer.
 void cancel(java.lang.Object parent)
          Cancel all jobs that are fetching content for the given parent or any of its children.
protected  IElementCollector createElementCollector(java.lang.Object parent, org.eclipse.ui.internal.progress.PendingUpdateAdapter placeholder)
          Create the element collector for the receiver.
protected  IDeferredWorkbenchAdapter getAdapter(java.lang.Object element)
          Return the IDeferredWorkbenchAdapter for element or the element if it is an instance of IDeferredWorkbenchAdapter.
 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 isDeferredAdapter(java.lang.Object element)
          Return whether or not the element is or adapts to an IDeferredWorkbenchAdapter.
 boolean mayHaveChildren(java.lang.Object element)
          Provides an optimized lookup for determining if an element has children.
protected  void runClearPlaceholderJob(org.eclipse.ui.internal.progress.PendingUpdateAdapter placeholder)
          Run a job to clear the placeholder.
protected  void startFetchingDeferredChildren(java.lang.Object parent, IDeferredWorkbenchAdapter adapter, org.eclipse.ui.internal.progress.PendingUpdateAdapter placeholder)
          Starts a job and creates a collector for fetching the children of this deferred adapter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentProvider

org.eclipse.jface.viewers.ITreeContentProvider contentProvider

treeViewer

org.eclipse.jface.viewers.AbstractTreeViewer treeViewer

progressService

IWorkbenchSiteProgressService progressService
Constructor Detail

DeferredTreeContentManager

public DeferredTreeContentManager(org.eclipse.jface.viewers.ITreeContentProvider provider,
                                  org.eclipse.jface.viewers.AbstractTreeViewer viewer,
                                  org.eclipse.ui.IWorkbenchPartSite site)
Create a new instance of the receiver using the supplied content provider and viewer. Run any jobs using the site.


DeferredTreeContentManager

public DeferredTreeContentManager(org.eclipse.jface.viewers.ITreeContentProvider provider,
                                  org.eclipse.jface.viewers.AbstractTreeViewer viewer)
Create a new instance of the receiver using the supplied content provider and viewer.

Method Detail

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 not an instance of IDeferredWorkbenchAdapter.


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.


getAdapter

protected IDeferredWorkbenchAdapter getAdapter(java.lang.Object element)
Return the IDeferredWorkbenchAdapter for element or the element if it is an instance of IDeferredWorkbenchAdapter. If it does not exist return null.


startFetchingDeferredChildren

protected void startFetchingDeferredChildren(java.lang.Object parent,
                                             IDeferredWorkbenchAdapter adapter,
                                             org.eclipse.ui.internal.progress.PendingUpdateAdapter placeholder)
Starts a job and creates a collector for fetching the children of this deferred adapter. If children are waiting to be retrieved for this parent already, that job is cancelled and another is started.


addChildren

protected void addChildren(java.lang.Object parent,
                           java.lang.Object[] children,
                           org.eclipse.core.runtime.IProgressMonitor monitor)
Create a UIJob to add the children to the parent in the tree viewer.


isDeferredAdapter

public boolean isDeferredAdapter(java.lang.Object element)
Return whether or not the element is or adapts to an IDeferredWorkbenchAdapter.


runClearPlaceholderJob

protected void runClearPlaceholderJob(org.eclipse.ui.internal.progress.PendingUpdateAdapter placeholder)
Run a job to clear the placeholder. This is used when the update for the tree is complete so that the user is aware that no more updates are pending.


cancel

public void cancel(java.lang.Object parent)
Cancel all jobs that are fetching content for the given parent or any of its children.


createElementCollector

protected IElementCollector createElementCollector(java.lang.Object parent,
                                                   org.eclipse.ui.internal.progress.PendingUpdateAdapter placeholder)
Create the element collector for the receiver.