private void UpdateNewlineSetting(WhitespaceListItem item)
        {
            int value = _settingsStore.GetIndexedValue <ReflowAndRetagSettings, string, int>(x => x.WhitespaceNewlineSettings,
                                                                                             item.Key + "OnNewLine");

            if (item.Newlines != value)
            {
                _settingsStore.SetIndexedValue <ReflowAndRetagSettings, string, int>(x => x.WhitespaceNewlineSettings,
                                                                                     item.Key + "OnNewLine",
                                                                                     item.Newlines);
            }
        }
        /// <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)
        {
            JetBrains.DataFlow.LifetimeDefinition definition = JetBrains.DataFlow.Lifetimes.Define(solution.GetLifetime());
            JetBrains.DataFlow.Lifetime           lifetime   = definition.Lifetime;
            try
            {
                unsafe
                {
                    ChangeInspectionSeverityDialog dialog = new ChangeInspectionSeverityDialog(lifetime, this.commonIconsComponent);
                    IContextBoundSettingsStore     contextBoundSettingsStore =
                        this.settingsStore.BindToContextTransient(ContextRange.Smart(textControl.Document.ToDataContext()));
                    ConfigurableSeverityItem item = this.highlightingSettingsManager.GetSeverityItem(this.HighlightID);

                    dialog.Severity             = this.highlightingSettingsManager.GetConfigurableSeverity(this.HighlightID, solution);
                    dialog.SeverityOptionsTitle = string.Format(item.FullTitle + ":");
                    dialog.CanBeError           = !item.SolutionAnalysisRequired;

                    if (dialog.ShowDialog(User32Dll.GetForegroundWindow()) == true)
                    {
                        IContextBoundSettingsStore store = contextBoundSettingsStore;
                        if (dialog.SelectedSettingsLayer != null)
                        {
                            store = dialog.SelectedSettingsLayer.Model.SettingsStoreContext;
                        }

                        store.SetIndexedValue(HighlightingSettingsAccessor.InspectionSeverities, this.HighlightID, dialog.Severity);
                    }
                }
            }
            finally
            {
                definition.Terminate();
            }
        }
示例#3
0
        /// <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())
            {
                ////var settings = HighlightingSettingsManager.Instance.Settings.Clone();

                ////var 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();
                ////}
                IContextBoundSettingsStore settingsStore             = PsiSourceFileExtensions.GetSettingsStore(null, solution);
                IContextBoundSettingsStore contextBoundSettingsStore =
                    settingsStore.SettingsStore.BindToContextTransient(ContextRange.Smart(textControl.Document.ToDataContext()));
                HighlightingSettingsManager settingsManager = HighlightingSettingsManager.Instance;
                HighlightingSettingsManager.ConfigurableSeverityItem item = settingsManager.GetSeverityItem(this.HighlightID);
                dialog.Severity   = settingsManager.GetConfigurableSeverity(this.HighlightID, solution);
                dialog.Text       = string.Format("Inspection Options for \"{0}\"", item.FullTitle);
                dialog.CanBeError = !item.SolutionAnalysisRequired;
                if (dialog.ShowDialog(Shell.Instance.GetComponent <UIApplication>().MainWindow) == DialogResult.OK)
                {
                    contextBoundSettingsStore.SetIndexedValue(HighlightingSettingsAccessor.InspectionSeverities, this.HighlightID, dialog.Severity);
                }
            }
        }
        public static IEnumerable <string> GetAdditionalConfigurationFiles(
            this IContextBoundSettingsStore optionsContext,
            string solutionId)
        {
            var customConfigurationFilesJson = optionsContext.GetIndexedValue(
                ConfigurationSenseSettingsAccessor.CustomConfigurationFiles,
                solutionId);

            if (string.IsNullOrEmpty(customConfigurationFilesJson))
            {
                return(Enumerable.Empty <string>());
            }

            try
            {
                return(JsonConvert.DeserializeObject <HashSet <string> >(customConfigurationFilesJson));
            }
            // ReSharper disable once CatchAllClause
            catch (Exception)
            {
                optionsContext.SetIndexedValue(
                    ConfigurationSenseSettingsAccessor.CustomConfigurationFiles,
                    solutionId,
                    string.Empty);
                return(Enumerable.Empty <string>());
            }
        }
示例#5
0
        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);
        }
        private static void SetUnitySerializedFieldRule(IContextBoundSettingsStore settingsStore,
                                                        SettingsIndexedEntry entry, ClrUserDefinedNamingRule userRule)
        {
            settingsStore.SetIndexedValue(entry, UnityNamingRuleDefaultSettings.SerializedFieldRuleGuid, null,
                                          userRule);
#endif
        }
 public static void SaveCustomConfigurationFiles(
     this IContextBoundSettingsStore optionsContext,
     string solutionId,
     IEnumerable <string> customConfigurationFiles)
 {
     optionsContext.SetIndexedValue(
         ConfigurationSenseSettingsAccessor.CustomConfigurationFiles,
         solutionId,
         JsonConvert.SerializeObject(customConfigurationFiles));
 }
示例#8
0
        /// <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)
        {
            LifetimeDefinition definition = Lifetime.Define(solution.GetLifetime());
            Lifetime           lifetime   = definition.Lifetime;

            try
            {
                unsafe
                {
                    ChangeInspectionSeverityDialog dialog = new ChangeInspectionSeverityDialog(lifetime);
                    IContextBoundSettingsStore     contextBoundSettingsStore =
                        this.settingsStore.BindToContextTransient(ContextRange.Smart(textControl.Document.ToDataContext()));
                    var item = this.highlightingSettingsManager.GetSeverityItem(this.HighlightID).Unwrap();

                    dialog.Severity = this.highlightingSettingsManager.GetConfigurableSeverity(
                        this.HighlightID,
                        sourceFile: null,
                        storeBoundToSourceFile: contextBoundSettingsStore);
                    dialog.SeverityOptionsTitle = string.Format(item.FullTitle + ":");
                    dialog.CanBeError           = !item.SolutionAnalysisRequired;

                    if (dialog.ShowDialog() == true)
                    {
                        IContextBoundSettingsStore store = contextBoundSettingsStore;
                        if (dialog.SelectedSettingsLayer != null)
                        {
                            store = dialog.SelectedSettingsLayer.Model.SettingsStoreContext;
                        }

                        store.SetIndexedValue(HighlightingSettingsAccessor.InspectionSeverities, this.HighlightID, dialog.Severity);
                    }
                }
            }
            finally
            {
                definition.Terminate();
            }
        }
示例#9
0
 protected override void MutateSettings(IContextBoundSettingsStore settingsStore)
 {
     settingsStore.SetIndexedValue((AsyncConverterConfigureAwaitSettings s) => s.ConfigureAwaitIgnoreAttributeTypes, "MyCustomAttribute", "AsyncConverter.Tests.Test.Data.Highlightings.ConfigureAwaitWithAttribute.MyCustomAttribute");
 }