internal NumberedBookmarkTagger(ITextBuffer buffer)
        {
            m_buffer = buffer;
            NumberedBookmarksManager manager = NumberedBookmarksManager.GetBookmarkManager(m_buffer);

            manager.BookmarksChanged += new EventHandler <NumberedBookmarksManagerEventArgs>(manager_BookmarksChanged);
        }
Exemple #2
0
        internal static void Clear(ConcurrentDictionary <int, Bookmark> dico)
        {
            if (dico == null)
            {
                dico = _dico;
            }
            var bmks = dico.Values.ToArray();

            dico.Clear();
            foreach (var bmk in bmks)
            {
                NumberedBookmarksManager.GetBookmarkManager(bmk.Buffer).DoBookmarksChanged(-1, bmk.Line);
            }
        }
 void Instance_OnGotoBookmark(int bookmarkId)
 {
     try
     {
         if (this.wpfTextView.VisualElement == null || !this.wpfTextView.VisualElement.IsFocused)
         {
             System.Diagnostics.Debug.WriteLine("view has not focus");
             return;
         }
         var manager = NumberedBookmarksManager.GetBookmarkManager(this.wpfTextView);
         manager.GotoBookmark(this.wpfTextView, bookmarkId);
     }
     catch (Exception ex)
     {
         NumberedBookmarksPackage.Instance.WriteError(ex);
     }
 }
        IEnumerable <ITagSpan <NumberedBookmarkTag> > ITagger <NumberedBookmarkTag> .GetTags(NormalizedSnapshotSpanCollection spans)
        {
            NumberedBookmarksManager manager = NumberedBookmarksManager.GetBookmarkManager(m_buffer);

            if (manager != null)
            {
                foreach (SnapshotSpan span in spans)
                {
                    //var line = span.Start.GetContainingLine().LineNumber;
                    if (manager.GetNumber(span.Start).Any())
                    {
                        yield return(new TagSpan <NumberedBookmarkTag>(new SnapshotSpan(span.Start, 1), new NumberedBookmarkTag {
                            Numbers = manager.GetNumber(span.Start).ToArray()
                        }));
                    }
                }
            }
        }
Exemple #5
0
        void generalPage_OnCommit(object sender, EventArgs e)
        {
            NumberedBookmarksOptions options = sender as NumberedBookmarksOptions;

            if (options.Options.UseBoomarkAcrossDocument != this.IsAcrossDocuments)
            {
                var oldValue = this.IsAcrossDocuments;
                this.IsAcrossDocuments = options.Options.UseBoomarkAcrossDocument;
                if (oldValue)
                {
                    NumberedBookmarksGlobalManager.Clear(null);
                }
                else
                {
                    //todo on every documents
                    foreach (var buffer in DocumentUtilities.OpenedBuffers(this.DTE))
                    {
                        NumberedBookmarksManager.GetBookmarkManager(buffer).Clear();
                    }
                }
            }
        }