DocumentReference (@NotNull Document document) { assertIsWriteThread(); VirtualFile file = FileDocumentManager.getInstance().getFile(document); return file == null || !file.isValid() ? createFromDocument(document) : create(file); }