longer read action (EA-22453 - assert: LazyParseableElement.ensureParsed)

This commit is contained in:
Dmitry Jemerov
2010-10-18 21:21:04 +04:00
parent 2361a6c057
commit 493e3b7e89
@@ -194,16 +194,15 @@ public class FormReferencesSearcher implements QueryExecutor<PsiReference, Refer
index = CharArrayUtil.indexOf(chars, name, index);
if (index < 0) break;
final PsiReference ref = file.findReferenceAt(index + offset + 1);
if (ref != null) {
final boolean isReferenceTo = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
public Boolean compute() {
return ref.isReferenceTo(element);
}
}).booleanValue();
if (isReferenceTo){
if (!processor.process(ref)) return false;
final int finalIndex = index;
final PsiReference ref = ApplicationManager.getApplication().runReadAction(new NullableComputable<PsiReference>() {
public PsiReference compute() {
final PsiReference ref = file.findReferenceAt(finalIndex + offset + 1);
return ref != null && ref.isReferenceTo(element) ? ref : null;
}
});
if (ref != null) {
if (!processor.process(ref)) return false;
}
index++;
}