Пример #1
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);
                }
            }
        }
Пример #2
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())
            {
                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();
                }
            }
        }
        /// <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);
                }
            }
        }
        /// <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();
                }
            }
        }