public static Editor create(
     @NotNull final DocumentWindowImpl documentRange,
     @NotNull final EditorImpl editor,
     @NotNull final PsiFile injectedFile) {
   assert documentRange.isValid();
   assert injectedFile.isValid();
   EditorWindow window;
   synchronized (allEditors) {
     for (EditorWindow editorWindow : allEditors) {
       if (editorWindow.getDocument() == documentRange && editorWindow.getDelegate() == editor) {
         editorWindow.myInjectedFile = injectedFile;
         if (editorWindow.isValid()) {
           return editorWindow;
         }
       }
       if (editorWindow.getDocument().areRangesEqual(documentRange)) {
         // int i = 0;
       }
     }
     window = new EditorWindow(documentRange, editor, injectedFile, documentRange.isOneLine());
     allEditors.add(window);
   }
   assert window.isValid();
   return window;
 }
 private boolean isValid() {
   return !isDisposed()
       && !myInjectedFile.getProject().isDisposed()
       && myInjectedFile.isValid()
       && myDocumentWindow.isValid();
 }