XmlTag (PsiElement context) { if (context instanceof PsiWhiteSpace) { PsiElement parent = context.getParent(); if (parent instanceof XmlText) { PsiElement prevSibling = parent.getPrevSibling(); if (prevSibling instanceof XmlTag) return (XmlTag)prevSibling; } else if (parent instanceof XmlTag) { return (XmlTag)parent; } } return null; }