Esempio n. 1
0
        protected override void OnInvoke(object sender, EventArgs e)
        {
            base.OnInvoke(sender, e);
            ITextSelection selection = TextEditor.GetCurrentSelection();

            if (selection != null)
            {
                if (selection.Mode == TextSelectionMode.Box)
                {
                    // not supported, ignore for now;
                    return;
                }
                // in many cases, the buffer at the top of the
                // buffer graph will be a projection buffer, which
                // is problematic for the ASPX editor. Instead
                // look for the first, non-projection buffer
                // on the graph and project on it.
                ITextView    view = selection.TextView;
                SnapshotSpan?span = TextEditor.MapSelectionToPrimaryBuffer(selection);
                //SnapshotSpan? span = selection.StreamSelectionSpan.SnapshotSpan;
                if (span != null)
                {
                    AddOutlining(span.Value.Snapshot.TextBuffer, span.Value);
                    var oc = OutliningController.Get(view);
                    if (oc != null)
                    {
                        oc.CollapseRegion(span.Value);
                    }
                }
            }
        }
Esempio n. 2
0
        public bool Handle(ITextView view)
        {
            var selection = view.Selection;

            if (selection != null)
            {
                if (selection.Mode == TextSelectionMode.Box)
                {
                    // not supported, ignore for now;
                    return(false);
                }
                // in many cases, the buffer at the top of the
                // buffer graph will be a projection buffer, which
                // is problematic for the ASPX editor. Instead
                // look for the first, non-projection buffer
                // on the graph and project on it.
                SnapshotSpan?span = TextEditor.MapSelectionToPrimaryBuffer(selection);
                //SnapshotSpan? span = selection.StreamSelectionSpan.SnapshotSpan;
                if (span != null)
                {
                    AddOutlining(span.Value.Snapshot.TextBuffer, span.Value);
                    var oc = OutliningController.Get(view);
                    if (oc != null)
                    {
                        oc.CollapseRegion(span.Value);
                    }
                    return(true);
                }
            }
            return(false);
        }
        private void CollapseOutlines(ITextView textView)
        {
            var controller = OutliningController.Get(textView);

            if (controller != null)
            {
                controller.CollapseSelectionRegions();
            }
        }
Esempio n. 4
0
        private void ClearOutlines(ITextView view)
        {
            var controller = OutliningController.Get(view);

            if (controller != null)
            {
                controller.RemoveSelectionRegions();
            }
        }
        private void ClearOutlines()
        {
            var view       = TextEditor.GetCurrentView();
            var controller = OutliningController.Get(view);

            if (controller != null)
            {
                controller.RemoveSelectionRegions();
            }
        }