void (@NotNull final Project project, @NotNull PsiFile file, @Nullable final Editor editor, @NotNull final PsiElement startElement, @NotNull PsiElement endElement) { if (editor == null) return; PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)startElement).getClassReference(); if (classReference == null) return; final PsiClass psiClass = (PsiClass)classReference.resolve(); if (psiClass == null) return; chooseMethodsToImplement(editor, startElement, psiClass, false, chooser -> { if (chooser == null) return; final List<PsiMethodMember> selectedElements = chooser.getSelectedElements(); OverrideOrImplementOptions options = chooser.getOptions(); if (selectedElements == null || selectedElements.isEmpty()) return; WriteCommandAction.writeCommandAction(project, file).run(() -> { implementNewMethods(project, editor, startElement, selectedElements, options); }); }); }