IntentionPreviewInfo (@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { final PsiElement element = previewDescriptor.getPsiElement(); PsiClass psiClass = PsiTreeUtil.getParentOfType(element, PsiClass.class); if (psiClass == null) return IntentionPreviewInfo.EMPTY; String textBefore = psiClass.getText(); psiClass.setName("NewCustomName"); String textAfter = psiClass.getText(); return new IntentionPreviewInfo.CustomDiff(GroovyFileType.GROOVY_FILE_TYPE, textBefore, textAfter); }