protected override void OnBeforeQueryStatus(object sender, EventArgs e) { base.OnBeforeQueryStatus(sender, e); ITextView view = TextEditor.GetCurrentView(); if (view == null) { return; } ITextCaret caret = view.Caret; if (caret == null) { return; } var point = TextEditor.MapCaretToPrimaryBuffer(view); //SnapshotPoint? point = caret.Position.BufferPosition; if (point != null) { IUserOutlining outlining = OutliningManager.Get(point.Value.Snapshot.TextBuffer); Command.Enabled = outlining.IsInOutliningRegion(point.Value); } }
protected override void OnInvoke(object sender, EventArgs e) { base.OnInvoke(sender, e); ITextView view = TextEditor.GetCurrentView(); if (view == null) { return; } ITextCaret caret = view.Caret; if (caret == null) { return; } var point = TextEditor.MapCaretToPrimaryBuffer(view); //SnapshotPoint? point = caret.Position.BufferPosition; if (point != null) { IUserOutlining outlining = OutliningManager.Get(point.Value.Snapshot.TextBuffer); outlining.RemoveAt(point.Value); } }
private IUserOutlining GetOutlining(out ITextBuffer buffer) { buffer = null; ITextView view = TextEditor.GetCurrentView(); if (view != null) { buffer = TextEditor.GetPrimaryBuffer(view); //buffer = view.TextBuffer; return(OutliningManager.Get(buffer)); } return(null); }
private void AddOutlining(ITextBuffer buffer, SnapshotSpan span) { var outlines = OutliningManager.Get(buffer); outlines.Add(span); }