IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiJavaCodeReferenceElement element = getRefElement(); if (element == null) return IntentionPreviewInfo.EMPTY; element = PsiTreeUtil.findSameElementInCopy(element, file); String superClassName = getSuperClassName(element); PsiClass aClass = myKind.create(JavaPsiFacade.getElementFactory(project), element.getReferenceName()); if (StringUtil.isNotEmpty(superClassName) && (myKind != CreateClassKind.ENUM || !superClassName.equals(CommonClassNames.JAVA_LANG_ENUM)) && (myKind != CreateClassKind.RECORD || !superClassName.equals(CommonClassNames.JAVA_LANG_RECORD))) { CreateFromUsageUtils.setupSuperClassReference(aClass, superClassName); } CreateFromUsageBaseFix.setupGenericParameters(aClass, element); PsiDeconstructionPattern pattern = getDeconstructionPattern(element); if (pattern != null) { CreateInnerClassFromUsageFix.setupRecordFromDeconstructionPattern(aClass, pattern, getText()); } CodeStyleManager.getInstance(project).reformat(aClass); return new IntentionPreviewInfo.CustomDiff(JavaFileType.INSTANCE, "", aClass.getText()); }