IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiClass aClass = (PsiClass)getStartElement(); PsiFile fileCopy = (PsiFile)aClass.getContainingFile().copy(); PsiClass classCopy = PsiTreeUtil.findSameElementInCopy(aClass, fileCopy); invokeImpl(classCopy); Collection<CandidateInfo> overrideImplement = OverrideImplementExploreUtil.getMethodsToOverrideImplement(classCopy, true); List<PsiMethodMember> toImplement = ContainerUtil.map( ContainerUtil.filter(overrideImplement, t -> t.getElement() instanceof PsiMethod method && !method.hasModifierProperty(PsiModifier.DEFAULT)), PsiMethodMember::new ); if (!toImplement.isEmpty()) { boolean insertOverrideAnnotation = JavaCodeStyleSettings.getInstance(file).INSERT_OVERRIDE_ANNOTATION; var prototypes = OverrideImplementUtil.overrideOrImplementMethods(classCopy, toImplement, false, insertOverrideAnnotation); PsiElement brace = classCopy.getRBrace(); if (brace == null) return IntentionPreviewInfo.EMPTY; GenerateMembersUtil.insertMembersAtOffset(classCopy, brace.getTextOffset(), prototypes); CodeStyleManager.getInstance(project).reformat(classCopy); } return new IntentionPreviewInfo.CustomDiff(JavaFileType.INSTANCE, aClass.getContainingFile().getText(), classCopy.getContainingFile().getText()); }