void (boolean searchForSuper, boolean removeLocalVariable, boolean replaceAllOccurrences, boolean declareFinal, final boolean removeUnusedParameters) { final int offset = getEditor().getCaretModel().getOffset(); final PsiElement element = Objects.requireNonNull(getFile().findElementAt(offset)).getParent(); assertTrue(element instanceof PsiLocalVariable); PsiMethod method = Util.getContainingMethod(element); final PsiMethod methodToSearchFor; if (searchForSuper) { PsiMethod[] deepestSuperMethods = method.findDeepestSuperMethods(); methodToSearchFor = deepestSuperMethods.length > 0 ? deepestSuperMethods[0] : method; } else { methodToSearchFor = method; } assertNotNull(method); assertNotNull(methodToSearchFor); final PsiLocalVariable localVariable = (PsiLocalVariable)element; final PsiExpression parameterInitializer = localVariable.getInitializer(); assertNotNull(parameterInitializer); IntArrayList parametersToRemove = removeUnusedParameters ? new IntArrayList(Util.findParametersToRemove(method, parameterInitializer, null)) : new IntArrayList(); new IntroduceParameterProcessor( getProject(), method, methodToSearchFor, parameterInitializer, null, localVariable, removeLocalVariable, localVariable.getName(), replaceAllOccurrences ? IntroduceVariableBase.JavaReplaceChoice.ALL : IntroduceVariableBase.JavaReplaceChoice.NO, IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, declareFinal, false, false, null, parametersToRemove ).run(); }