public class LightClassReferenceExpression extends LightClassReference implements PsiReferenceExpression
Iconable.IconFlags, Iconable.LastComputedIcon
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
myText |
myManager
FLAGS_LOCKED, ICON_PLACEHOLDER
ARRAY_FACTORY, EMPTY_ARRAY, EXPRESSION_TO_TYPE
ARRAY_FACTORY, EMPTY_ARRAY
ICON_FLAG_IGNORE_MASK, ICON_FLAG_OPEN, ICON_FLAG_READ_STATUS, ICON_FLAG_VISIBILITY
EMPTY_NAVIGATABLE_ELEMENT_ARRAY
EMPTY_NAVIGATION_ITEM_ARRAY
Constructor and Description |
---|
LightClassReferenceExpression(PsiManager manager,
java.lang.String text,
PsiClass refClass) |
Modifier and Type | Method and Description |
---|---|
void |
accept(PsiElementVisitor visitor)
Passes the element to the specified visitor.
|
PsiElement |
bindToElement(PsiElement element)
Changes the reference so that it starts to point to the specified element.
|
PsiElement |
bindToElementViaStaticImport(PsiClass aClass)
Creates an
import static statement importing the referenced member
from the specified class, or qualifies the reference with the class name if
that class is already imported by a regular import statement. |
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.
|
PsiReferenceParameterList |
getParameterList()
Returns the list of type arguments specified on the reference.
|
PsiElement |
getQualifier()
Returns the qualifier of the reference (the element representing the content up to the
last period).
|
PsiExpression |
getQualifierExpression()
Returns the expression used as the qualifier of the reference (the content up to the
last period).
|
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.
|
PsiReference |
getReference()
Returns the reference from this PSI element to another PSI element (or elements), if one exists.
|
PsiElement |
getReferenceNameElement()
Returns the element representing the name of the referenced element.
|
java.lang.String |
getText()
Returns the text of the PSI element.
|
PsiType |
getType()
Returns the type of the expression.
|
PsiType [] |
getTypeParameters()
Returns the array of types for the type arguments specified on the reference.
|
java.lang.Object [] |
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 |
isQualified()
Checks if the reference is qualified (consists of elements separated with periods).
|
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.
|
void |
setQualifierExpression(PsiExpression newQualifier) |
java.lang.String |
toString()
toString() should never be presented to the user.
|
advancedResolve, copy, getQualifiedName, getReferenceName, getResolveScope, isValid, resolve
add, addAfter, addBefore, checkAdd, checkDelete, delete, findElementAt, getChildren, getContainingFile, getLanguage, getManager, getNavigationElement, getNextSibling, getNode, getParent, getPrevSibling, getStartOffsetInParent, getTextLength, getTextOffset, getTextRange, isPhysical, isWritable, replace, setNavigationElement, textMatches, textMatches, textToCharArray
acceptChildren, addRange, addRangeAfter, addRangeBefore, canNavigate, canNavigateToSource, deleteChildRange, findChildByClass, findChildrenByClass, findNotNullChildByClass, findReferenceAt, getContext, getFirstChild, getLastChild, getName, getOriginalElement, getPresentation, getProject, getReferences, getUseScope, isEquivalentTo, navigate, notNullChild, processDeclarations, textContains
buildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getElementIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, isVisibilitySupported, overlayIcons, registerIconLayer, transformFlags
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getQualifiedName, getReferenceNameElement, getTypeParameters, isQualified
advancedResolve, multiResolve, processVariants
resolveReference
accept, acceptChildren, add, addAfter, addBefore, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, copy, delete, deleteChildRange, findElementAt, findReferenceAt, getChildren, getContainingFile, getContext, getCopyableUserData, getFirstChild, getLanguage, getLastChild, getManager, getNavigationElement, getNextSibling, getNode, getOriginalElement, getOwnReferences, getParent, getPrevSibling, getProject, getReference, getReferences, getResolveScope, getStartOffsetInParent, getText, getTextLength, getTextOffset, getTextRange, getTextRangeInParent, getUseScope, isEquivalentTo, isPhysical, isValid, isWritable, processDeclarations, putCopyableUserData, replace, textContains, textMatches, textMatches, textToCharArray, toString
getUserData, putUserData
getQualifier, getReferenceName
bindToElement, getCanonicalText, getElement, getRangeInElement, getVariants, handleElementRename, isSoft, resolve, resolvesTo
getAbsoluteRange
public LightClassReferenceExpression(PsiManager manager, java.lang.String text, PsiClass refClass)
public PsiExpression getQualifierExpression()
PsiReferenceExpression
getQualifierExpression
in interface PsiReferenceExpression
public PsiElement bindToElementViaStaticImport(PsiClass aClass) throws IncorrectOperationException
PsiReferenceExpression
import static
statement importing the referenced member
from the specified class, or qualifies the reference with the class name if
that class is already imported by a regular import statement.bindToElementViaStaticImport
in interface PsiReferenceExpression
aClass
- the class to import.IncorrectOperationException
- if the modification failed for some reason.public void setQualifierExpression(PsiExpression newQualifier) throws IncorrectOperationException
setQualifierExpression
in interface PsiReferenceExpression
IncorrectOperationException
public PsiType getType()
PsiExpression
getType
in interface PsiExpression
public boolean isReferenceTo(PsiElement element)
PsiReference
isReferenceTo
in interface PsiReference
element
- the element to check target for.true
if the reference targets that element, false
otherwise.public PsiReferenceParameterList getParameterList()
PsiJavaCodeReferenceElement
getParameterList
in interface PsiJavaCodeReferenceElement
public JavaResolveResult [] multiResolve(boolean incompleteCode)
PsiPolyVariantReference
multiResolve
in interface PsiJavaReference
multiResolve
in interface PsiPolyVariantReference
incompleteCode
- 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 void processVariants(PsiScopeProcessor processor)
PsiJavaReference
processVariants
in interface PsiJavaReference
processor
- the processor accepting the variantspublic PsiElement getReferenceNameElement()
PsiJavaCodeReferenceElement
getReferenceNameElement
in interface PsiJavaCodeReferenceElement
public java.lang.String getText()
PsiElement
getText
in interface PsiElement
getText
in class LightElement
PsiElement.textMatches(java.lang.CharSequence)
,
PsiElement.textContains(char)
public PsiReference getReference()
PsiElement
PsiElement.getReferences()
for an example), returns the first associated reference.getReference
in interface PsiElement
getReference
in class PsiElementBase
ReferencesSearch
public java.lang.String getCanonicalText()
PsiReference
getCanonicalText
in interface PsiReference
public PsiElement handleElementRename(java.lang.String newElementName) throws IncorrectOperationException
PsiReference
handleElementRename
in interface PsiReference
newElementName
- the new name of the target element.IncorrectOperationException
- if the rename cannot be handled for some reason.public PsiElement bindToElement(PsiElement element) throws IncorrectOperationException
PsiReference
bindToElement
in interface PsiReference
element
- the element which should become the target of the reference.IncorrectOperationException
- if the rebind cannot be handled for some reason.public void accept(PsiElementVisitor visitor)
PsiElement
accept
in interface PsiElement
accept
in class LightElement
visitor
- the visitor to pass the element to.public java.lang.String toString()
PsiElement
toString
in interface PsiElement
toString
in class LightElement
public java.lang.Object [] getVariants()
PsiReference
PsiElement
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 PsiReference
public boolean isSoft()
PsiReference
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. For example, a text in an XML file which looks
like a full-qualified Java class name is a soft reference.isSoft
in interface PsiReference
true
if the reference is soft, false
otherwise.public TextRange getRangeInElement()
PsiReference
PsiElement text: qualified.LongName PsiReferences: [Ref1---]X[Ref2--]where
Ref1
would resolve to a "namespace" and Ref2
to an "element".getRangeInElement
in interface PsiSymbolReference
getRangeInElement
in interface PsiReference
public PsiElement getElement()
PsiReference
getElement
in interface PsiSymbolReference
getElement
in interface PsiReference
public PsiType [] getTypeParameters()
PsiJavaCodeReferenceElement
getTypeParameters
in interface PsiJavaCodeReferenceElement
public PsiElement getQualifier()
PsiQualifiedReference
getQualifier
in interface PsiQualifiedReference
public boolean isQualified()
PsiJavaCodeReferenceElement
isQualified
in interface PsiJavaCodeReferenceElement