public static GlyphTextViewMarkerClassificationTagger GetOrCreate(GlyphTextViewMarkerService service) { if (service == null) { throw new ArgumentNullException(nameof(service)); } return(service.TextView.TextBuffer.Properties.GetOrCreateSingletonProperty(typeof(GlyphTextViewMarkerClassificationTagger), () => new GlyphTextViewMarkerClassificationTagger(service))); }
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 void SetDotNetSpanMap(ITextView textView, IDotNetSpanMap?map) { if (textView is null) { throw new ArgumentNullException(nameof(textView)); } var service = GlyphTextViewMarkerService.TryGet(textView); Debug.Assert(!(service is null)); service?.SetDotNetSpanMap(map); }
public void SetMethodOffsetSpanMap(ITextView textView, IMethodOffsetSpanMap map) { if (textView == null) { throw new ArgumentNullException(nameof(textView)); } var service = GlyphTextViewMarkerService.TryGet(textView); Debug.Assert(service != null); service?.SetMethodOffsetSpanMap(map); }
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); }
public static GlyphTextViewMarkerService GetOrCreate(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextView wpfTextView) { if (glyphTextMarkerServiceImpl == null) { throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl)); } if (wpfTextView == null) { throw new ArgumentNullException(nameof(wpfTextView)); } if (wpfTextView.TextBuffer.Properties.TryGetProperty(typeof(GlyphTextViewMarkerService), out GlyphTextViewMarkerService service)) { return(service); } service = new GlyphTextViewMarkerService(glyphTextMarkerServiceImpl, wpfTextView); wpfTextView.TextBuffer.Properties.AddProperty(typeof(GlyphTextViewMarkerService), service); service.Initialize(); return(service); }
public GlyphTextViewMarkerClassificationTagger(GlyphTextViewMarkerService service) { this.service = service; }
public MarkerAndSpanCollection(GlyphTextViewMarkerService owner) { allMarkers = new List <IGlyphTextMarkerImpl>(); inDocMarkers = new Dictionary <IGlyphTextMarkerImpl, Span>(); this.owner = owner; }
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)); glyphTextViewMarkerService = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, wpfTextViewHost.TextView); this.wpfTextViewHost = wpfTextViewHost; this.margin = margin; toolTipDispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, margin.VisualElement.Dispatcher); 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); } glyphTextMarkerMouseProcessors = list.ToArray(); wpfTextViewHost.TextView.Closed += TextView_Closed; wpfTextViewHost.TextView.LayoutChanged += TextView_LayoutChanged; toolTipDispatcherTimer.Tick += ToolTipDispatcherTimer_Tick; popup.Closed += Popup_Closed; glyphTextViewMarkerService.AddGlyphTextMarkerListener(this); }
public GlyphTextViewMarkerGlyphTextMarkerTagger(GlyphTextViewMarkerService service) { this.service = service; }
public GlyphTextViewMarkerGlyphFactory(GlyphTextViewMarkerService service) { this.service = service; }
public MarkerAndSpanCollection(GlyphTextViewMarkerService owner) { allMarkers = new List<IGlyphTextMarkerImpl>(); inDocMarkers = new Dictionary<IGlyphTextMarkerImpl, Span>(); this.owner = owner; }
public static GlyphTextViewMarkerService GetOrCreate(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextView wpfTextView) { if (glyphTextMarkerServiceImpl == null) throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl)); if (wpfTextView == null) throw new ArgumentNullException(nameof(wpfTextView)); GlyphTextViewMarkerService service; if (wpfTextView.TextBuffer.Properties.TryGetProperty(typeof(GlyphTextViewMarkerService), out service)) return service; service = new GlyphTextViewMarkerService(glyphTextMarkerServiceImpl, wpfTextView); wpfTextView.TextBuffer.Properties.AddProperty(typeof(GlyphTextViewMarkerService), service); service.Initialize(); return service; }