GlyphTextViewMarkerService(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextView wpfTextView) { if (glyphTextMarkerServiceImpl == null) { throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl)); } if (wpfTextView == null) { throw new ArgumentNullException(nameof(wpfTextView)); } this.onRemovedDelegate = OnRemoved; this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl; this.TextView = wpfTextView; this.markerLayer = wpfTextView.GetAdornmentLayer(PredefinedDnSpyAdornmentLayers.GlyphTextMarker); this.markerAndSpanCollection = new MarkerAndSpanCollection(); this.markerElements = new List <MarkerElement>(); this.editorFormatMap = glyphTextMarkerServiceImpl.EditorFormatMapService.GetEditorFormatMap(wpfTextView); this.glyphTextViewMarkerGlyphTagTagger = GlyphTextViewMarkerGlyphTagger.GetOrCreate(this); this.glyphTextViewMarkerGlyphTextMarkerTagTagger = GlyphTextViewMarkerGlyphTextMarkerTagger.GetOrCreate(this); this.glyphTextViewMarkerClassificationTagTagger = GlyphTextViewMarkerClassificationTagger.GetOrCreate(this); this.useReducedOpacityForHighContrast = wpfTextView.Options.GetOptionValue(DefaultWpfViewOptions.UseReducedOpacityForHighContrastOptionId); wpfTextView.Closed += WpfTextView_Closed; wpfTextView.LayoutChanged += WpfTextView_LayoutChanged; wpfTextView.Options.OptionChanged += Options_OptionChanged; glyphTextMarkerServiceImpl.MarkerAdded += GlyphTextMarkerServiceImpl_MarkerAdded; glyphTextMarkerServiceImpl.MarkerRemoved += GlyphTextMarkerServiceImpl_MarkerRemoved; glyphTextMarkerServiceImpl.MarkersRemoved += GlyphTextMarkerServiceImpl_MarkersRemoved; editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged; }
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>); }