Package org.eclipse.handly.ui.viewer

# Class DeferredTreeContentProvider

java.lang.Object
org.eclipse.handly.ui.viewer.DeferredTreeContentProvider

All Implemented Interfaces:
  `org.eclipse.jface.viewers.IContentProvider`, `org.eclipse.jface.viewers.IStructuredContentProvider`, `org.eclipse.jface.viewers.ITreeContentProvider`

Direct Known Subclasses:
  `CallHierarchyContentProvider`, `DeferredElementTreeContentProvider`

public abstract class DeferredTreeContentProvider extends Object implements org.eclipse.jface.viewers.ITreeContentProvider
An abstract base class for a tree content provider that supports asynchronous fetching of children.

See Also:
  - `DeferredTreeContentManager`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DeferredTreeContentProvider(org.eclipse.jface.viewers.AbstractTreeViewer viewer, org.eclipse.ui.IWorkbenchPartSite site)`
  Creates a new instance of the content provider.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract void`
  `fetchDeferredChildren(Object parentElement, org.eclipse.ui.progress.IElementCollector collector, org.eclipse.core.runtime.IProgressMonitor monitor)`
  Called by a job to fetch the child elements of the given parent element.
  `protected final org.eclipse.ui.progress.DeferredTreeContentManager`
  `getDeferredTreeContentManager()`
  Returns the `DeferredTreeContentManager` used by this content provider.
  `protected String`
  `getLabel(Object element)`
  Returns the label text for the given element.
  `protected org.eclipse.core.runtime.jobs.ISchedulingRule`
  `getRule(Object parentElement)`
  Returns the rule used to schedule the deferred fetching of children for the given parent element.
  `void`
  `inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.eclipse.jface.viewers.IContentProvider

  `dispose`

  ### Methods inherited from interface org.eclipse.jface.viewers.ITreeContentProvider

  `getChildren, getElements, getParent, hasChildren`

- ## Constructor Details

  - ### DeferredTreeContentProvider

    public DeferredTreeContentProvider(org.eclipse.jface.viewers.AbstractTreeViewer viewer, org.eclipse.ui.IWorkbenchPartSite site)
    Creates a new instance of the content provider.
    Parameters:
      `viewer` - the tree viewer that will use this content provider (not `null`)
      `site` - the site of the containing workbench part (may be `null`)

- ## Method Details

  - ### inputChanged

    public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput)

    The `DeferredTreeContentProvider` implementation of this method cancels all jobs that are fetching content for the given old input.

    Specified by:
      `inputChanged` in interface `org.eclipse.jface.viewers.IContentProvider`

  - ### getDeferredTreeContentManager

    protected final org.eclipse.ui.progress.DeferredTreeContentManager getDeferredTreeContentManager()
    Returns the `DeferredTreeContentManager` used by this content provider.
    Returns:
      a `DeferredTreeContentManager` (never `null`)

  - ### fetchDeferredChildren

    protected abstract void fetchDeferredChildren(Object parentElement, org.eclipse.ui.progress.IElementCollector collector, org.eclipse.core.runtime.IProgressMonitor monitor)
    Called by a job to fetch the child elements of the given parent element. This method should report the fetched elements via the given collector.
    Parameters:
      `parentElement` - the parent element
      `collector` - the element collector (never `null`)
      `monitor` - a progress monitor to support reporting and cancellation (never `null`)

  - ### getRule

    protected org.eclipse.core.runtime.jobs.ISchedulingRule getRule(Object parentElement)
    Returns the rule used to schedule the deferred fetching of children for the given parent element.

    Default implementation returns `new SerialPerObjectRule(this)`.

    Parameters:
      `parentElement` - the parent element
    Returns:
      the scheduling rule. May be `null`
    See Also:
      - `Job.setRule(ISchedulingRule)`

  - ### getLabel

    protected String getLabel(Object element)
    Returns the label text for the given element. Returns an empty string if there is no appropriate label text for the element.

    Default implementation uses the tree viewer's label provider to obtain the element's label.

    Parameters:
      `element` - the element to obtain a label for
    Returns:
      the element's label (never `null`)