public static @NotNull JavaChangeSignatureDialog createAndPreselectNew(@NotNull Project project,
                                                                         @NotNull PsiMethod method,
                                                                         @NotNull List<? extends ParameterInfoImpl> parameterInfos,
                                                                         final boolean allowDelegation,
                                                                         final PsiReferenceExpression refExpr,
                                                                         @Nullable Consumer<? super List<ParameterInfo>> callback) {
    return new JavaChangeSignatureDialog(project, method, allowDelegation, refExpr) {
      @Override
      protected int getSelectedIdx() {
        for (int i = 0; i < parameterInfos.size(); i++) {
          ParameterInfoImpl info = parameterInfos.get(i);
          if (info.oldParameterIndex < 0) {
            return i;
          }
        }
        return super.getSelectedIdx();
      }

      @Override
      protected BaseRefactoringProcessor createRefactoringProcessor() {
        final List<ParameterInfoImpl> parameters = getParameters();
        ParameterInfoImpl @NotNull [] parameterInfo = parameters.toArray(new ParameterInfoImpl[0]);
        return ((ChangeSignatureRefactoringImpl)JavaRefactoringFactory.getInstance(myProject)
          .createChangeSignatureProcessor(myMethod.getMethod(), isGenerateDelegate(), getVisibility(), getMethodName(), getNewReturnType(),
                                          parameterInfo,
                                          getExceptions(),
                                          myMethodsToPropagateParameters, myMethodsToPropagateExceptions, infos -> {
              if (callback != null) {
                callback.consume(new ArrayList<>(getParameters()));
              }
            })).getProcessor();
      }
    };
  }
public static @NotNull JavaChangeSignatureDialog createAndPreselectNew(@NotNull Project project,
                                                                         @NotNull PsiMethod method,
                                                                         @NotNull List<? extends ParameterInfoImpl> parameterInfos,
                                                                         final boolean allowDelegation,
                                                                         final PsiReferenceExpression refExpr,
                                                                         @Nullable Consumer<? super List<ParameterInfo>> callback)