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 java.lang.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

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `fetchDeferredChildren​(java.lang.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.
    `java.lang.Object[]` | `getChildren​(java.lang.Object parentElement)` |
    `java.lang.Object[]` | `getElements​(java.lang.Object inputElement)` |
    `protected java.lang.Object[]` | `getImmediateChildren​(java.lang.Object parentElement)` | Returns the child elements of the given parent element.
    `java.lang.Object` | `getParent​(java.lang.Object element)` |
    `protected org.eclipse.core.runtime.jobs.ISchedulingRule` | `getRule​(java.lang.Object parentElement)` | Returns the rule used to schedule the deferred fetching of children for the given parent element.
    `boolean` | `hasChildren​(java.lang.Object element)` |
    `protected boolean` | `shouldDefer​(java.lang.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 Detail

    - #### NO_CHILDREN

          protected static final java.lang.Object[] NO_CHILDREN

      A zero-length array of the runtime type `Object[]`.

  - ### Constructor Detail

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

    - #### getElements

          public java.lang.Object[] getElements​(java.lang.Object inputElement)

    - #### getChildren

          public java.lang.Object[] getChildren​(java.lang.Object parentElement)

    - #### getParent

          public java.lang.Object getParent​(java.lang.Object element)

    - #### hasChildren

          public boolean hasChildren​(java.lang.Object element)

    - #### shouldDefer

          protected boolean shouldDefer​(java.lang.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 java.lang.Object[] getImmediateChildren​(java.lang.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​(java.lang.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​(java.lang.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)`