inplace rename: include the whole file in rename scope. when the substitutor is located in the same file it would be included in rename process (IDEA-86294)

This commit is contained in:
Anna Kozlova
2012-05-21 14:04:18 +04:00
parent ce9db7e26b
commit 86c0b2da14
4 changed files with 40 additions and 7 deletions
@@ -0,0 +1,16 @@
class Demo {
class MyEvent<T> {}
interface MyEventListener<T> {
void action(MyEvent<T> event);
}
class Driver {
void method() {
MyEventListener<Object> l = new MyEventListener<Object>() {
public void ac<caret>tion(MyEvent<Object> event) {
//To change body of implemented methods use File | Settings | File Templates.
}
};
}
}
}
@@ -0,0 +1,16 @@
class Demo {
class MyEvent<T> {}
interface MyEventListener<T> {
void xxx(MyEvent<T> event);
}
class Driver {
void method() {
MyEventListener<Object> l = new MyEventListener<Object>() {
public void xxx(MyEvent<Object> event) {
//To change body of implemented methods use File | Settings | File Templates.
}
};
}
}
}
@@ -45,6 +45,10 @@ public class RenameMembersInplaceTest extends LightCodeInsightTestCase {
public void testSuperMethod() throws Exception {
doTestInplaceRename("xxx");
}
public void testSuperMethodAnonymousInheritor() throws Exception {
doTestInplaceRename("xxx");
}
public void testMultipleConstructors() throws Exception {
doTestInplaceRename("Bar");
@@ -84,14 +84,11 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
@Override
protected PsiElement checkLocalScope() {
PsiElement scope = super.checkLocalScope();
if (scope == null) {
PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
if (currentFile != null) {
return currentFile;
}
PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
if (currentFile != null) {
return currentFile;
}
return scope;
return super.checkLocalScope();
}
@Override