diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs index fed013ddb5..99f634ff99 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs @@ -25,11 +25,11 @@ // // - +using MonoDevelop.Components.AutoTest; using MonoDevelop.Components.Commands; using MonoDevelop.Core; using MonoDevelop.Core.Execution; -using MonoDevelop.Ide.Gui; +using MonoDevelop.Ide.Gui.Dialogs; using System; using MonoDevelop.Ide.Updater; @@ -39,7 +39,9 @@ namespace MonoDevelop.Ide.Commands { AddinManager, ToolList, - InstrumentationViewer + InstrumentationViewer, + ToggleSessionRecorder, + ReplaySession, } internal class AddinManagerHandler : CommandHandler @@ -138,4 +140,59 @@ namespace MonoDevelop.Ide.Commands info.Visible = MonoDevelop.Core.Instrumentation.InstrumentationService.Enabled; } } + + internal class ToggleSessionRecorderHandler : CommandHandler + { + protected override void Run () + { + if (AutoTestService.CurrentRecordSession == null) { + AutoTestService.StartRecordingSession (); + } else { + var selector = new FileSelectorDialog ("Save session as...", Gtk.FileChooserAction.Save); + try { + var result = MessageService.RunCustomDialog (selector, MessageService.RootWindow); + + if (result == (int)Gtk.ResponseType.Cancel) { + return; + } + + AutoTestService.StopRecordingSession (selector.Filename); + } finally { + selector.Destroy (); + } + } + } + + protected override void Update (CommandInfo info) + { + info.Visible = IdeApp.Preferences.EnableAutomatedTesting; + info.Text = AutoTestService.CurrentRecordSession == null ? "Start Session Recorder" : "Stop Session Recorder"; + } + } + + internal class ReplaySessionHandler : CommandHandler + { + protected override void Run () + { + var selector = new FileSelectorDialog ("Open session"); + string filename = null; + try { + var result = MessageService.RunCustomDialog (selector, MessageService.RootWindow); + + if (result == (int)Gtk.ResponseType.Cancel) { + return; + } + + filename = selector.Filename; + } finally { + selector.Destroy (); + } + AutoTestService.ReplaySessionFromFile (filename); + } + + protected override void Update (CommandInfo info) + { + info.Visible = IdeApp.Preferences.EnableAutomatedTesting; + } + } } |