public class PsiDynaReference<T extends PsiElement> extends PsiReferenceBase<T> implements FileReferenceOwner, PsiPolyVariantReference, LocalQuickFixProvider, EmptyResolveMessageProvider
PsiReferenceBase.Immediate<T extends PsiElement>, PsiReferenceBase.Poly<T extends PsiElement>
myElement, mySoft
ARRAY_FACTORY, EMPTY_ARRAY
Constructor and Description |
---|
PsiDynaReference(T psiElement) |
Modifier and Type | Method and Description |
---|---|
void |
addReference(PsiReference reference) |
void |
addReferences(java.util.Collection<? extends PsiReference> references) |
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).
|
PsiFileReference |
getLastFileReference() |
LocalQuickFix[] |
getQuickFixes() |
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.
|
java.util.List<PsiReference> |
getReferences() |
java.lang.String |
getUnresolvedMessagePattern()
Returns custom unresolved message pattern.
|
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 ResolveResult[] |
innerResolve(boolean incompleteCode) |
boolean |
isReferenceTo(PsiElement element)
Checks if the reference targets the specified element.
|
ResolveResult [] |
multiResolve(boolean incompleteCode)
Returns the results of resolving the reference.
|
PsiElement |
resolve()
Returns the element which is the target of the reference.
|
java.lang.String |
toString() |
calculateDefaultRangeInElement, createSelfReference, createSelfReference, getElement, getValue, isSoft, setRangeInElement
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
resolveReference
getElement, getVariants, isSoft, resolvesTo
getAbsoluteRange
public PsiDynaReference(T psiElement)
public void addReferences(java.util.Collection<? extends PsiReference> references)
public java.util.List<PsiReference> getReferences()
public void addReference(PsiReference reference)
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
getRangeInElement
in class PsiReferenceBase<T extends PsiElement>
public PsiElement resolve()
PsiReference
resolve
in interface PsiReference
null
if it was not possible to resolve the reference to a valid target.PsiPolyVariantReference.multiResolve(boolean)
public java.lang.String getCanonicalText()
PsiReference
getCanonicalText
in interface PsiReference
getCanonicalText
in class PsiReferenceBase<T extends PsiElement>
public PsiElement handleElementRename(java.lang.String newElementName) throws IncorrectOperationException
PsiReference
handleElementRename
in interface PsiReference
handleElementRename
in class PsiReferenceBase<T extends PsiElement>
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
bindToElement
in class PsiReferenceBase<T extends PsiElement>
element
- the element which should become the target of the reference.IncorrectOperationException
- if the rebind cannot be handled for some reason.public boolean isReferenceTo(PsiElement element)
PsiReference
isReferenceTo
in interface PsiReference
isReferenceTo
in class PsiReferenceBase<T extends PsiElement>
element
- the element to check target for.true
if the reference targets that element, false
otherwise.public 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.protected ResolveResult[] innerResolve(boolean incompleteCode)
public java.lang.String getUnresolvedMessagePattern()
EmptyResolveMessageProvider
MessageFormat.format()
call.
If the call fails, returned value is used as is.
Resulting text should have Sentence capitalization.getUnresolvedMessagePattern
in interface EmptyResolveMessageProvider
public LocalQuickFix[] getQuickFixes()
getQuickFixes
in interface LocalQuickFixProvider
public java.lang.String toString()
toString
in class PsiReferenceBase<T extends PsiElement>
public PsiFileReference getLastFileReference()
getLastFileReference
in interface FileReferenceOwner