diff options
author | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
commit | 95408b1a41b31b645f3a8c3323ab7d3ca4bff26b (patch) | |
tree | f8f137cddcb9a40499d303be95722fd2c6081bce /main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs | |
parent | b70e4e04b4e41b8ec28d7e4b220b401ecf467e7a (diff) | |
parent | de043d330a8bf5855d4d983c804cd36727cb2406 (diff) |
Merge remote-tracking branch 'origin/roslyn' into new-project-model
Diffstat (limited to 'main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs')
-rw-r--r-- | main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs index 66f132a1c5..c74d775caa 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionPanelWidget.cs @@ -32,6 +32,7 @@ using System.Text; using MonoDevelop.Refactoring; using System.Collections.Generic; using GLib; +using MonoDevelop.CodeIssues; namespace MonoDevelop.CodeActions { @@ -54,14 +55,14 @@ namespace MonoDevelop.CodeActions { readonly string mimeType; - readonly TreeStore treeStore = new TreeStore (typeof(string), typeof(bool), typeof(CodeActionProvider), typeof(string)); - readonly Dictionary<CodeActionProvider, bool> providerStates = new Dictionary<CodeActionProvider, bool> (); + readonly TreeStore treeStore = new TreeStore (typeof(string), typeof(bool), typeof(CodeRefactoringDescriptor)); + readonly Dictionary<CodeRefactoringDescriptor, bool> providerStates = new Dictionary<CodeRefactoringDescriptor, bool> (); void GetAllProviderStates () { - string disabledNodes = PropertyService.Get ("ContextActions." + mimeType, ""); - foreach (var node in RefactoringService.ContextAddinNodes.Where (n => n.MimeType == mimeType)) { - providerStates [node] = disabledNodes.IndexOf (node.IdString, StringComparison.Ordinal) < 0; + var language = CodeRefactoringService.MimeTypeToLanguage (mimeType); + foreach (var node in BuiltInCodeDiagnosticProvider.GetBuiltInCodeRefactoringDescriptorsAsync (CodeRefactoringService.MimeTypeToLanguage(language), true).Result) { + providerStates [node] = node.IsEnabled; } } @@ -94,7 +95,7 @@ namespace MonoDevelop.CodeActions TreeIter iter; if (!treeStore.GetIterFromString (out iter, args.Path)) return; - var provider = (CodeActionProvider)treeStore.GetValue (iter, 2); + var provider = (CodeRefactoringDescriptor)treeStore.GetValue (iter, 2); providerStates [provider] = !providerStates [provider]; treeStore.SetValue (iter, 1, providerStates [provider]); }; @@ -125,26 +126,20 @@ namespace MonoDevelop.CodeActions { treeStore.Clear (); var sortedAndFiltered = providerStates.Keys - .Where (node => string.IsNullOrEmpty (filter) || node.Title.IndexOf (filter, StringComparison.OrdinalIgnoreCase) > 0) - .OrderBy (n => n.Title, StringComparer.Ordinal); + .Where (node => string.IsNullOrEmpty (filter) || node.Name.IndexOf (filter, StringComparison.OrdinalIgnoreCase) > 0) + .OrderBy (n => n.Name, StringComparer.Ordinal); foreach (var node in sortedAndFiltered) { - var title = node.Title; + var title = node.Name; MonoDevelop.CodeIssues.CodeIssuePanelWidget.MarkupSearchResult (filter, ref title); - treeStore.AppendValues (title, providerStates [node], node, node.Description); + treeStore.AppendValues (title, providerStates [node], node); } } public void ApplyChanges () { - var sb = new StringBuilder (); foreach (var kv in providerStates) { - if (kv.Value) - continue; - if (sb.Length > 0) - sb.Append (","); - sb.Append (kv.Key.IdString); + kv.Key.IsEnabled = kv.Value; } - PropertyService.Set ("ContextActions." + mimeType, sb.ToString ()); } } } |