PsiClass (PsiElement element) { PsiClass aClass = PsiTreeUtil.getParentOfType(element, PsiClass.class, false, PsiFile.class); while (isNonStaticClass(aClass)) { aClass = PsiTreeUtil.getParentOfType(aClass, PsiClass.class, true, PsiFile.class); } return aClass; }