IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiElement element = PsiTreeUtil.findSameElementInCopy(getStartElement(), file); if (element instanceof PsiClass && element.getParent() instanceof PsiJavaFile javaFile && javaFile.getClasses().length == 1) { var doc = file.getViewProvider().getDocument(); doc.deleteString(0, doc.getTextLength()); } else { element.delete(); } return IntentionPreviewInfo.DIFF; }