Search in sources :

Example 1 with PsiNameValuePairStub

use of com.intellij.psi.impl.java.stubs.PsiNameValuePairStub in project intellij-community by JetBrains.

the class PsiNameValuePairImpl method getDetachedValue.

@Override
@Nullable
public PsiAnnotationMemberValue getDetachedValue() {
    PsiNameValuePairStub stub = getStub();
    if (stub != null) {
        String text = stub.getValue();
        PsiAnnotationMemberValue result = SoftReference.dereference(myDetachedValue);
        if (result == null) {
            PsiAnnotation anno = JavaPsiFacade.getElementFactory(getProject()).createAnnotationFromText("@F(" + text + ")", this);
            ((LightVirtualFile) anno.getContainingFile().getViewProvider().getVirtualFile()).setWritable(false);
            myDetachedValue = new SoftReference<>(result = anno.findAttributeValue(null));
        }
        return result;
    }
    return getValue();
}
Also used : PsiNameValuePairStub(com.intellij.psi.impl.java.stubs.PsiNameValuePairStub) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

PsiNameValuePairStub (com.intellij.psi.impl.java.stubs.PsiNameValuePairStub)1 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)1 Nullable (org.jetbrains.annotations.Nullable)1