public CodeBackgroundTextAdornment( IWpfTextView view, IClassificationFormatMapService classificationFormatMapService, IClassificationTypeRegistryService classificationTypeRegistry, ICoreShell coreShell) { _view = view; _layer = view.GetAdornmentLayer("CodeBackgroundTextAdornment"); _classificationTypeRegistry = classificationTypeRegistry; _classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(view); _coreShell = coreShell; // Advise to events _classificationFormatMap.ClassificationFormatMappingChanged += OnClassificationFormatMappingChanged; _view.LayoutChanged += OnLayoutChanged; _view.Closed += OnClosed; var projectionBufferManager = ServiceManager.GetService <IProjectionBufferManager>(view.TextBuffer); if (projectionBufferManager != null) { projectionBufferManager.MappingsChanged += OnMappingsChanged; _contanedLanguageHandler = ServiceManager.GetService <IContainedLanguageHandler>(projectionBufferManager.DiskBuffer); if (_contanedLanguageHandler == null) { ServiceManager.AdviseServiceAdded <IContainedLanguageHandler>(projectionBufferManager.DiskBuffer, _coreShell, (s) => _contanedLanguageHandler = s); } } FetchColors(); }
public CodeBackgroundTextAdornment(IWpfTextView view, IClassificationFormatMapService classificationFormatMapService, IClassificationTypeRegistryService classificationTypeRegistry) { _view = view; _layer = view.GetAdornmentLayer("CodeBackgroundTextAdornment"); _classificationTypeRegistry = classificationTypeRegistry; _classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(view); // Advise to events _classificationFormatMap.ClassificationFormatMappingChanged += OnClassificationFormatMappingChanged; _view.LayoutChanged += OnLayoutChanged; _view.Closed += OnClosed; var projectionBufferManager = ServiceManager.GetService<IProjectionBufferManager>(view.TextBuffer); if (projectionBufferManager != null) { projectionBufferManager.MappingsChanged += OnMappingsChanged; _contanedLanguageHandler = ServiceManager.GetService<IContainedLanguageHandler>(projectionBufferManager.DiskBuffer); } FetchColors(); }