PsiClass () { PsiElement parent = getParent(); if (parent instanceof GrTypeDefinitionBody) { final PsiElement pparent = parent.getParent(); if (pparent instanceof PsiClass) { return (PsiClass) pparent; } } return null; }