private @Nullable DomElement getSelectedDomElementFromTextEditor(TextEditor textEditor) {
    PsiFile psiFile = getPsiFile();
    if (psiFile == null) return null;
    PsiElement psiElement = psiFile.findElementAt(textEditor.getEditor().getCaretModel().getOffset());

    if (psiElement == null) return null;

    XmlTag xmlTag = PsiTreeUtil.getParentOfType(psiElement, XmlTag.class);

    return DomManager.getDomManager(myProject).getDomElement(xmlTag);
  }
private @Nullable DomElement getSelectedDomElementFromTextEditor(TextEditor textEditor)