void (PsiMethod method, PsiMethod methodToSearchFor, PsiExpression[] occurrences, @NotNull IntroduceVariableBase.JavaReplaceChoice replaceChoice) { String enteredName = null; boolean delegate = false; PsiType initializerType = IntroduceParameterProcessor.getInitializerType(null, myExpr, myLocalVar); final var activeIntroducer = (InplaceIntroduceParameterPopup)AbstractInplaceIntroducer.getActiveIntroducer(myEditor); if (activeIntroducer != null) { activeIntroducer.stopIntroduce(myEditor); myExpr = activeIntroducer.getExpr(); myLocalVar = (PsiLocalVariable)activeIntroducer.getLocalVariable(); occurrences = activeIntroducer.getOccurrences(); enteredName = activeIntroducer.getInputName(); replaceChoice = activeIntroducer.getReplaceChoice(); delegate = activeIntroducer.isGenerateDelegate(); initializerType = activeIntroducer.getType(); } boolean mustBeFinal = false; if (myExpr != null) { final PsiElement parent = myExpr.getUserData(ElementToWorkOn.PARENT); mustBeFinal = parent != null && PsiTreeUtil.getParentOfType(parent, PsiClass.class, PsiMethod.class) != method; } for (PsiExpression occurrence : occurrences) { if (occurrence.isPhysical() && PsiTreeUtil.getParentOfType(occurrence, PsiClass.class, PsiMethod.class) != method) { mustBeFinal = true; break; } } final String propName = myLocalVar != null ? JavaCodeStyleManager .getInstance(myProject).variableNameToPropertyName(myLocalVar.getName(), VariableKind.LOCAL_VARIABLE) : null; boolean isInplaceAvailableOnDataContext = myEditor != null && myEditor.getSettings().isVariableInplaceRenameEnabled(); if (myExpr != null) { isInplaceAvailableOnDataContext &= myExpr.isPhysical(); } if (isInplaceAvailableOnDataContext && activeIntroducer == null) { myInplaceIntroduceParameterPopup = new InplaceIntroduceParameterPopup(myProject, myEditor, createTypeSelectorManager(occurrences, initializerType), myExpr, myLocalVar, method, methodToSearchFor, occurrences, getParamsToRemove(method, occurrences), mustBeFinal, replaceChoice); if (myInplaceIntroduceParameterPopup.startInplaceIntroduceTemplate()) { return; } } if (ApplicationManager.getApplication().isUnitTestMode()) { @NonNls String parameterName = "anObject"; PsiExpression initializer = myLocalVar != null && myExpr == null ? myLocalVar.getInitializer() : myExpr; new IntroduceParameterProcessor(myProject, method, methodToSearchFor, initializer, myExpr, myLocalVar, true, parameterName, replaceChoice, IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, mustBeFinal, false, false, null, getParamsToRemove(method, occurrences)).run(); } else { if (myEditor != null) { RefactoringUtil.highlightAllOccurrences(myProject, occurrences, myEditor); } final List<UsageInfo> classMemberRefs = new ArrayList<>(); if (myExpr != null) { Util.analyzeExpression(myExpr, new ArrayList<>(), classMemberRefs, new ArrayList<>()); } showDialog(method, methodToSearchFor, occurrences, replaceChoice, delegate, initializerType, mustBeFinal, classMemberRefs, createNameSuggestionGenerator(myExpr, propName, myProject, enteredName)); } }