diff --git a/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java b/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java index 64104181fbda..4304a8664855 100644 --- a/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java @@ -279,7 +279,12 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase { final PsiMethod method = parameterHierarchyUsageInfo.getCalledMethod(); final PsiParameter parameter = parameterHierarchyUsageInfo.getReferencedElement(); final int parameterIndex = method.getParameterList().getParameterIndex(parameter); - final JavaCallerChooser chooser = new SafeDeleteJavaCallerChooser(method, project, parameterIndex, result); + final JavaCallerChooser chooser = new SafeDeleteJavaCallerChooser(method, project, result) { + @Override + protected int getParameterIdx() { + return parameterIndex; + } + }; if (!chooser.showAndGet()) { return null; } diff --git a/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCallerChooser.java b/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCallerChooser.java index 7098c6d84438..b14673bc386d 100644 --- a/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCallerChooser.java +++ b/java/java-impl/src/com/intellij/refactoring/safeDelete/SafeDeleteJavaCallerChooser.java @@ -23,7 +23,6 @@ import com.intellij.openapi.util.Ref; import com.intellij.psi.*; import com.intellij.psi.search.LocalSearchScope; import com.intellij.psi.search.searches.ReferencesSearch; -import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; import com.intellij.refactoring.changeSignature.MethodNodeBase; import com.intellij.refactoring.changeSignature.inCallers.JavaCallerChooser; @@ -38,17 +37,15 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -class SafeDeleteJavaCallerChooser extends JavaCallerChooser { +abstract class SafeDeleteJavaCallerChooser extends JavaCallerChooser { private final PsiMethod myMethod; private final Project myProject; - private final int myParameterIndex; private final ArrayList myResult; - public SafeDeleteJavaCallerChooser(PsiMethod method, Project project, int parameterIndex, ArrayList result) { + public SafeDeleteJavaCallerChooser(PsiMethod method, Project project, ArrayList result) { super(method, project, "Select Methods To Propagate Parameter Deletion", null, Consumer.EMPTY_CONSUMER); myMethod = method; myProject = project; - myParameterIndex = parameterIndex; myResult = result; } @@ -56,9 +53,11 @@ class SafeDeleteJavaCallerChooser extends JavaCallerChooser { protected JavaMethodNode createTreeNode(PsiMethod nodeMethod, com.intellij.util.containers.HashSet called, Runnable cancelCallback) { - return new SafeDeleteJavaMethodNode(nodeMethod, called, cancelCallback, myParameterIndex, nodeMethod != null ? nodeMethod.getProject() : myProject); + return new SafeDeleteJavaMethodNode(nodeMethod, called, cancelCallback, getParameterIdx(), nodeMethod != null ? nodeMethod.getProject() : myProject); } + protected abstract int getParameterIdx(); + @Override protected void doOKAction() { final List foreignMethodUsages = new ArrayList();