public abstract class BaseExternalAnnotationsManager extends ExternalAnnotationsManager
Modifier and Type | Class and Description |
---|---|
static class |
BaseExternalAnnotationsManager.AnnotationData |
ExternalAnnotationsManager.AnnotationPlace, ExternalAnnotationsManager.CanceledConfigurationException
Modifier and Type | Field and Description |
---|---|
protected PsiManager |
myPsiManager |
ANNOTATIONS_XML, TOPIC
Constructor and Description |
---|
BaseExternalAnnotationsManager(PsiManager psiManager) |
Modifier and Type | Method and Description |
---|---|
void |
annotateExternally(PsiModifierListOwner listOwner,
java.lang.String annotationFQName,
PsiFile fromFile,
PsiNameValuePair [] value) |
ExternalAnnotationsManager.AnnotationPlace |
chooseAnnotationsPlace(PsiElement element) |
ExternalAnnotationsManager.AnnotationPlace |
chooseAnnotationsPlaceNoUi(PsiElement element) |
boolean |
deannotate(PsiModifierListOwner listOwner,
java.lang.String annotationFQN) |
protected void |
dropCache() |
protected void |
duplicateError(PsiFile file,
java.lang.String externalName,
java.lang.String text) |
boolean |
editExternalAnnotation(PsiModifierListOwner listOwner,
java.lang.String annotationFQN,
PsiNameValuePair [] value) |
java.util.List<PsiAnnotation> |
findDefaultConstructorExternalAnnotations(PsiClass aClass)
Returns external annotations associated with default
constructor of the
aClass , if the constructor exists. |
java.util.List<PsiAnnotation> |
findDefaultConstructorExternalAnnotations(PsiClass aClass,
java.lang.String annotationFQN)
Returns external annotations with fully qualified name of
annotationFQN
associated with default constructor of the aClass , if the constructor exists. |
PsiAnnotation |
findExternalAnnotation(PsiModifierListOwner listOwner,
java.lang.String annotationFQN) |
PsiAnnotation [] |
findExternalAnnotations(PsiModifierListOwner listOwner) |
java.util.List<PsiAnnotation> |
findExternalAnnotations(PsiModifierListOwner listOwner,
java.lang.String annotationFQN)
Returns external annotations with fully qualified name of
annotationFQN
associated with listOwner . |
java.util.List<PsiFile> |
findExternalAnnotationsFiles(PsiModifierListOwner listOwner) |
MostlySingularMultiMap<java.lang.String,BaseExternalAnnotationsManager.AnnotationData> |
getDataFromFile(PsiFile file) |
protected abstract java.util.List<VirtualFile> |
getExternalAnnotationsRoots(VirtualFile libraryFile) |
protected static java.lang.String |
getExternalName(PsiModifierListOwner listOwner)
Returns canonical string presentation of
listOwner
used in external annotations files. |
boolean |
hasAnnotationRootsForFile(VirtualFile file) |
protected abstract boolean |
hasAnyAnnotationsRoots() |
boolean |
isExternalAnnotation(PsiAnnotation annotation) |
boolean |
isExternalAnnotationWritable(PsiModifierListOwner listOwner,
java.lang.String annotationFQN) |
protected void |
registerExternalAnnotations(java.lang.Object key,
PsiFile annotationsFile) |
elementRenamedOrMoved, getInstance
protected final PsiManager myPsiManager
public BaseExternalAnnotationsManager(PsiManager psiManager)
protected static java.lang.String getExternalName(PsiModifierListOwner listOwner)
listOwner
used in external annotations files.listOwner
- API element to return external name ofnull
if the listOwner
is of unknown type (neither class, method, field nor parameter)protected abstract boolean hasAnyAnnotationsRoots()
public boolean hasAnnotationRootsForFile(VirtualFile file)
hasAnnotationRootsForFile
in class ExternalAnnotationsManager
public boolean isExternalAnnotation(PsiAnnotation annotation)
isExternalAnnotation
in class ExternalAnnotationsManager
public PsiAnnotation findExternalAnnotation(PsiModifierListOwner listOwner, java.lang.String annotationFQN)
findExternalAnnotation
in class ExternalAnnotationsManager
public java.util.List<PsiAnnotation> findExternalAnnotations(PsiModifierListOwner listOwner, java.lang.String annotationFQN)
ExternalAnnotationsManager
annotationFQN
associated with listOwner
.
Multiple results may be returned for repeatable annotations and annotations
from several external annotations roots.findExternalAnnotations
in class ExternalAnnotationsManager
listOwner
- API element to return external annotations ofannotationFQN
- fully qualified name of the annotation to search forlistOwner
public java.util.List<PsiAnnotation> findDefaultConstructorExternalAnnotations(PsiClass aClass, java.lang.String annotationFQN)
ExternalAnnotationsManager
annotationFQN
associated with default constructor of the aClass
, if the constructor exists.
Multiple annotations may be returned since there may be repeatable annotations
or annotations from several external annotations roots.findDefaultConstructorExternalAnnotations
in class ExternalAnnotationsManager
aClass
- class of which default constructor's external annotations are to be foundannotationFQN
- fully qualified name of annotation class to search foraClass
, or null
if the
class doesn't have a default constructor.ExternalAnnotationsManager.findDefaultConstructorExternalAnnotations(PsiClass)
public java.util.List<PsiAnnotation> findDefaultConstructorExternalAnnotations(PsiClass aClass)
ExternalAnnotationsManager
aClass
, if the constructor exists.
Default constructors should be handled specially
because they don't have PsiModifierListOwner
,
nor they are returned in PsiClass.getConstructors()
.
Yet default constructors may be externally annotated
in corresponding annotations.xml
:
<item name='com.example.Foo Foo()'>
<annotation name='org.some.Annotation'/>
</item>
findDefaultConstructorExternalAnnotations
in class ExternalAnnotationsManager
aClass
- class of which default constructor's external annotations are to be foundaClass
or null
if the class doesn't have a default constructorpublic boolean isExternalAnnotationWritable(PsiModifierListOwner listOwner, java.lang.String annotationFQN)
isExternalAnnotationWritable
in class ExternalAnnotationsManager
public PsiAnnotation [] findExternalAnnotations(PsiModifierListOwner listOwner)
findExternalAnnotations
in class ExternalAnnotationsManager
public MostlySingularMultiMap<java.lang.String,BaseExternalAnnotationsManager.AnnotationData> getDataFromFile(PsiFile file)
protected void duplicateError(PsiFile file, java.lang.String externalName, java.lang.String text)
public java.util.List<PsiFile> findExternalAnnotationsFiles(PsiModifierListOwner listOwner)
findExternalAnnotationsFiles
in class ExternalAnnotationsManager
protected abstract java.util.List<VirtualFile> getExternalAnnotationsRoots(VirtualFile libraryFile)
protected void dropCache()
public void annotateExternally(PsiModifierListOwner listOwner, java.lang.String annotationFQName, PsiFile fromFile, PsiNameValuePair [] value) throws ExternalAnnotationsManager.CanceledConfigurationException
annotateExternally
in class ExternalAnnotationsManager
ExternalAnnotationsManager.CanceledConfigurationException
public boolean deannotate(PsiModifierListOwner listOwner, java.lang.String annotationFQN)
deannotate
in class ExternalAnnotationsManager
public boolean editExternalAnnotation(PsiModifierListOwner listOwner, java.lang.String annotationFQN, PsiNameValuePair [] value)
editExternalAnnotation
in class ExternalAnnotationsManager
public ExternalAnnotationsManager.AnnotationPlace chooseAnnotationsPlaceNoUi(PsiElement element)
chooseAnnotationsPlaceNoUi
in class ExternalAnnotationsManager
element
- element to add new annotation forExternalAnnotationsManager.AnnotationPlace.NEED_ASK_USER
if the user confirmation is necessary.public ExternalAnnotationsManager.AnnotationPlace chooseAnnotationsPlace(PsiElement element)
chooseAnnotationsPlace
in class ExternalAnnotationsManager
element
- element to add new annotation forprotected void registerExternalAnnotations(java.lang.Object key, PsiFile annotationsFile)