rename failure fixed: incomplete references on fields are now processed by VariableInIncompleteCodeSearcher

This commit is contained in:
Anna Kozlova
2014-12-24 20:26:33 +01:00
parent 9ec301792a
commit 5da3bc1687
4 changed files with 32 additions and 3 deletions
@@ -37,13 +37,16 @@ public class VariableInIncompleteCodeSearcher extends QueryExecutorBase<PsiRefer
@Override
public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
final PsiElement refElement = p.getElementToSearch();
if (!refElement.isValid() || !(refElement instanceof PsiLocalVariable || refElement instanceof PsiParameter)) return;
if (!refElement.isValid() || !(refElement instanceof PsiVariable)) return;
final String name = ((PsiVariable)refElement).getName();
if (name == null) return;
final SearchScope scope = p.getEffectiveSearchScope();
if (!(scope instanceof LocalSearchScope)) return;
SearchScope scope = p.getEffectiveSearchScope();
if (!(scope instanceof LocalSearchScope)) {
//process incomplete references to the 'field' in the same file only
scope = new LocalSearchScope(refElement.getContainingFile());
}
PsiElement[] elements = ((LocalSearchScope)scope).getScope();
if (elements.length == 0) return;