String (@NotNull PsiElement element, boolean qualified, boolean ignorePsiClassOwner) { PsiElement parent = PsiTreeUtil.getStubOrPsiParentOfType(element, PsiMember.class); if (parent == null) parent = element.getContainingFile(); while(true){ if (parent == null) return null; String name = getNameForElement(parent, qualified, ignorePsiClassOwner); if (name != null) return name; if (parent instanceof PsiFile) return null; parent = PsiTreeUtil.getStubOrPsiParent(parent); } }