public abstract class AbstractQualifiedReference<T extends AbstractQualifiedReference<T>> extends ASTWrapperPsiElement implements PsiPolyVariantReference, PsiQualifiedReferenceElement
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractQualifiedReference.AbstractQualifiedReferenceResolvingProcessor |
Iconable.IconFlags, Iconable.LastComputedIcon
FLAGS_LOCKED, ICON_PLACEHOLDER
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
Modifier | Constructor and Description |
---|---|
protected |
AbstractQualifiedReference(ASTNode node) |
Modifier and Type | Method and Description |
---|---|
PsiElement |
bindToElement(PsiElement element)
Changes the reference so that it starts to point to the specified element.
|
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.
|
T |
getQualifier()
Returns the qualifier of the reference (the element representing 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.
|
java.lang.String |
getReferenceName()
Returns the text of the reference not including its qualifier.
|
protected abstract PsiElement |
getReferenceNameElement() |
protected abstract PsiElement |
getSeparator() |
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.
|
protected boolean |
isAccessible(PsiElement element) |
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. |
ResolveResult [] |
multiResolve(boolean incompleteCode)
Returns the results of resolving the reference.
|
protected abstract T |
parseReference(java.lang.String newText) |
protected boolean |
processUnqualifiedVariants(PsiScopeProcessor processor) |
protected boolean |
processVariantsInner(PsiScopeProcessor processor) |
protected AbstractQualifiedReference |
replaceReference(java.lang.String newText) |
PsiElement |
resolve()
Returns the element which is the target of the reference.
|
protected abstract ResolveResult [] |
resolveInner() |
protected AbstractQualifiedReference |
shortenReferences() |
getNode, getParent, toString
add, addAfter, addBefore, addInternal, addRange, addRangeAfter, addRangeBefore, checkAdd, checkDelete, copy, delete, deleteChildInternal, deleteChildRange, findChildByFilter, findChildByType, findChildByType, findChildrenByType, findChildrenByType, findChildrenByType, findChildrenByType, findElementAt, findLastChildByType, findNotNullChildByType, findNotNullChildByType, getChildren, getContainingFile, getCopyableUserData, getFirstChild, getLanguage, getLastChild, getManager, getNextSibling, getPrevSibling, getStartOffsetInParent, getText, getTextLength, getTextOffset, getTextRange, putCopyableUserData, replace, replaceChildInternal, subtreeChanged, textContains, textMatches, textToCharArray
accept, acceptChildren, canNavigate, canNavigateToSource, findChildByClass, findChildrenByClass, findNotNullChildByClass, findReferenceAt, getContext, getName, getNavigationElement, getOriginalElement, getPresentation, getProject, getReferences, getResolveScope, getUseScope, isEquivalentTo, isPhysical, isValid, isWritable, navigate, notNullChild, processDeclarations, textMatches
buildRowIcon, computeBaseIcon, createLayeredIcon, getAdjustedBaseIcon, getBaseIcon, getElementIcon, getIcon, iconWithVisibilityIfNeeded, isNativeFileType, isVisibilitySupported, overlayIcons, registerIconLayer, transformFlags
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putUserData, putUserDataIfAbsent, replace, setUserMap
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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, getReferences, getResolveScope, getStartOffsetInParent, getText, getTextLength, getTextOffset, getTextRange, getTextRangeInParent, getUseScope, isEquivalentTo, isPhysical, isValid, isWritable, processDeclarations, putCopyableUserData, replace, textContains, textMatches, textMatches, textToCharArray, toString
getUserData, putUserData
getVariants, resolvesTo
getAbsoluteRange
protected AbstractQualifiedReference(ASTNode node)
public final PsiReference getReference()
PsiElement
PsiElement.getReferences()
for an example), returns the first associated reference.getReference
in interface PsiElement
getReference
in class PsiElementBase
ReferencesSearch
public final PsiElement getElement()
PsiReference
getElement
in interface PsiSymbolReference
getElement
in interface PsiReference
protected abstract ResolveResult [] resolveInner()
public final ResolveResult [] multiResolve(boolean incompleteCode)
PsiPolyVariantReference
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 final PsiElement resolve()
PsiReference
resolve
in interface PsiReference
null
if it was not possible to resolve the reference to a valid target.PsiPolyVariantReference.multiResolve(boolean)
protected boolean processVariantsInner(PsiScopeProcessor processor)
protected boolean processUnqualifiedVariants(PsiScopeProcessor processor)
public java.lang.String getCanonicalText()
PsiReference
getCanonicalText
in interface PsiReference
public T getQualifier()
PsiQualifiedReference
getQualifier
in interface PsiQualifiedReference
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.protected final AbstractQualifiedReference replaceReference(java.lang.String newText)
protected abstract T parseReference(java.lang.String newText)
protected boolean isAccessible(PsiElement element)
protected AbstractQualifiedReference shortenReferences()
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.protected abstract PsiElement getSeparator()
protected abstract PsiElement getReferenceNameElement()
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 java.lang.String getReferenceName()
PsiQualifiedReference
getReferenceName
in interface PsiQualifiedReference
public final 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.