public void Execute(ISolution solution, ITextControl textControl) { ISettingsStore store = Shell.Instance.GetComponent <ISettingsStore>(); // Get the dictionary CustomDictionary dictionary = _settingsStore.GetIndexedValue <CustomDictionarySettings, string, CustomDictionary>( settings => settings.CustomDictionaries, _dictName); if (dictionary == null) { dictionary = new CustomDictionary() { Name = _dictName } } ; string words = dictionary.DecodedUserWords.Trim(); if (words.Length > 0) { dictionary.DecodedUserWords = words + "\n"; } dictionary.DecodedUserWords += _word; IContextBoundSettingsStore boundStore = store.BindToContextTransient(ContextRange.ApplicationWide); boundStore.SetIndexedValue <CustomDictionarySettings, string, CustomDictionary>(x => x.CustomDictionaries, _dictName, dictionary); SpellCheckManager.Reset(); // Clear the cache. solution.SaveSettings(); Daemon.GetInstance(solution).ForceReHighlight(_documentRange.Document); }
/// <summary> /// Performs the QuickFix, inserts the configured modifier into the location specified by /// the violation. /// </summary> /// <param name="solution"> /// Current Solution. /// </param> /// <param name="textControl"> /// Current Text Control to modify. /// </param> public void Execute(ISolution solution, ITextControl textControl) { using (ChangeSeverityDialog dialog = new ChangeSeverityDialog()) { HighlightingSettings settings = HighlightingSettingsManager.Instance.Settings.Clone(); HighlightingSettingsManager.ConfigurableSeverityItem severityItem = HighlightingSettingsManager.Instance.GetSeverityItem(this.HighlightID); dialog.Severity = settings.GetSeverity(this.HighlightID); dialog.Text = "Inspection options for \"" + severityItem.Title + "\""; if (dialog.ShowDialog(Shell.Instance.GetComponent <UIApplication>().MainWindow) == DialogResult.OK) { settings.SetSeverity(this.HighlightID, dialog.Severity); HighlightingSettingsManager.Instance.Settings = settings; Daemon.GetInstance(solution).Invalidate(); } } }