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/MonoDevelop.Ide.Commands | |
parent | dfc16db5698a1314058f4b880176ea13999274f8 (diff) |
[A11y] Add some diagnostic commands for dumping UI/A11y trees
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs | 45 |
1 files changed, 41 insertions, 4 deletions
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 (); + } + } } |