use enlarged use scope for determining whether in-place rename is applicable

This commit is contained in:
peter
2010-07-05 11:53:32 +01:00
parent 8a128faaab
commit c9427f5ae2
@@ -95,7 +95,7 @@ public class JavaRefactoringSupportProvider extends DefaultRefactoringSupportPro
if (!(elementToRename instanceof PsiVariable)) return false;
if (nameSuggestionContext != null && nameSuggestionContext.getContainingFile() != elementToRename.getContainingFile()) return false;
if (!(elementToRename instanceof PsiLocalVariable) && !(elementToRename instanceof PsiParameter)) return false;
SearchScope useScope = elementToRename.getUseScope();
SearchScope useScope = elementToRename.getManager().getSearchHelper().getUseScope(elementToRename);
if (!(useScope instanceof LocalSearchScope)) return false;
PsiElement[] scopeElements = ((LocalSearchScope) useScope).getScope();
if (scopeElements.length > 1 && // assume there are no elements with use scopes with holes in'em