boolean (@NotNull PsiClass aClass) { if (aClass.getContainingClass() != null) { return false; } if (aClass instanceof PsiAnonymousClass) { return false; } PsiElement parent = aClass.getParent(); if (parent instanceof PsiDeclarationStatement && parent.getParent() instanceof PsiCodeBlock) { return false; } PsiFile parentFile = aClass.getContainingFile(); return parentFile != null && parentFile.getLanguage() == JavaLanguage.INSTANCE; // do not select JspClass }