void (@NotNull Project project, Editor editor, PsiExpression[] argsToBeDelegated, PsiMethod delegateMethod) { TemplateBuilderImpl builder = new TemplateBuilderImpl(delegateMethod); RangeMarker rangeMarker = editor.getDocument().createRangeMarker(delegateMethod.getTextRange()); for (final PsiExpression exprToBeDefault : argsToBeDelegated) { builder.replaceElement(exprToBeDefault, new TextExpression(exprToBeDefault.getText())); } Template template = builder.buildTemplate(); editor.getCaretModel().moveToOffset(rangeMarker.getStartOffset()); PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument()); editor.getDocument().deleteString(rangeMarker.getStartOffset(), rangeMarker.getEndOffset()); rangeMarker.dispose(); CreateFromUsageBaseFix.startTemplate(editor, template, project); }