private @Nullable XmlFile getFile() {
    if (myFileReference != null) {
      final PsiElement psiElement = myFileReference.resolve();
      return psiElement instanceof XmlFile ? (XmlFile)psiElement : null;
    }

    final PsiFile containingFile = myElement.getContainingFile();
    if (containingFile instanceof XmlFile) {
      return (XmlFile)containingFile;
    }
    else {
      final XmlExtension extension = XmlExtension.getExtensionByElement(myElement);
      return extension == null ? null : extension.getContainingFile(myElement);
    }
  }
private @Nullable XmlFile getFile()