inplace introduce parameter: no need to choose method when you only want to tweak settings in the dialog

This commit is contained in:
anna
2011-08-21 17:39:31 +02:00
parent 253912e033
commit bdfb59fcc4
2 changed files with 15 additions and 0 deletions
@@ -291,4 +291,12 @@ public class InplaceIntroduceParameterPopup extends AbstractJavaInplaceIntroduce
public void setReplaceAllOccurrences(boolean replaceAll) {
myPanel.setReplaceAllOccurrences(replaceAll);
}
public PsiMethod getMethodToIntroduceParameter() {
return myMethod;
}
public PsiMethod getMethodToSearchFor() {
return myMethodToSearchFor;
}
}
@@ -182,6 +182,13 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase implements R
private void chooseMethodToIntroduceParameter(final Editor editor,
final List<PsiMethod> validEnclosingMethods,
final Introducer introducer) {
final AbstractInplaceIntroducer inplaceIntroducer = AbstractInplaceIntroducer.getActiveIntroducer(editor);
if (inplaceIntroducer instanceof InplaceIntroduceParameterPopup) {
final InplaceIntroduceParameterPopup introduceParameterPopup = (InplaceIntroduceParameterPopup)inplaceIntroducer;
introducer.introduceParameter(introduceParameterPopup.getMethodToIntroduceParameter(),
introduceParameterPopup.getMethodToSearchFor());
return;
}
final JPanel panel = new JPanel(new BorderLayout());
final JCheckBox superMethod = new JCheckBox("Use super method of", true);
superMethod.setMnemonic('U');