Package org.eclipse.ui.progress
Class DeferredTreeContentManager
java.lang.Object
org.eclipse.ui.progress.DeferredTreeContentManager
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 deferring
 content.
- Since:
- 3.0
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new instance of the receiver using the supplied content provider and viewer.DeferredTreeContentManager(AbstractTreeViewer viewer, IWorkbenchPartSite site) Create a new instance of the receiver using the supplied content provider and viewer.DeferredTreeContentManager(ITreeContentProvider provider, AbstractTreeViewer viewer) Deprecated, for removal: This API element is subject to removal in a future version.in 3.4. provider is not used by this classDeferredTreeContentManager(ITreeContentProvider provider, AbstractTreeViewer viewer, IWorkbenchPartSite site) Deprecated, for removal: This API element is subject to removal in a future version.in 3.4. provider is not used by this class
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddChildren(Object parent, Object[] children, IProgressMonitor monitor) Create a UIJob to add the children to the parent in the tree viewer.voidaddUpdateCompleteListener(IJobChangeListener listener) Add a listener to list of update complete listeners.voidCancel all jobs that are fetching content for the given parent or any of its children.protected IElementCollectorcreateElementCollector(Object parent, PendingUpdateAdapter placeholder) Create the element collector for the receiver.protected PendingUpdateAdapterFactory method for creating the pending update adapter representing the placeholder node.protected IDeferredWorkbenchAdaptergetAdapter(Object element) Return the IDeferredWorkbenchAdapter for element or the element if it is an instance of IDeferredWorkbenchAdapter.Object[]getChildren(Object parent) Returns the child elements of the given element, or in the case of a deferred element, returns a placeholder.protected StringgetFetchJobName(Object parent, IDeferredWorkbenchAdapter adapter) Returns a name to use for the job that fetches children of the given parent.booleanisDeferredAdapter(Object element) Return whether or not the element is or adapts to an IDeferredWorkbenchAdapter.booleanmayHaveChildren(Object element) Provides an optimized lookup for determining if an element has children.voidRemoves the listener from the list of update listeners that are attached to the job that updates the viewer content (clears the pending entry, etc.)protected voidrunClearPlaceholderJob(PendingUpdateAdapter placeholder) Run a job to clear the placeholder.protected voidstartFetchingDeferredChildren(Object parent, IDeferredWorkbenchAdapter adapter, PendingUpdateAdapter placeholder) Starts a job and creates a collector for fetching the children of this deferred adapter.
- 
Constructor Details- 
DeferredTreeContentManager@Deprecated(forRemoval=true, since="2025-03") public DeferredTreeContentManager(ITreeContentProvider provider, AbstractTreeViewer viewer, IWorkbenchPartSite site) Deprecated, for removal: This API element is subject to removal in a future version.in 3.4. provider is not used by this classCreate a new instance of the receiver using the supplied content provider and viewer. Run any jobs using the site.- Parameters:
- provider- content provider
- viewer- content viewer
- site- part site
 
- 
DeferredTreeContentManager@Deprecated(forRemoval=true, since="2025-03") public DeferredTreeContentManager(ITreeContentProvider provider, AbstractTreeViewer viewer) Deprecated, for removal: This API element is subject to removal in a future version.in 3.4. provider is not used by this classCreate a new instance of the receiver using the supplied content provider and viewer.- Parameters:
- provider- The content provider that will be updated
- viewer- The tree viewer that the results are added to
 
- 
DeferredTreeContentManagerCreate a new instance of the receiver using the supplied content provider and viewer. Run any jobs using the site.- Parameters:
- viewer- content viewer
- site- part site
- Since:
- 3.4
 
- 
DeferredTreeContentManagerCreate a new instance of the receiver using the supplied content provider and viewer.- Parameters:
- viewer- The tree viewer that the results are added to
- Since:
- 3.4
 
 
- 
- 
Method Details- 
mayHaveChildrenProvides an optimized lookup for determining if an element has children. This is required because elements that are populated lazilly can't answergetChildrenjust 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 trueif there are potentially children.
- Throws:
- RuntimeException- if the element is null.
 
- 
getChildrenReturns 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 nullif parent is not an instance of IDeferredWorkbenchAdapter.
 
- 
createPendingUpdateAdapterFactory method for creating the pending update adapter representing the placeholder node. Subclasses may override.- Returns:
- a pending update adapter
- Since:
- 3.2
 
- 
getAdapterReturn the IDeferredWorkbenchAdapter for element or the element if it is an instance of IDeferredWorkbenchAdapter. If it does not exist return null.- Parameters:
- element- element to adapt
- Returns:
- IDeferredWorkbenchAdapter or null
 
- 
startFetchingDeferredChildrenprotected void startFetchingDeferredChildren(Object parent, IDeferredWorkbenchAdapter adapter, 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.- Parameters:
- parent- The parent object being filled in,
- adapter- The adapter being used to fetch the children.
- placeholder- The adapter that will be used to indicate that results are pending.
 
- 
getFetchJobNameReturns a name to use for the job that fetches children of the given parent. Subclasses may override. Default job name is parent's label.- Parameters:
- parent- parent that children are to be fetched for
- adapter- parent's deferred adapter
- Returns:
- job name
 
- 
addChildrenCreate a UIJob to add the children to the parent in the tree viewer.- Parameters:
- parent- the parent object being filled in
- children- the elements being added
- monitor- a progress monitor
 
- 
isDeferredAdapterReturn whether or not the element is or adapts to an IDeferredWorkbenchAdapter.- Parameters:
- element- the element to test
- Returns:
- boolean trueif the element is an IDeferredWorkbenchAdapter
 
- 
runClearPlaceholderJobRun 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.- Parameters:
- placeholder- placeholder to clear
 
- 
cancelCancel all jobs that are fetching content for the given parent or any of its children.- Parameters:
- parent- the root to cancel
 
- 
createElementCollectorCreate the element collector for the receiver.- Parameters:
- parent- The parent object being filled in,
- placeholder- The adapter that will be used to indicate that results are pending.
- Returns:
- IElementCollector
 
- 
addUpdateCompleteListenerAdd a listener to list of update complete listeners. These listeners are attached to the job that updates the viewer content (clears the pending entry, etc.) after all deferred content has been retrieved. This method has no effect if the listener has already been added to the list of listeners. Since 3.6, this listener is added to a list of listeners rather than replacing the previously added listener. For backward compatibility, adding a null listener will be interpreted as removal of a listener if only one listener has been registered.- Parameters:
- listener- the listener to add to the list of update listeners
- Since:
- 3.4
 
- 
removeUpdateCompleteListenerRemoves the listener from the list of update listeners that are attached to the job that updates the viewer content (clears the pending entry, etc.) after all deferred content has been retrieved. If the listener is already attached to a running job, it is not removed, but it will not be added to any subsequent jobs that are run. This method has no effect if the listener was not previously added to the listener list.- Parameters:
- listener- the listener to be removed
- Since:
- 3.6
 
 
-