public static @NotNull Document createFakeDocument(@NotNull Document original) {
    EditorFactoryImpl editorFactory = (EditorFactoryImpl)EditorFactory.getInstance();
    boolean acceptsSlashR = original instanceof DocumentImpl && ((DocumentImpl)original).acceptsSlashR();
    boolean writeThreadOnly = original instanceof DocumentImpl && ((DocumentImpl)original).isWriteThreadOnly();
    Document document = editorFactory.createDocument("", acceptsSlashR, !writeThreadOnly);
    document.putUserData(UndoManager.ORIGINAL_DOCUMENT, original);
    return document;
  }
public static @NotNull Document createFakeDocument(@NotNull Document original)