diff options
author | therzok <marius.ungureanu@xamarin.com> | 2018-10-19 17:18:51 +0300 |
---|---|---|
committer | therzok <marius.ungureanu@xamarin.com> | 2019-01-29 14:30:34 +0300 |
commit | 4d33414fa9d25a8ceb0780882a7408c726614945 (patch) | |
tree | e6c1cbe5a15969880657f97577bd24a2710db090 /main/src/tools | |
parent | a73e621b1c1cdb5946f43ad9aeeb1d768ac89dba (diff) |
Make widgets scoped to a given set of addin assemblies
Diffstat (limited to 'main/src/tools')
-rw-r--r-- | main/src/tools/ExtensionTools/AddinDependencyTreeWidget.cs | 14 | ||||
-rw-r--r-- | main/src/tools/ExtensionTools/AddinListWidget.cs | 10 | ||||
-rw-r--r-- | main/src/tools/ExtensionTools/ExtensionPointsWidget.cs | 13 |
3 files changed, 20 insertions, 17 deletions
diff --git a/main/src/tools/ExtensionTools/AddinDependencyTreeWidget.cs b/main/src/tools/ExtensionTools/AddinDependencyTreeWidget.cs index 4a74bb0c0c..311f852b83 100644 --- a/main/src/tools/ExtensionTools/AddinDependencyTreeWidget.cs +++ b/main/src/tools/ExtensionTools/AddinDependencyTreeWidget.cs @@ -37,15 +37,17 @@ namespace MonoDevelop.ExtensionTools readonly DataField<string> labelField = new DataField<string> (); readonly Label summary = new Label (); - public AddinDependencyTreeWidget () + public AddinDependencyTreeWidget (Addin[] addins = null) { + addins = addins ?? AddinManager.Registry.GetAllAddins (); + treeStore = new TreeStore (labelField); treeView = new TreeView (treeStore); var col = treeView.Columns.Add ("Name", labelField); col.Expands = true; - FillData (); + FillData (addins); treeView.ExpandAll (); var vbox = new VBox (); @@ -54,9 +56,9 @@ namespace MonoDevelop.ExtensionTools Content = vbox; } - void FillData() + void FillData(Addin[] addins) { - var roots = MakeDependencyTree (); + var roots = MakeDependencyTree (addins); var node = treeStore.AddNode (); node.SetValue (labelField, "Root"); @@ -83,12 +85,12 @@ namespace MonoDevelop.ExtensionTools return maxDepth; } - List<AddinNode> MakeDependencyTree () + List<AddinNode> MakeDependencyTree (Addin[] addins) { var cache = new Dictionary<Addin, AddinNode> (); var roots = new List<AddinNode> (); - foreach (var addin in AddinManager.Registry.GetAllAddins ()) { + foreach (var addin in addins) { var addinNode = GetOrCreateNode (addin); if (addin.Description.IsRoot) diff --git a/main/src/tools/ExtensionTools/AddinListWidget.cs b/main/src/tools/ExtensionTools/AddinListWidget.cs index 677518cdc0..30ae72e5c5 100644 --- a/main/src/tools/ExtensionTools/AddinListWidget.cs +++ b/main/src/tools/ExtensionTools/AddinListWidget.cs @@ -36,13 +36,15 @@ namespace MonoDevelop.ExtensionTools readonly DataField<string> labelField = new DataField<string> (); readonly Label summary = new Label (); - public AddinListWidget () + public AddinListWidget (Addin[] addins = null) { + addins = addins ?? AddinManager.Registry.GetAllAddins (x => x.Name); + listStore = new ListStore (labelField); listView = new ListView (listStore); listView.Columns.Add ("Name", labelField); - FillData (); + FillData (addins); var vbox = new VBox (); vbox.PackStart (summary, false); @@ -50,10 +52,8 @@ namespace MonoDevelop.ExtensionTools Content = vbox; } - void FillData () + void FillData (Addin[] addins) { - var addins = AddinManager.Registry.GetAllAddins (x => x.Name); - summary.Text = $"Count: {addins.Length}"; foreach (var addin in addins) { diff --git a/main/src/tools/ExtensionTools/ExtensionPointsWidget.cs b/main/src/tools/ExtensionTools/ExtensionPointsWidget.cs index 6207b1061c..0dce589566 100644 --- a/main/src/tools/ExtensionTools/ExtensionPointsWidget.cs +++ b/main/src/tools/ExtensionTools/ExtensionPointsWidget.cs @@ -38,13 +38,15 @@ namespace MonoDevelop.ExtensionTools readonly DataField<string> labelField = new DataField<string> (); readonly Label summary = new Label (); - public ExtensionPointsWidget () + public ExtensionPointsWidget (Addin[] addins = null) { + addins = addins ?? AddinManager.Registry.GetAllAddins (); + listStore = new ListStore (labelField); listView = new ListView (listStore); listView.Columns.Add ("Name", labelField); - FillData (); + FillData (addins); var vbox = new VBox (); vbox.PackStart (summary, false); @@ -52,9 +54,9 @@ namespace MonoDevelop.ExtensionTools Content = vbox; } - void FillData () + void FillData (Addin[] addins) { - var points = GatherExtensionPoints (); + var points = GatherExtensionPoints (addins); summary.Text = $"Count: {points.Length}"; @@ -65,10 +67,9 @@ namespace MonoDevelop.ExtensionTools // TODO: clicking a node should open extension objects } - string[] GatherExtensionPoints () + string[] GatherExtensionPoints (Addin[] addins) { var points = new HashSet<string> (); - var addins = AddinManager.Registry.GetAllAddins (); foreach (var addin in addins) { foreach (ExtensionPoint extensionPoint in addin.Description.ExtensionPoints) { |