Package org.eclipse.handly.ui.callhierarchy

# Interface ICallHierarchyNode

All Superinterfaces:
  `org.eclipse.core.runtime.IAdaptable`

All Known Implementing Classes:
  `CallHierarchyNode`, `XtextCallHierarchyNode`

public interface ICallHierarchyNode extends org.eclipse.core.runtime.IAdaptable
Represents a call hierarchy node.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final org.eclipse.ui.model.IWorkbenchAdapter`
  `DEFAULT_WORKBENCH_ADAPTER`
  A default workbench adapter for call hierarchy nodes.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default <T> T`
  `getAdapter(Class<T> adapter)`
  `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.
  `Object`
  `getElement()`
  Returns the underlying model element of this node (e.g., an element representing a method declaration).
  `CallHierarchyKind`
  `getKind()`
  Returns the call hierarchy kind for this node.
  `ICallHierarchyNode`
  `getParent()`
  Returns the parent node of this node.
  `default boolean`
  `isRecursive()`
  Returns whether this node is recursive (i.e., whether there is an ancestor node containing the same element as this node).
  `default boolean`
  `mayHaveChildren()`
  Returns whether this node may have child nodes.
  `default void`
  `refresh()`
  Informs this node that it is about to be refreshed in a structured viewer.

- ## Field Details

  - ### DEFAULT_WORKBENCH_ADAPTER

    static final org.eclipse.ui.model.IWorkbenchAdapter DEFAULT_WORKBENCH_ADAPTER
    A default workbench adapter for call hierarchy nodes.

- ## Method Details

  - ### getAdapter

    default <T> T getAdapter(Class<T> adapter)

    Default implementation of this method in `ICallHierarchyNode` returns the underlying model `element` if it is an instance of the given class. Otherwise, if an `IWorkbenchAdapter` is requested, it returns the `DEFAULT_WORKBENCH_ADAPTER`. As a fallback, it delegates to the Platform's adapter manager.

    Specified by:
      `getAdapter` in interface `org.eclipse.core.runtime.IAdaptable`

  - ### getKind

    CallHierarchyKind getKind()
    Returns the call hierarchy kind for this node. The kind does not change over the lifetime of the node.
    Returns:
      the call hierarchy kind (never `null`)

  - ### getElement

    Object getElement()
    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.
    Returns:
      the underlying model element (never `null`)

  - ### getParent

    ICallHierarchyNode getParent()
    Returns the parent node of this node. The association does not change over the lifetime of the node.
    Returns:
      the parent node, or `null` if this is a root node

  - ### getCallLocations

    ICallLocation[] getCallLocations()
    Returns the call locations associated with this node.
    Returns:
      the call locations (never `null`, may be empty). Clients must not modify the returned array.

  - ### isRecursive

    default 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.

    Returns:
      `true` if the node is recursive, and `false` otherwise

  - ### mayHaveChildren

    default boolean mayHaveChildren()
    Returns whether this node may have child nodes.

    Default implementation returns `false` if this node is `recursive`.

    Returns:
      `true` if this node may have child nodes, and `false` otherwise

  - ### getChildren

    ICallHierarchyNode[] getChildren(org.eclipse.core.runtime.IProgressMonitor monitor)
    Returns the immediate child nodes of this node. Returns a zero-length array if `mayHaveChildren()` returns `false` for this node. The returned nodes must correspond to the call hierarchy `kind`.
    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.

  - ### refresh

    default void refresh()
    Informs this node that it is about to be refreshed in a structured viewer.

    Default implementation does nothing.

    See Also:
      - `StructuredViewer.refresh(Object)`