public FoldingManagerInstallation(TextArea textArea) : base(textArea.Document) { this.textArea = textArea; margin = new FoldingMargin() { FoldingManager = this }; generator = new FoldingElementGenerator() { FoldingManager = this }; textArea.LeftMargins.Add(margin); textArea.TextView.Services.AddService(typeof(FoldingManager), this); // HACK: folding only works correctly when it has highest priority textArea.TextView.ElementGenerators.Insert(0, generator); textArea.Caret.PositionChanged += textArea_Caret_PositionChanged; }
public void Uninstall() { Clear(); if (textArea != null) { textArea.Caret.PositionChanged -= textArea_Caret_PositionChanged; textArea.LeftMargins.Remove(margin); textArea.TextView.ElementGenerators.Remove(generator); textArea.TextView.Services.RemoveService(typeof(FoldingManager)); margin = null; generator = null; textArea = null; } }
public FoldingManagerInstallation(TextArea textArea) : base(textArea.TextView, textArea.Document) { this.textArea = textArea; margin = new FoldingMargin() { FoldingManager = this }; generator = new FoldingElementGenerator() { FoldingManager = this }; textArea.LeftMargins.Add(margin); textArea.TextView.ElementGenerators.Add(generator); textArea.Caret.PositionChanged += textArea_Caret_PositionChanged; }