1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
5
using ICSharpCode.Core;
6
using ICSharpCode.SharpDevelop.Debugging;
7
using ICSharpCode.SharpDevelop.Editor;
8
using ICSharpCode.SharpDevelop.Gui;
10
namespace ICSharpCode.SharpDevelop.Services
12
public class RunToCursorCommand : AbstractMenuCommand
14
public override void Run()
16
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;
17
WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger;
19
if (provider == null || winDebugger == null)
22
ITextEditor textEditor = provider.TextEditor;
24
Breakpoint breakpoint = winDebugger.DebuggerCore.Breakpoints.Add(textEditor.FileName, null, textEditor.Caret.Line, textEditor.Caret.Column, true);
25
// Be careful to remove the breakpoint just once
26
breakpoint.Hit += delegate {
27
if (breakpoint != null)
31
winDebugger.DebuggedProcess.Paused += delegate {
32
if (breakpoint != null)
36
if (!winDebugger.IsProcessRunning) {
37
winDebugger.Continue();