void (@NotNull Project project, @NotNull PsiFile file, @Nullable final Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { final PsiElement myPsiElement = startElement; if (editor == null || !FileModificationService.getInstance().prepareFileForWrite(myPsiElement.getContainingFile())) return; if (myPsiElement instanceof PsiEnumConstant) { final boolean hasClassInitializer = ((PsiEnumConstant)myPsiElement).getInitializingClass() != null; chooseMethodsToImplement(editor, startElement, ((PsiEnumConstant)myPsiElement).getContainingClass(), hasClassInitializer, chooser -> { if (chooser == null) return; final List<PsiMethodMember> selectedElements = chooser.getSelectedElements(); if (selectedElements == null || selectedElements.isEmpty()) return; WriteCommandAction.writeCommandAction(project, file).run(() -> { final PsiClass psiClass = ((PsiEnumConstant)myPsiElement).getOrCreateInitializingClass(); OverrideImplementUtil.overrideOrImplementMethodsInRightPlace(editor, psiClass, selectedElements, chooser.getOptions()); }); }); } else { OverrideImplementUtil.chooseAndImplementMethods(project, editor, (PsiClass)myPsiElement); } }