mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
perform real rename on automatically suggested vars (comment for IDEA-94844)
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
interface F {
|
||||
void foo(int <caret>i);
|
||||
}
|
||||
|
||||
class A implements F {
|
||||
int myI;
|
||||
public void foo(int i){
|
||||
myI = i;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
interface F {
|
||||
void foo(int myI);
|
||||
}
|
||||
|
||||
class A implements F {
|
||||
int myI;
|
||||
public void foo(int myI){
|
||||
this.myI = myI;
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,10 @@ public class RenameLocalTest extends LightRefactoringTestCase {
|
||||
doTestInplaceRename("myI");
|
||||
}
|
||||
|
||||
public void testRenameInPlaceQualifyFieldReferenceInChild() throws Exception {
|
||||
doTestInplaceRename("myI");
|
||||
}
|
||||
|
||||
public void testRenameInPlaceThisNeeded() throws Exception {
|
||||
doTestInplaceRename("a");
|
||||
}
|
||||
|
||||
+8
@@ -24,6 +24,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author dsl
|
||||
*/
|
||||
public interface RefactoringElementListener {
|
||||
RefactoringElementListener DEAF = new RefactoringElementListener() {
|
||||
@Override
|
||||
public void elementMoved(@NotNull PsiElement newElement) {}
|
||||
|
||||
@Override
|
||||
public void elementRenamed(@NotNull PsiElement newElement) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Invoked in write action and command.
|
||||
*/
|
||||
|
||||
+2
-1
@@ -36,6 +36,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListener;
|
||||
import com.intellij.refactoring.rename.AutomaticRenamingDialog;
|
||||
import com.intellij.refactoring.rename.RenameHandlerRegistry;
|
||||
import com.intellij.refactoring.rename.RenameProcessor;
|
||||
@@ -240,7 +241,7 @@ public class VariableInplaceRenamer extends InplaceRefactoring {
|
||||
final String newElementName = renamer.getNewName(element);
|
||||
if (newElementName != null) {
|
||||
final Collection<UsageInfo> infos = classified.get(element);
|
||||
RenameUtil.doRenameGenericNamedElement(element, newElementName, infos.toArray(new UsageInfo[infos.size()]), null);
|
||||
RenameUtil.doRename(element, newElementName, infos.toArray(new UsageInfo[infos.size()]), myProject, RefactoringElementListener.DEAF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user