diff options
author | iain holmes <iain@xamarin.com> | 2016-11-22 19:30:16 +0300 |
---|---|---|
committer | iain holmes <iain@xamarin.com> | 2016-11-22 19:30:16 +0300 |
commit | bfb582a762eff5c0e3c7d6ee342683b087a4b530 (patch) | |
tree | e15569ee3251f7bbf6d4466bb797bfcd38f4230f /main/src/core/MonoDevelop.Ide | |
parent | dfc16db5698a1314058f4b880176ea13999274f8 (diff) |
[A11y] Add some diagnostic commands for dumping UI/A11y trees
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
3 files changed, 49 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/Commands.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/Commands.addin.xml index bbd8721a7a..42e762e8e6 100644 --- a/main/src/core/MonoDevelop.Ide/ExtensionModel/Commands.addin.xml +++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/Commands.addin.xml @@ -819,6 +819,12 @@ _label = "Send Feedback" icon = "md-feedback" _description = "Send feedback to the MonoDevelop development team" /> + <Command id = "MonoDevelop.Ide.Commands.HelpCommands.DumpUITree" + defaultHandler = "MonoDevelop.Ide.Commands.DumpUITreeHandler" + _label = "Dump UI Tree" /> + <Command id = "MonoDevelop.Ide.Commands.HelpCommands.DumpA11yTree" + defaultHandler = "MonoDevelop.Ide.Commands.DumpA11yTreeHandler" + _label = "Dump Accessibility Tree" /> </Category> <!-- SearchCommands --> diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/MainMenu.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/MainMenu.addin.xml index 6a63fd0bf4..e1d52f944a 100644 --- a/main/src/core/MonoDevelop.Ide/ExtensionModel/MainMenu.addin.xml +++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/MainMenu.addin.xml @@ -282,6 +282,8 @@ <SeparatorItem id = "DiagnosticToolsSeparator" /> <CommandItem id = "MonoDevelop.Ide.Commands.HelpCommands.OpenLogDirectory" /> <CommandItem id = "MonoDevelop.Ide.Commands.ToolCommands.InstrumentationViewer" /> + <CommandItem id = "MonoDevelop.Ide.Commands.HelpCommands.DumpUITree" /> + <CommandItem id = "MonoDevelop.Ide.Commands.HelpCommands.DumpA11yTree" /> <Condition id = "Platform" value = "!mac"> <SeparatorItem id = "SeparatorAbout" /> <CommandItem id = "MonoDevelop.Ide.Updater.UpdateCommands.CheckForUpdates" /> diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs index 7af7b25668..8aebd51394 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs @@ -36,7 +36,8 @@ namespace MonoDevelop.Ide.Commands /// <summary> /// Copied from MonoDevelop.Ide.addin.xml /// </summary> - public enum HelpCommands { + public enum HelpCommands + { Help, TipOfTheDay, OpenLogDirectory, @@ -44,13 +45,13 @@ namespace MonoDevelop.Ide.Commands } // MonoDevelop.Ide.Commands.HelpCommands.Help - public class HelpHandler: CommandHandler + public class HelpHandler : CommandHandler { protected override void Run () { IdeApp.HelpOperations.ShowHelp ("root:"); } - + protected override void Update (CommandInfo info) { if (!IdeApp.HelpOperations.CanShowHelp ("root:")) @@ -97,7 +98,7 @@ namespace MonoDevelop.Ide.Commands info.Icon = MonoDevelop.Core.BrandingService.HelpAboutIconId; } } - + class SendFeedbackHandler : CommandHandler { protected override void Run () @@ -110,4 +111,40 @@ namespace MonoDevelop.Ide.Commands info.Visible = FeedbackService.Enabled; } } + + class DumpUITreeHandler : CommandHandler + { + void DumpGtkWidget (Gtk.Widget widget, int indent = 0) + { + string spacer = new string (' ', indent); + Console.WriteLine ($"{spacer}{widget.Name} - {widget.GetType ()}"); + var container = widget as Gtk.Container; + if (container != null) { + var children = container.Children; + Console.WriteLine ($"{spacer} Number of children: {children.Length}"); + + foreach (var child in children) { + DumpGtkWidget (child, indent + 3); + } + } + } + + protected override void Run () + { + var windows = Gtk.Window.ListToplevels (); + Console.WriteLine ($"---------\nNumber of windows: {windows}"); + foreach (var window in windows) { + Console.WriteLine ($"Window: {window.Title} - {window.GetType ()}"); + DumpGtkWidget (window); + } + } + } + + class DumpA11yTreeHandler : CommandHandler + { + protected override void Run () + { + Components.AtkCocoaHelper.DumpAccessibilityTree (); + } + } } |