boolean (@NotNull PsiElement place, PsiElement ancestor) { if (SafeDeleteProcessor.isInside(place, ancestor)) return true; // file will be deleted on class deletion return PsiTreeUtil.getParentOfType(place, PsiComment.class, false) != null && ancestor instanceof PsiClass aClass && aClass.getParent() instanceof PsiJavaFile file && PsiTreeUtil.isAncestor(file, place, false) && file.getClasses().length == 1; }