boolean (PsiElement element) { if (element instanceof LightMethod) { PsiClass containingClass = ((LightMethod)element).getContainingClass(); if (containingClass.isEnum()) return true; } if (element instanceof PsiReceiverParameter) { return true; } return element instanceof PsiJavaFile && !FileTypeUtils.isInServerPageFile(element) && !JavaProjectRootsUtil.isOutsideJavaSourceRoot((PsiFile)element) && ((PsiJavaFile) element).getClasses().length > 0; }