use of com.intellij.psi.PsiJavaParserFacade in project intellij-community by JetBrains.
the class PsiAnnotationStubImpl method getPsiElement.
@Override
public PsiAnnotation getPsiElement() {
PsiAnnotation annotation = SoftReference.dereference(myParsedFromRepository);
if (annotation != null)
return annotation;
String text = getText();
try {
PsiJavaParserFacade facade = JavaPsiFacade.getInstance(getProject()).getParserFacade();
annotation = facade.createAnnotationFromText(text, getPsi());
myParsedFromRepository = new SoftReference<>(annotation);
return annotation;
} catch (IncorrectOperationException e) {
LOG.error("Bad annotation in repository!", e);
return null;
}
}
use of com.intellij.psi.PsiJavaParserFacade in project intellij-community by JetBrains.
the class PsiImportStatementStubImpl method createReference.
@Nullable
private PsiJavaCodeReferenceElement createReference() {
final String refText = getImportReferenceText();
if (refText == null)
return null;
final PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(getProject()).getParserFacade();
try {
return parserFacade.createReferenceFromText(refText, getPsi());
} catch (IncorrectOperationException e) {
return null;
}
}
Aggregations