public IGlyphFactory GetGlyphFactory(IWpfTextView view, IWpfTextViewMargin margin) { if (!view.Roles.ContainsAny(textViewRoles)) { return(null); } var service = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, view); return(new GlyphTextViewMarkerGlyphFactory(service)); }
public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag { var wpfTextView = textView as IWpfTextView; Debug.Assert(wpfTextView != null); if (wpfTextView == null) { return(null); } if (textView.TextBuffer != buffer) { return(null); } var service = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, wpfTextView); return(GlyphTextViewMarkerClassificationTagger.GetOrCreate(service) as ITagger <T>); }
public GlyphTextMarkerServiceMouseProcessor(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin) { if (glyphTextMarkerServiceImpl == null) { throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl)); } if (wpfTextViewHost == null) { throw new ArgumentNullException(nameof(wpfTextViewHost)); } if (margin == null) { throw new ArgumentNullException(nameof(margin)); } this.glyphTextViewMarkerService = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, wpfTextViewHost.TextView); this.wpfTextViewHost = wpfTextViewHost; this.margin = margin; this.toolTipDispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, margin.VisualElement.Dispatcher); this.popup = new Popup { AllowsTransparency = true }; var list = new List <IGlyphTextMarkerMouseProcessor>(); foreach (var lazy in glyphTextMarkerServiceImpl.GlyphTextMarkerMouseProcessorProviders) { if (lazy.Metadata.TextViewRoles != null && !wpfTextViewHost.TextView.Roles.ContainsAny(lazy.Metadata.TextViewRoles)) { continue; } var mouseProcessor = lazy.Value.GetAssociatedMouseProcessor(wpfTextViewHost, margin); if (mouseProcessor != null) { list.Add(mouseProcessor); } } this.glyphTextMarkerMouseProcessors = list.ToArray(); wpfTextViewHost.TextView.Closed += TextView_Closed; wpfTextViewHost.TextView.LayoutChanged += TextView_LayoutChanged; toolTipDispatcherTimer.Tick += ToolTipDispatcherTimer_Tick; popup.Closed += Popup_Closed; glyphTextViewMarkerService.AddGlyphTextMarkerListener(this); }