Beispiel #1
0
        internal void UpdateColors(IEnumerable <CategoryItemDecorationSettings> changedItems)
        {
            if (_classificationFormatMapService == null || _registryService == null)
            {
                SatisfyImports();
            }
            if (_classificationFormatMap == null)
            {
                _classificationFormatMap = _classificationFormatMapService.GetClassificationFormatMap(_textView);
            }
            if (_T4Types == null)
            {
                _T4Types = _classificationFormatMap.CurrentPriorityOrder.Where(x => x?.Classification.Contains("T4") == true).ToList();
            }

            try
            {
                if (_classificationFormatMap.IsInBatchUpdate)
                {
                    return;
                }

                _classificationFormatMap.BeginBatchUpdate();

                foreach (CategoryItemDecorationSettings changedItem in changedItems)
                {
                    string classificationKey = changedItem.DisplayName;
                    IClassificationType classificationType = _T4Types.FirstOrDefault(x => x.Classification.Contains(classificationKey));
                    if (classificationType == null)
                    {
                        continue;
                    }

                    TextFormattingRunProperties textProperties = CreateTextProperties(changedItem);
                    _classificationFormatMap.SetExplicitTextProperties(classificationType, textProperties);
                }
            }
            catch (Exception)
            {
                //TO-DO: Log exception
            }
            finally
            {
                _classificationFormatMap.EndBatchUpdate();
            }
        }
Beispiel #2
0
 public void SetExplicitTextProperties(IClassificationType classificationType, TextFormattingRunProperties properties) =>
 categoryMap.SetExplicitTextProperties(classificationType, properties);