mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
perform parameter rename without using BaseRefactoringProcessor, avoiding its invokeLater() call (PY-3914)
This commit is contained in:
@@ -17,12 +17,14 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.refactoring.RefactoringFactory;
|
||||
import com.intellij.refactoring.extractMethod.AbstractExtractMethodDialog;
|
||||
import com.intellij.refactoring.extractMethod.AbstractVariableData;
|
||||
import com.intellij.refactoring.extractMethod.ExtractMethodDecorator;
|
||||
import com.intellij.refactoring.extractMethod.ExtractMethodValidator;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListenerComposite;
|
||||
import com.intellij.refactoring.rename.RenameUtil;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.hash.HashMap;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
@@ -281,7 +283,10 @@ public class PyExtractMethodUtil {
|
||||
final String name = parameter.getName();
|
||||
final String newName = map.get(name);
|
||||
if (name != null && newName != null && !name.equals(newName)){
|
||||
RefactoringFactory.getInstance(project).createRename(parameter, newName).run();
|
||||
Map<PsiElement, String> allRenames = new java.util.HashMap<PsiElement, String>();
|
||||
allRenames.put(parameter, newName);
|
||||
UsageInfo[] usages = RenameUtil.findUsages(parameter, newName, false, false, allRenames);
|
||||
RenameUtil.doRename(parameter, newName, usages, project, new RefactoringElementListenerComposite());
|
||||
}
|
||||
}
|
||||
// Change signature according to pass settings and
|
||||
|
||||
Reference in New Issue
Block a user