DocumentEx () { DocumentEx doc = new DocumentImpl("", false, false); // restrict "\r\n" line separators doc.putUserData(FileDocumentManagerImpl.NOT_RELOADABLE_DOCUMENT_KEY, new Object()); // to protect document from illegal content changes (see usages of the key) UndoUtil.disableUndoFor(doc); // disabling Undo-functionality, provided by IDEA return doc; }