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 forICallHierarchyNode
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, ornull
if this is a root nodeelement
- the underlying model element (notnull
)
-
-
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 callscreateChildIfAbsent(Map, IReferenceDescription)
. To create a call location, it invokescreateCallLocation(Object, Object, IReferenceDescription)
.- Specified by:
computeChildren
in classCallHierarchyNode
- Parameters:
monitor
- a progress monitor, ornull
if progress reporting is not desired. The caller must not rely onIProgressMonitor.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 thekind
of this node, it will find eithercaller references
orcallee references
.- Parameters:
acceptor
- accepts the matches (nevernull
)monitor
- a progress monitor, ornull
if progress reporting is not desired. The caller must not rely onIProgressMonitor.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 thecall hierarchy utility
to obtain thecall text info
.- Parameters:
caller
- the caller element, ornull
if unknowncallee
- the callee element, ornull
if unknowncallReference
- nevernull
- 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
- nevernull
callReference
- nevernull
- 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
)
-
-