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

      public abstract class DeferredTreeContentProvider
      extends java.lang.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 and Description
    `DeferredTreeContentProvider(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 Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract 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.
    `protected org.eclipse.ui.progress.DeferredTreeContentManager` | `getDeferredTreeContentManager()` Returns the `DeferredTreeContentManager` used by this content provider.
    `protected java.lang.String` | `getLabel(java.lang.Object element)` Returns the label text for the given 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.
    `void` | `inputChanged(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object oldInput, java.lang.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.ITreeContentProvider

      `getChildren, getElements, getParent, hasChildren`

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

      `dispose`

- - ### Constructor Detail

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

    - #### inputChanged

          public void inputChanged(org.eclipse.jface.viewers.Viewer viewer,
                                   java.lang.Object oldInput,
                                   java.lang.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(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. 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(java.lang.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 java.lang.String getLabel(java.lang.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`)

Copyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0