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
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
ConstructorsModifierConstructorDescriptionprotectedXtextCallHierarchyNode(XtextCallHierarchyNode parent, Object element) Creates a new Xtext call hierarchy node. -
Method Summary
Modifier and TypeMethodDescriptionprotected ICallHierarchyNode[]computeChildren(org.eclipse.core.runtime.IProgressMonitor monitor) Computes and returns the immediate child nodes for this node.protected ICallLocationcreateCallLocation(Object caller, Object callee, org.eclipse.xtext.resource.IReferenceDescription callReference) Creates and returns a call location based on the given call reference.protected abstract XtextCallHierarchyNodecreateChildIfAbsent(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 voidfindCallReferences(Consumer<org.eclipse.xtext.resource.IReferenceDescription> acceptor, org.eclipse.core.runtime.IProgressMonitor monitor) Finds the call references for this node.protected abstract XtextCallHierarchyUtilityReturns the call hierarchy utility used by this node.protected abstract org.eclipse.emf.common.util.URIgetUri()Returns the corresponding URI for this node.Methods inherited from class org.eclipse.handly.ui.callhierarchy.CallHierarchyNode
addCallLocation, getCallLocations, getChildren, getElement, getParent, isRecursiveMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.handly.ui.callhierarchy.ICallHierarchyNode
getAdapter, getKind, mayHaveChildren, refresh
-
Constructor Details
-
XtextCallHierarchyNode
Creates a new Xtext call hierarchy node.- Parameters:
parent- the parent node, ornullif this is a root nodeelement- the underlying model element (notnull)
-
-
Method Details
-
computeChildren
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:
computeChildrenin classCallHierarchyNode- Parameters:
monitor- a progress monitor, ornullif 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:
-
findCallReferences
protected void findCallReferences(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 utilityto find the call references. Depending on thekindof this node, it will find eithercaller referencesorcallee references.- Parameters:
acceptor- accepts the matches (nevernull)monitor- a progress monitor, ornullif progress reporting is not desired. The caller must not rely onIProgressMonitor.done()having been called by the receiver
-
createCallLocation
protected ICallLocation createCallLocation(Object caller, 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 utilityto obtain thecall text info.- Parameters:
caller- the caller element, ornullif unknowncallee- the callee element, ornullif 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(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- nevernullcallReference- nevernull- Returns:
- the corresponding (existing or created) child node, or
nullif no child node can be created for the given call reference
-
getCallHierarchyUtility
Returns the call hierarchy utility used by this node.- Returns:
- the call hierarchy utility (not
null)
-