IntentionPreviewInfo (@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { PsiClass targetClass = myFix.getTargetClass(); final CreateFieldFix fix = new CreateFieldFix(targetClass); String name = getFieldName(); if (name == null) { return IntentionPreviewInfo.EMPTY; } PsiField representation = fix.getFieldRepresentation(targetClass.getProject(), ArrayUtilRt.EMPTY_STRING_ARRAY, name, targetClass, true); PsiElement parent = representation == null ? null : representation.getParent(); if (parent == null) { return IntentionPreviewInfo.EMPTY; } String className = targetClass.getName(); String classKind; if (targetClass.isInterface()) { classKind = "interface"; } else if (targetClass.isEnum()) { classKind = "enum"; } else if (targetClass.isAnnotationType()) { classKind = "@interface"; } else if (targetClass.isRecord()) { classKind = "record"; } else if (targetClass instanceof GrTypeDefinition && ((GrTypeDefinition)targetClass).isTrait()) { classKind = "trait"; } else { classKind = "class"; } return new IntentionPreviewInfo.CustomDiff(GroovyFileType.GROOVY_FILE_TYPE, classKind + " " + className, "", parent.getText()); }