boolean (@NotNull PsiElement element) { if (element instanceof StubBasedPsiElement) { final StubElement stub = ((StubBasedPsiElement<?>)element).getStub(); if (stub != null) { final StubElement parentStub = stub.getParentStub(); if (parentStub != null) { return parentStub.getPsi() instanceof PsiFile; } } } return ScopeUtil.getScopeOwner(element) instanceof PsiFile; }