Class FilteringTreeContentProvider

java.lang.Object
com._1c.g5.v8.dt.navigator.providers.FilteringTreeContentProvider
All Implemented Interfaces:
IContentProvider, IStructuredContentProvider, ITreeContentProvider
Direct Known Subclasses:
CommandFilteringTreeContentProvider, ContainmentTreeContentProvider, FormFilteringTreeContentProvider, RoleFilteringTreeContentProvider, SubsystemFilteringTreeContentProvider

public class FilteringTreeContentProvider extends Object implements ITreeContentProvider
The implementation of ITreeContentProvider. When you call methods getElements(Object) and getChildren(Object) to filter children it firstly tries to use ISubtreeInducer if possible, then uses TreeItemFilter's.

ISubtreeInducer is needed in order to at first move quickly from the source tree to its subtree and then apply TreeItemFilter's on its subtree.

  • Field Details

    • hasMatchingDescendants

      protected Set<Object> hasMatchingDescendants
      The tree nodes having matching descendants.
    • sourceProvider

      protected final ITreeContentProvider sourceProvider
      The source provider.
    • subtreeInducer

      protected final ISubtreeInducer subtreeInducer
    • treeItemFilters

      protected final TreeItemFilter[] treeItemFilters
  • Constructor Details

    • FilteringTreeContentProvider

      public FilteringTreeContentProvider(ITreeContentProvider sourceProvider, TreeItemFilter... treeItemFilters)
      Creates a new instance with the given parameters. Uses only TreeItemFilter's to filter the tree nodes.
      Parameters:
      sourceProvider - the source provider, can not be null
      treeItemFilters - the TreeItemFilter's to apply, can not be null
    • FilteringTreeContentProvider

      public FilteringTreeContentProvider(ITreeContentProvider sourceProvider, ISubtreeInducer subtreeInducer, TreeItemFilter... treeItemFilters)
      Creates a new instance with the given parameters. Uses TreeItemFilter's and ISubtreeInducer to filter the tree nodes.
      Parameters:
      sourceProvider - the source provider, can not be null
      subtreeInducer - the ISubtreeInducer to apply, may be null. If subtreeInducer is null then it uses only TreeItemFilter's to filter the tree nodes.
      treeItemFilters - the TreeItemFilter's to apply, can not be null
  • Method Details

    • dispose

      public void dispose()
      Specified by:
      dispose in interface IContentProvider
    • inputChanged

      public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
      Specified by:
      inputChanged in interface IContentProvider
    • getElements

      public Object[] getElements(Object inputElement)
      Specified by:
      getElements in interface IStructuredContentProvider
      Specified by:
      getElements in interface ITreeContentProvider
    • getChildren

      public Object[] getChildren(Object parentElement)
      Specified by:
      getChildren in interface ITreeContentProvider
    • getParent

      public Object getParent(Object element)
      Specified by:
      getParent in interface ITreeContentProvider
    • hasChildren

      public boolean hasChildren(Object element)
      Specified by:
      hasChildren in interface ITreeContentProvider
    • hasChildrenLightweight

      public boolean hasChildrenLightweight(Object element)
      Returns whether the given element has children, no heavy calculations and no calling getChildren(Object) method.
      Parameters:
      element - the given element, can not be null
      Returns:
      true if the given element has children, and false if it has no children
    • hasMatchingDescendants

      protected boolean hasMatchingDescendants(Object element)
      Determines if the given tree element has matching descendants in its subtree.
      Parameters:
      element - the given tree element, can not be null
      Returns:
      true if the given tree element has matching descendants in its subtree and false otherwise
    • hasAnyMatchingChildren

      protected boolean hasAnyMatchingChildren(Object element)
      Determines if the given tree element has any matching children in its subtree, that is at least one matching child.
      Parameters:
      element - the given tree element, can not be null
      Returns:
      true if the given tree element has any matching children in its subtree and false otherwise
    • filterChildrenBySubtreeInducer

      protected Object[] filterChildrenBySubtreeInducer(Object parent, Object[] children)
      Filters children of the given parent element by ISubtreeInducer. Keeps children that got into the set of vertices generated by ISubtreeInducer.
      Parameters:
      parent - the parent element, can not be null
      children - the children elements, can not be null
      Returns:
      the filtered children, can not be null
    • filterChildren

      protected Object[] filterChildren(Object[] children)
      Filters the given children.
      Parameters:
      children - the given children elements, can not be null
      Returns:
      the filtered children, can not be null
    • inSubgraph

      protected boolean inSubgraph(Object node)
      Determines if the given node belongs to the induced subgraph.
      Parameters:
      node - the given node from the source tree, can not be null
      Returns:
      true the given node belongs to the induced subgraph and false otherwise
    • isSubgraphInnerNode

      protected boolean isSubgraphInnerNode(Object element)
      Determines if the specified element is inner node in the induced subgraph.
      Parameters:
      element - the specified node from the origin tree, can not be null
      Returns:
      true if the specified node is inner node in the induced subgraph and false otherwise
    • hasOuterToSubtreeChildren

      protected boolean hasOuterToSubtreeChildren(Object node)
      Determines if the specified node may have children from the source tree that are not the induced subgraph nodes.
      Parameters:
      node - the specified node from the origin tree, can not be null
      Returns:
      true if the specified node may have children from the source tree that are not the induced subgraph nodes and false otherwise
    • dropCache

      protected void dropCache()
      Drops all collected cache.
    • keepChild

      protected boolean keepChild(Object child)
      Determines if to keep the given child or filter it out.
      Parameters:
      child - the given child, can not be null
      Returns:
      true to keep the given child, false to filter it out