void (RncDefine pattern) { final RncGrammar grammar = PsiTreeUtil.getParentOfType(pattern, RncGrammar.class); final PsiFile file = pattern.getContainingFile(); if (grammar != null) { if (processRncUsages(pattern, new LocalSearchScope(grammar))) return; } else { if (processRncUsages(pattern, new LocalSearchScope(file))) return; } final PsiElementProcessor.CollectElements<XmlFile> collector = new PsiElementProcessor.CollectElements<>(); RelaxIncludeIndex.processBackwardDependencies((XmlFile)file, collector); if (processRncUsages(pattern, new LocalSearchScope(collector.toArray()))) return; final ASTNode astNode = ((RncDefineImpl)pattern).getNameNode(); myHolder.registerProblem(astNode.getPsi(), RelaxngBundle.message("relaxng.inspection.unused-define.message"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, new MyFix<>()); }