From 10ca0aa4e74e49cc7688f404aaa5bcc2ab3c9d76 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 27 Jun 2011 19:05:53 +0200 Subject: [PATCH] perform parameter rename without using BaseRefactoringProcessor, avoiding its invokeLater() call (PY-3914) --- .../refactoring/extractmethod/PyExtractMethodUtil.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/src/com/jetbrains/python/refactoring/extractmethod/PyExtractMethodUtil.java b/python/src/com/jetbrains/python/refactoring/extractmethod/PyExtractMethodUtil.java index 7f65c22b6d1c..7901c66ae416 100644 --- a/python/src/com/jetbrains/python/refactoring/extractmethod/PyExtractMethodUtil.java +++ b/python/src/com/jetbrains/python/refactoring/extractmethod/PyExtractMethodUtil.java @@ -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 allRenames = new java.util.HashMap(); + 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