diff options
author | Greg Munn <gregm@microsoft.com> | 2019-08-09 20:43:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-09 20:43:47 +0300 |
commit | 58050151d2a4d306ada4d06bbcc1f2af997ae8a6 (patch) | |
tree | 1c96b96be4b67dd799f8527b4a3c196d8fc1c0c3 /main/src/addins/MonoDevelop.Refactoring | |
parent | 228cf2ab026e630f705f492a0fffa680f560ad00 (diff) | |
parent | 4f22f8787afb26d5e62c9d09d671cab127a29ca9 (diff) |
Merge pull request #8337 from mono/vsts-952602-save-severity-in-C#-source-anaysis
[Project Model] Save severity in C# code analysis
Diffstat (limited to 'main/src/addins/MonoDevelop.Refactoring')
-rw-r--r-- | main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/UI/GridOptionPreviewControl.cs | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/UI/GridOptionPreviewControl.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/UI/GridOptionPreviewControl.cs index b1c29c76d5..ecaa11eabb 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/UI/GridOptionPreviewControl.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/UI/GridOptionPreviewControl.cs @@ -58,8 +58,8 @@ namespace MonoDevelop.Refactoring.Options DataField<string> propertyNameField = new DataField<string> (); DataField<ItemCollection> propertiesField = new DataField<ItemCollection> (); - DataField<string> notificationPreferenceField = new DataField<string> (); - DataField<ItemCollection> notificationPreferencesField = new DataField<ItemCollection> (); + DataField<string> severityField = new DataField<string> (); + DataField<ItemCollection> severitiesField = new DataField<ItemCollection> (); TreeStore store; Xwt.TreeView treeView; @@ -74,7 +74,7 @@ namespace MonoDevelop.Refactoring.Options void CreateView () { - store = new TreeStore (itemField, descriptionField, propertyNameField, propertiesField, notificationPreferenceField, notificationPreferencesField); + store = new TreeStore (itemField, descriptionField, propertyNameField, propertiesField, severityField, severitiesField); treeView = new TreeView (store); treeView.SelectionChanged += (object sender, EventArgs e) => { @@ -101,7 +101,6 @@ namespace MonoDevelop.Refactoring.Options var item = treeNavigator.GetValue (itemField); if (item == null) return; - var text2 = treeNavigator.GetValue (propertyNameField); GLib.Timeout.Add (10, delegate { var text = treeNavigator.GetValue (propertyNameField); @@ -118,10 +117,30 @@ namespace MonoDevelop.Refactoring.Options col.Expands = true; treeView.Columns.Add (col); - var severityCellView = new ComboBoxCellView (notificationPreferenceField); + var severityCellView = new ComboBoxCellView (severityField); severityCellView.Editable = true; - severityCellView.ItemsField = notificationPreferencesField; + severityCellView.ItemsField = severitiesField; + severityCellView.SelectionChanged += delegate (object sender, WidgetEventArgs e) { + var treeNavigator = store.GetNavigatorAt (treeView.CurrentEventRow); + if (treeNavigator == null) + return; + var item = treeNavigator.GetValue (itemField); + if (item == null) + return; + + GLib.Timeout.Add (10, delegate { + var newSeverity = treeNavigator.GetValue (severityField); + foreach (var pref in item.NotificationPreferences) { + if (pref.Name == newSeverity) { + item.SelectedNotificationPreference = pref; + this.viewModel.SetOptionAndUpdatePreview (pref.Notification, item.Option, item.GetPreview ()); + } + } + return false; + }); + }; col = new ListViewColumn (GettextCatalog.GetString ("Severity"), severityCellView); + col.Expands = true; treeView.Columns.Add (col); this.PackStart (treeView, true, true); @@ -140,8 +159,8 @@ namespace MonoDevelop.Refactoring.Options groupNode.SetValue (itemField, null); groupNode.SetValue (propertyNameField, ""); groupNode.SetValue (propertiesField, new ItemCollection ()); - groupNode.SetValue (notificationPreferenceField, ""); - groupNode.SetValue (notificationPreferencesField, new ItemCollection ()); + groupNode.SetValue (severityField, ""); + groupNode.SetValue (severitiesField, new ItemCollection ()); groupNodes [item.GroupName] = groupNode; } @@ -154,11 +173,11 @@ namespace MonoDevelop.Refactoring.Options itemCollection.Add (pref.Name); childNode.SetValue (propertiesField, itemCollection); - childNode.SetValue (notificationPreferenceField, item.SelectedNotificationPreference.Name); + childNode.SetValue (severityField, item.SelectedNotificationPreference.Name); itemCollection = new ItemCollection (); foreach (var pref in item.NotificationPreferences) itemCollection.Add (pref.Name); - childNode.SetValue (notificationPreferencesField, itemCollection); + childNode.SetValue (severitiesField, itemCollection); groupNode.MoveToParent (); } treeView.ExpandAll (); |