Package org.eclipse.jdt.core.search
Class DerivedSourceSearchParticipant
java.lang.Object
org.eclipse.jdt.core.search.SearchParticipant
org.eclipse.jdt.core.search.DerivedSourceSearchParticipant
A search participant for non-Java source files registered under the
org.eclipse.jdt.core.javaDerivedSource content type (e.g. Kotlin,
Scala).
Subclasses must implement locateCallees(IMember, SearchDocument, IProgressMonitor) to enable outgoing call hierarchy for their language.
This class is intended to be subclassed by clients contributing to the
org.eclipse.jdt.core.derivedSourceSearchParticipant extension point.
- Since:
- 3.46
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCompilationUnit(org.eclipse.core.resources.IFile file) Returns an ICompilationUnit for the given source file, or null if this participant does not provide structured models.abstract SearchMatch[]locateCallees(IMember caller, SearchDocument document, org.eclipse.core.runtime.IProgressMonitor monitor) Locates methods and types invoked by the given member.Methods inherited from class org.eclipse.jdt.core.search.SearchParticipant
beginSearching, doneSearching, getDescription, getDocument, indexDocument, indexResolvedDocument, locateMatches, removeIndex, resolveDocument, scheduleDocumentIndexing, selectIndexes
-
Constructor Details
-
DerivedSourceSearchParticipant
public DerivedSourceSearchParticipant()
-
-
Method Details
-
locateCallees
public abstract SearchMatch[] locateCallees(IMember caller, SearchDocument document, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Locates methods and types invoked by the given member. Called by the call hierarchy engine when Java AST-based callee analysis is not available (i.e., the member's source is not Java).Each returned
SearchMatchrepresents a call site within the member's body:SearchMatch.getElement()— anIMemberrepresenting the callee. At minimum,getElementName()andgetElementType()must return meaningful values. The call hierarchy engine will attempt to resolve this to a full declaration via declaration search.SearchMatch.getOffset()/SearchMatch.getLength()— the call site location in the caller's source.SearchMatch.getResource()— the caller's resource.
- Parameters:
caller- the member whose callees are requesteddocument- the search document for the caller's source filemonitor- progress monitor, ornull- Returns:
- array of search matches representing call sites (never null)
- Throws:
org.eclipse.core.runtime.CoreException- if an error occurs during callee analysis- Since:
- 3.46
-
getCompilationUnit
Returns an ICompilationUnit for the given source file, or null if this participant does not provide structured models. Called by language servers to resolve non-Java source files to type roots for features like document symbols, hover, go-to-definition, and code lenses.The default implementation returns null. Subclasses that provide structured models for their language should override this to return a compilation unit populated with type/method/field children.
- Parameters:
file- the workspace file- Returns:
- compilation unit, or null
- Since:
- 3.46
-