PsiElement (PsiElement place) { PsiElement parent = place; while (true) { if (parent instanceof PsiMember && !(parent instanceof PsiTypeParameter)) { return parent; } if (parent instanceof PsiFile) { PsiElement host = FileContextUtil.getFileContext((PsiFile)parent); if (host == null) { return parent; } parent = host; } parent = parent.getParent(); } }