inplace rename: include nameIdentifier in rename template when no reference covers this identifier

This commit is contained in:
anna
2013-04-15 17:37:44 +02:00
parent dd33d38b38
commit 7d81db930c
4 changed files with 25 additions and 3 deletions
@@ -0,0 +1,5 @@
class Test {
void foo(boolean b) {
System.out.println(<caret>b);
}
}
@@ -0,0 +1,5 @@
class Test {
void foo(boolean a) {
System.out.println(a);
}
}
@@ -88,6 +88,10 @@ public class RenameLocalTest extends LightRefactoringTestCase {
doTestInplaceRename("a");
}
public void testRenameInPlaceOnRef() throws Exception {
doTestInplaceRename("a");
}
public void testRenameInPlaceParamInOverriderAutomaticRenamer() throws Exception {
doTestInplaceRename("pp");
}
@@ -119,7 +123,7 @@ public class RenameLocalTest extends LightRefactoringTestCase {
private void doTestInplaceRename(final String newName) throws Exception {
configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
final PsiElement element = TargetElementUtilBase.findTargetElement(myEditor, TargetElementUtilBase.ELEMENT_NAME_ACCEPTED);
final PsiElement element = TargetElementUtilBase.findTargetElement(myEditor, TargetElementUtilBase.ELEMENT_NAME_ACCEPTED | TargetElementUtilBase.REFERENCED_ELEMENT_ACCEPTED);
assertNotNull(element);
assertTrue("In-place rename not allowed for " + element,
JavaRefactoringSupportProvider.mayRenameInplace(element, null));