/// <summary> /// Creates a new document and loads the given file /// </summary> public IDocument CreateFromTextBuffer(ITextBufferStrategy textBuffer) { DefaultDocument doc = (DefaultDocument)CreateDocument(); doc.TextContent = textBuffer.GetText(0, textBuffer.Length); doc.TextBufferStrategy = textBuffer; return(doc); }
/// <remarks> /// Creates a new <see cref="IDocument"/> object. Only create /// <see cref="IDocument"/> with this method. /// </remarks> public IDocument CreateDocument() { DefaultDocument doc = new DefaultDocument(); doc.TextBufferStrategy = new GapTextBufferStrategy(); doc.FormattingStrategy = new DefaultFormattingStrategy(); doc.LineManager = new LineManager.LineManager(doc, null); doc.FoldingManager = new FoldingManager(doc, doc.LineManager); doc.FoldingManager.FoldingStrategy = null; //new ParserFoldingStrategy(); doc.MarkerStrategy = new MarkerStrategy.MarkerStrategy(doc); doc.BookmarkManager = new BookmarkManager.BookmarkManager(doc, doc.LineManager); return(doc); }