void (@NotNull Project project, Editor editor, PsiFile file) { if (CreateFromUsageUtils.isValidReference(myReferenceExpression, false)) return; IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace(); PsiMethod method = PsiTreeUtil.getParentOfType(myReferenceExpression, PsiMethod.class); LOG.assertTrue(method != null); chooseEnclosingMethod(editor, method, m -> { m = SuperMethodWarningUtil.checkSuperMethod(m); if (m == null) return; final List<ParameterInfoImpl> parameterInfos = getParameterInfos(m); if (ApplicationManager.getApplication().isUnitTestMode()) { ParameterInfoImpl[] array = parameterInfos.toArray(new ParameterInfoImpl[0]); String modifier = PsiUtil.getAccessModifier(PsiUtil.getAccessLevel(m.getModifierList())); var processor = JavaRefactoringFactory.getInstance(project) .createChangeSignatureProcessor(m, false, modifier, m.getName(), m.getReturnType(), array, null, null, null, null); processor.run(); } else { JavaChangeSignatureDialog dialog = JavaChangeSignatureDialog.createAndPreselectNew(project, m, parameterInfos, true, myReferenceExpression); dialog.setParameterInfos(parameterInfos); if (dialog.showAndGet()) { final String varName = myReferenceExpression.getReferenceName(); for (ParameterInfoImpl info : parameterInfos) { if (info.isNew()) { final String newParamName = info.getName(); if (!Comparing.strEqual(varName, newParamName)) { final PsiExpression newExpr = JavaPsiFacade.getElementFactory(project).createExpressionFromText(newParamName, m); WriteCommandAction.writeCommandAction(project).run(() -> { final PsiReferenceExpression[] refs = CreateFromUsageUtils.collectExpressions(myReferenceExpression, PsiMember.class, PsiFile.class); for (PsiReferenceExpression ref : refs) { ref.replace(newExpr.copy()); } }); } break; } } } } }); }