Package org.eclipse.handly.ui.viewer

# Class DeferredElementTreeContentProvider

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

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

public class DeferredElementTreeContentProvider extends DeferredTreeContentProvider
A deferred content provider for `IElement`s. Uses the existing structure of the elements.

Since:
  1.5

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final Object[]`
  `NO_CHILDREN`
  A zero-length array of the runtime type `Object[]`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DeferredElementTreeContentProvider(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 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.
  `Object[]`
  `getChildren(Object parentElement)`
  `Object[]`
  `getElements(Object inputElement)`
  `protected Object[]`
  `getImmediateChildren(Object parentElement)`
  Returns the child elements of the given parent element.
  `Object`
  `getParent(Object 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.
  `boolean`
  `hasChildren(Object element)`
  `protected boolean`
  `shouldDefer(Object element)`
  Returns whether the given element should be processed via deferred tree content manager.

  ### Methods inherited from class org.eclipse.handly.ui.viewer.DeferredTreeContentProvider

  `getDeferredTreeContentManager, getLabel, inputChanged`

  ### 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`

- ## Field Details

  - ### NO_CHILDREN

    protected static final Object[] NO_CHILDREN
    A zero-length array of the runtime type `Object[]`.

- ## Constructor Details

  - ### DeferredElementTreeContentProvider

    public DeferredElementTreeContentProvider(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

  - ### getElements

    public Object[] getElements(Object inputElement)

  - ### getChildren

    public Object[] getChildren(Object parentElement)

  - ### getParent

    public Object getParent(Object element)

  - ### hasChildren

    public boolean hasChildren(Object element)

  - ### shouldDefer

    protected boolean shouldDefer(Object element)
    Returns whether the given element should be processed via deferred tree content manager.
    Parameters:
      `element` - an element
    Returns:
      `true` if the given element should be processed via deferred tree content manager, and `false` otherwise

  - ### getImmediateChildren

    protected Object[] getImmediateChildren(Object parentElement)
    Returns the child elements of the given parent element.

    Default implementation invokes `Elements.getChildren((IElement)parentElement)` if the parent element is an IElement. Subclasses may override or extend.

    Parameters:
      `parentElement` - the parent element
    Returns:
      an array of child elements (not `null`)

  - ### fetchDeferredChildren

    protected void fetchDeferredChildren(Object parentElement, org.eclipse.ui.progress.IElementCollector collector, org.eclipse.core.runtime.IProgressMonitor monitor)
    Description copied from class: `DeferredTreeContentProvider`
    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.
    Specified by:
      `fetchDeferredChildren` in class `DeferredTreeContentProvider`
    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.

    `DeferredElementTreeContentProvider`'s implementation of this method always returns `null`.

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