boolean (PsiElement tag, LocalSearchScope scope) { final Query<PsiReference> query = ReferencesSearch.search(tag, scope); for (PsiReference reference : query) { final PsiElement e = reference.getElement(); final RncDefine t = PsiTreeUtil.getParentOfType(e, RncDefine.class, false); if (t == null || !PsiTreeUtil.isAncestor(tag, t, true)) { return true; } } return false; }