PsiElement (final XmlProcessor processor, PsiElement elt) { if (elt == null) return null; PsiElement cur = elt; do { if (cur instanceof XmlTag tag) { if (!processor.process(tag)) { if (processor instanceof ResolveProcessor) { return ((ResolveProcessor)processor).getResult(); } return null; } } if (cur instanceof PsiFile) break; cur = PsiTreeUtil.getPrevSiblingOfType(cur, XmlTag.class); } while (cur != null); return treeWalkUp(processor, elt.getContext()); }