XmlTag (XmlTag context) { if (context == null) return null; final XmlAttribute xmlAttribute = context.getAttribute(FxmlConstants.SOURCE); if (xmlAttribute != null) { final XmlAttributeValue valueElement = xmlAttribute.getValueElement(); if (valueElement != null) { final PsiReference reference = valueElement.getReference(); if (reference != null) { final PsiElement resolve = reference.resolve(); if (resolve instanceof XmlFile) { final XmlTag rootTag = ((XmlFile)resolve).getRootTag(); if (rootTag != null) { return rootTag; } } } } } return null; }