DocumentEx () { Object file = myDocumentOrFile; DocumentEx document = file instanceof VirtualFile ? (DocumentEx)FileDocumentManager.getInstance().getDocument((VirtualFile)file) : (DocumentEx)file; if (document == null) { LOG.error("document is null; isValid=" + isValid()+"; file="+file); } return document; }