@Nullable
  protected PsiFile getContainingFile() {
    final PsiFile file = InjectedLanguageUtil.getTopLevelFile(myElement.getContainingFile());
    if (file == null) {
      LOG.error("Invalid element: " + myElement);
    }

    return file.getOriginalFile();
  }
 public int getLineNumber() {
   if (myLineNumber == -1) {
     PsiElement psiElement = getPsiElement();
     if (psiElement == null) return -1;
     if (!psiElement.isValid()) return -1;
     LOG.assertTrue(psiElement.isPhysical());
     PsiFile containingFile = InjectedLanguageUtil.getTopLevelFile(psiElement);
     Document document =
         PsiDocumentManager.getInstance(psiElement.getProject()).getDocument(containingFile);
     if (document == null) return -1;
     TextRange textRange = getTextRange();
     if (textRange == null) return -1;
     textRange =
         InjectedLanguageManager.getInstance(containingFile.getProject())
             .injectedToHost(psiElement, textRange);
     myLineNumber = document.getLineNumber(textRange.getStartOffset()) + 1;
   }
   return myLineNumber;
 }
 @Override
 public PsiFile getTopLevelFile(@NotNull PsiElement element) {
   return InjectedLanguageUtil.getTopLevelFile(element);
 }