private static Document createDocument(@NotNull String initialText, boolean viewer) {
    if (needSlashRSupport(initialText, viewer)){
      return ((EditorFactoryImpl)EditorFactory.getInstance()).createDocument(initialText, true, false);
    }
    else {
      return EditorFactory.getInstance().createDocument(StringUtil.convertLineSeparators(initialText));
    }
  }
private static Document createDocument(@NotNull String initialText, boolean viewer)