XmlTag (final PsiFile file) { final SmartPsiElementPointer pointer = file.getUserData(FileContextUtil.INJECTED_IN_ELEMENT); final PsiElement element = pointer == null? null : pointer.getElement(); return element instanceof XmlText ? ((XmlText)element).getParentTag() : null; }