@Override
 public long getModificationStamp() {
   if (!myFile.isContentsLoaded()) {
     unsetPsiContent();
     return SingleRootFileViewProvider.this.getModificationStamp();
   }
   return myModificationStamp;
 }
 @Override
 public CharSequence getText() {
   if (!myFile.isContentsLoaded()) {
     unsetPsiContent();
     return getContents();
   }
   if (myContent != null) return myContent;
   return myContent =
       ApplicationManager.getApplication()
           .runReadAction(
               new Computable<CharSequence>() {
                 public CharSequence compute() {
                   return myFile.calcTreeElement().getText();
                 }
               });
 }
 public void beforeDocumentChanged() {
   final PsiFileImpl psiFile = (PsiFileImpl) getCachedPsi(getBaseLanguage());
   if (psiFile != null && psiFile.isContentsLoaded() && getContent() instanceof DocumentContent) {
     setContent(new PsiFileContent(psiFile, getModificationStamp()));
   }
 }