org.eclipse.handly.ui.callhierarchy

## Class CallHierarchyNode

- java.lang.Object
- - org.eclipse.handly.ui.callhierarchy.CallHierarchyNode

- All Implemented Interfaces:
    org.eclipse.core.runtime.IAdaptable, ICallHierarchyNode
  Direct Known Subclasses:
    XtextCallHierarchyNode

      public abstract class CallHierarchyNode
      extends java.lang.Object
      implements ICallHierarchyNode

  An abstract base implementation for `ICallHierarchyNode`.

- - ### Field Summary

    - ### Fields inherited from interface org.eclipse.handly.ui.callhierarchy.ICallHierarchyNode

      `DEFAULT_WORKBENCH_ADAPTER`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `CallHierarchyNode(ICallHierarchyNode parent, java.lang.Object element)` Creates a new call hierarchy node.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCallLocation(ICallLocation callLocation)` Appends the given call location to the end of the list of call locations of this node.
    `protected abstract ICallHierarchyNode[]` | `computeChildren(org.eclipse.core.runtime.IProgressMonitor monitor)` Computes and returns the immediate child nodes for this node.
    `ICallLocation[]` | `getCallLocations()` Returns the call locations associated with this node.
    `ICallHierarchyNode[]` | `getChildren(org.eclipse.core.runtime.IProgressMonitor monitor)` Returns the immediate child nodes of this node.
    `java.lang.Object` | `getElement()` Returns the underlying model element of this node (e.g., an element representing a method declaration).
    `ICallHierarchyNode` | `getParent()` Returns the parent node of this node.
    `boolean` | `isRecursive()` Returns whether this node is recursive (i.e., whether there is an ancestor node containing the same element as this node).

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

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

    - ### Methods inherited from interface org.eclipse.handly.ui.callhierarchy.ICallHierarchyNode

      `getAdapter, getKind, mayHaveChildren, refresh`

- - ### Constructor Detail

    - #### CallHierarchyNode

          protected CallHierarchyNode(ICallHierarchyNode parent,
                                      java.lang.Object element)

      Creates a new call hierarchy node.
      Parameters:
        `parent` - the parent node, or `null` if this is a root node
        `element` - the underlying model element (not `null`)

  - ### Method Detail

    - #### getElement

          public final java.lang.Object getElement()

      Description copied from interface: `ICallHierarchyNode`
      Returns the underlying model element of this node (e.g., an element representing a method declaration). The association does not change over the lifetime of the node.
      Specified by:
        `getElement` in interface `ICallHierarchyNode`
      Returns:
        the underlying model element (never `null`)

    - #### getParent

          public final ICallHierarchyNode getParent()

      Description copied from interface: `ICallHierarchyNode`
      Returns the parent node of this node. The association does not change over the lifetime of the node.
      Specified by:
        `getParent` in interface `ICallHierarchyNode`
      Returns:
        the parent node, or `null` if this is a root node

    - #### getCallLocations

          public final ICallLocation[] getCallLocations()

      Description copied from interface: `ICallHierarchyNode`
      Returns the call locations associated with this node.
      Specified by:
        `getCallLocations` in interface `ICallHierarchyNode`
      Returns:
        the call locations (never `null`, may be empty). Clients must not modify the returned array.
      See Also:
        `addCallLocation(ICallLocation)`

    - #### addCallLocation

          public void addCallLocation(ICallLocation callLocation)

      Appends the given call location to the end of the list of call locations of this node.

      This implementation imposes no restrictions on the call location, except that it must not be `null`.

      Parameters:
        `callLocation` - not `null`

    - #### isRecursive

          public final boolean isRecursive()

      Returns whether this node is recursive (i.e., whether there is an ancestor node containing the same element as this node).

      Default implementation traverses the parent chain from this node up through the root node until a node containing the same element as this node is found, in which case it returns `true`. If no such node can be found, `false` is returned.

      This implementation returns the value determined and cached at the construction time.

      Specified by:
        `isRecursive` in interface `ICallHierarchyNode`
      Returns:
        `true` if the node is recursive, and `false` otherwise

    - #### getChildren

          public final ICallHierarchyNode[] getChildren(org.eclipse.core.runtime.IProgressMonitor monitor)

      Returns the immediate child nodes of this node. Returns a zero-length array if `ICallHierarchyNode.mayHaveChildren()` returns `false` for this node. The returned nodes must correspond to the call hierarchy `kind`.

      This implementation delegates to `computeChildren(IProgressMonitor)` if this node may have children. Otherwise, a zero-length array is returned.

      Specified by:
        `getChildren` in interface `ICallHierarchyNode`
      Parameters:
        `monitor` - a progress monitor, or `null` if progress reporting is not desired. The caller must not rely on `IProgressMonitor.done()` having been called by the receiver
      Returns:
        the immediate child nodes of this node (never `null`, may be empty). Clients must not modify the returned array.

    - #### computeChildren

          protected abstract ICallHierarchyNode[] computeChildren(org.eclipse.core.runtime.IProgressMonitor monitor)

      Computes and returns the immediate child nodes for this node.
      Parameters:
        `monitor` - a progress monitor, or `null` if progress reporting is not desired. The caller must not rely on `IProgressMonitor.done()` having been called by the receiver
      Returns:
        the immediate child nodes of this node (never `null`, may be empty). Clients must not modify the returned array.
      See Also:
        `getChildren(IProgressMonitor)`

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