public class PsiDocMethodOrFieldRef.MyReference extends java.lang.Object implements PsiJavaReference
ARRAY_FACTORY, EMPTY_ARRAY| Constructor and Description |
|---|
MyReference(PsiElement[] referredElements) |
| Modifier and Type | Method and Description |
|---|---|
JavaResolveResult |
advancedResolve(boolean incompleteCode)
Resolves the reference and returns the result as a
JavaResolveResult
instead of a plain PsiElement. |
PsiElement |
bindToElement(PsiElement element)
Changes the reference so that it starts to point to the specified element.
|
PsiElement |
bindToText(PsiClass containingClass,
java.lang.StringBuffer newText) |
java.lang.String |
getCanonicalText()
Returns the name of the reference target element which does not depend on import statements
and other context (for example, the full-qualified name of the class if the reference targets
a Java class).
|
PsiElement |
getElement()
Returns the underlying (referencing) element of the reference.
|
TextRange |
getRangeInElement()
Returns the part of the underlying element which serves as a reference, or the complete
text range of the element if the entire element is a reference.
|
PsiElement [] |
getVariants()
Returns the array of String,
PsiElement and/or LookupElement
instances representing all identifiers that are visible at the location of the reference. |
PsiElement |
handleElementRename(java.lang.String newElementName)
Called when the reference target element has been renamed, in order to change the reference
text according to the new name.
|
boolean |
isReferenceTo(PsiElement element)
Checks if the reference targets the specified element.
|
boolean |
isSoft()
Returns
false if the underlying element is guaranteed to be a reference, or true
if the underlying element is a possible reference which should not be reported as
an error if it fails to resolve. |
JavaResolveResult [] |
multiResolve(boolean incompleteCode)
Returns the results of resolving the reference.
|
void |
processVariants(PsiScopeProcessor processor)
Passes all variants to which the reference may resolve to the specified
processor.
|
PsiElement |
resolve()
Returns the element which is the target of the reference.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitresolveReferenceresolvesTogetAbsoluteRangepublic MyReference(PsiElement[] referredElements)
public PsiElement resolve()
PsiReferenceresolve in interface PsiReferencenull if it was not possible to resolve the reference to a valid target.PsiPolyVariantReference.multiResolve(boolean)public void processVariants(PsiScopeProcessor processor)
PsiJavaReferenceprocessVariants in interface PsiJavaReferenceprocessor - the processor accepting the variantspublic JavaResolveResult advancedResolve(boolean incompleteCode)
PsiJavaReferenceJavaResolveResult
instead of a plain PsiElement.advancedResolve in interface PsiJavaReferenceincompleteCode - if true, the code in the context of which the reference is
being resolved is considered incomplete, and the method may return an invalid
result.public JavaResolveResult [] multiResolve(boolean incompleteCode)
PsiPolyVariantReferencemultiResolve in interface PsiJavaReferencemultiResolve in interface PsiPolyVariantReferenceincompleteCode - if true, the code in the context of which the reference is
being resolved is considered incomplete, and the method may return additional
invalid results.public PsiElement [] getVariants()
PsiReferencePsiElement and/or LookupElement
instances representing all identifiers that are visible at the location of the reference. The contents
of the returned array is used to build the lookup list for basic code completion. (The list
of visible identifiers may not be filtered by the completion prefix string - the
filtering is performed later by the IDE.)
This method is default since 2018.3.
getVariants in interface PsiReferencepublic boolean isSoft()
PsiReferencefalse if the underlying element is guaranteed to be a reference, or true
if the underlying element is a possible reference which should not be reported as
an error if it fails to resolve. For example, a text in an XML file which looks
like a full-qualified Java class name is a soft reference.isSoft in interface PsiReferencetrue if the reference is soft, false otherwise.public java.lang.String getCanonicalText()
PsiReferencegetCanonicalText in interface PsiReferencepublic PsiElement handleElementRename(java.lang.String newElementName) throws IncorrectOperationException
PsiReferencehandleElementRename in interface PsiReferencenewElementName - the new name of the target element.IncorrectOperationException - if the rename cannot be handled for some reason.public PsiElement bindToElement(PsiElement element) throws IncorrectOperationException
PsiReferencebindToElement in interface PsiReferenceelement - the element which should become the target of the reference.IncorrectOperationException - if the rebind cannot be handled for some reason.public PsiElement bindToText(PsiClass containingClass, java.lang.StringBuffer newText)
public boolean isReferenceTo(PsiElement element)
PsiReferenceisReferenceTo in interface PsiReferenceelement - the element to check target for.true if the reference targets that element, false otherwise.public TextRange getRangeInElement()
PsiReferencePsiElement text: qualified.LongName PsiReferences: [Ref1---]X[Ref2--]where
Ref1 would resolve to a "namespace" and Ref2 to an "element".getRangeInElement in interface PsiSymbolReferencegetRangeInElement in interface PsiReferencepublic PsiElement getElement()
PsiReferencegetElement in interface PsiSymbolReferencegetElement in interface PsiReference