Iterator (Object contextNode) { if (!(contextNode instanceof XmlElement)) { return Collections.emptyIterator(); } return new NodeIterator((XmlElement)contextNode) { @Override protected PsiElement getFirstNode(PsiElement n) { while (n != null) { n = n.getParent(); if (n instanceof XmlTag) { return n; } } return null; } @Override protected PsiElement getNextNode(PsiElement n) { return null; } }; }