Package org.eclipse.handly.xtext.ui.callhierarchy

## Class XtextCallHierarchyNode

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

- All Implemented Interfaces:
    `org.eclipse.core.runtime.IAdaptable`, `ICallHierarchyNode`

      public abstract class XtextCallHierarchyNode
      extends CallHierarchyNode

  A partial implementation for `ICallHierarchyNode` based on Xtext.

- - ### Field Summary

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

      `DEFAULT_WORKBENCH_ADAPTER`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `XtextCallHierarchyNode​(XtextCallHierarchyNode parent, java.lang.Object element)` | Creates a new Xtext call hierarchy node.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected ICallHierarchyNode[]` | `computeChildren​(org.eclipse.core.runtime.IProgressMonitor monitor)` | Computes and returns the immediate child nodes for this node.
    `protected ICallLocation` | `createCallLocation​(java.lang.Object caller, java.lang.Object callee, org.eclipse.xtext.resource.IReferenceDescription callReference)` | Creates and returns a call location based on the given call reference.
    `protected abstract XtextCallHierarchyNode` | `createChildIfAbsent​(java.util.Map<org.eclipse.emf.common.util.URI,​XtextCallHierarchyNode> children, org.eclipse.xtext.resource.IReferenceDescription callReference)` | Returns a child node for the given call reference, creating it if necessary.
    `protected void` | `findCallReferences​(java.util.function.Consumer<org.eclipse.xtext.resource.IReferenceDescription> acceptor, org.eclipse.core.runtime.IProgressMonitor monitor)` | Finds the call references for this node.
    `protected abstract XtextCallHierarchyUtility` | `getCallHierarchyUtility()` | Returns the call hierarchy utility used by this node.
    `protected abstract org.eclipse.emf.common.util.URI` | `getUri()` | Returns the corresponding URI for this node.

    - ### Methods inherited from class org.eclipse.handly.ui.callhierarchy.CallHierarchyNode

      `addCallLocation, getCallLocations, getChildren, getElement, getParent, isRecursive`

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

    - #### XtextCallHierarchyNode

          protected XtextCallHierarchyNode​(XtextCallHierarchyNode parent,
                                           java.lang.Object element)

      Creates a new Xtext 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

    - #### computeChildren

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

      Computes and returns the immediate child nodes for this node.

      This implementation computes the child nodes based on the call references reported by `findCallReferences`. To obtain a child node, it calls `createChildIfAbsent(Map, IReferenceDescription)`. To create a call location, it invokes `createCallLocation(Object, Object, IReferenceDescription)`.

      Specified by:
        `computeChildren` in class `CallHierarchyNode`
      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:
        `CallHierarchyNode.getChildren(IProgressMonitor)`

    - #### findCallReferences

          protected void findCallReferences​(java.util.function.Consumer<org.eclipse.xtext.resource.IReferenceDescription> acceptor,
                                            org.eclipse.core.runtime.IProgressMonitor monitor)

      Finds the call references for this node.

      This implementation uses the `call hierarchy utility` to find the call references. Depending on the `kind` of this node, it will find either `caller references` or `callee references`.

      Parameters:
        `acceptor` - accepts the matches (never `null`)
        `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

    - #### createCallLocation

          protected ICallLocation createCallLocation​(java.lang.Object caller,
                                                     java.lang.Object callee,
                                                     org.eclipse.xtext.resource.IReferenceDescription callReference)

      Creates and returns a call location based on the given call reference.

      This implementation returns a new instance of `CallLocation`. It uses the `call hierarchy utility` to obtain the `call text info`.

      Parameters:
        `caller` - the caller element, or `null` if unknown
        `callee` - the callee element, or `null` if unknown
        `callReference` - never `null`
      Returns:
        the created call location (not `null`)

    - #### getUri

          protected abstract org.eclipse.emf.common.util.URI getUri()

      Returns the corresponding URI for this node.
      Returns:
        the corresponding URI (not `null`)

    - #### createChildIfAbsent

          protected abstract XtextCallHierarchyNode createChildIfAbsent​(java.util.Map<org.eclipse.emf.common.util.URI,​XtextCallHierarchyNode> children,
                                                                        org.eclipse.xtext.resource.IReferenceDescription callReference)

      Returns a child node for the given call reference, creating it if necessary. If the given map does not already contain a mapping for the requested node, this method will attempt to create it and enter it into the map. Note that this method must not add call locations to the child node; they are added separately.
      Parameters:
        `children` - never `null`
        `callReference` - never `null`
      Returns:
        the corresponding (existing or created) child node, or `null` if no child node can be created for the given call reference

    - #### getCallHierarchyUtility

          protected abstract XtextCallHierarchyUtility getCallHierarchyUtility()

      Returns the call hierarchy utility used by this node.
      Returns:
        the call hierarchy utility (not `null`)