19 changed files with 184 additions and 536 deletions
@ -1,94 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Windows.Controls; |
|
||||||
|
|
||||||
using Debugger.AddIn.Service; |
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.Core.Presentation; |
|
||||||
using ICSharpCode.SharpDevelop; |
|
||||||
using ICSharpCode.SharpDevelop.Debugging; |
|
||||||
using ICSharpCode.SharpDevelop.Editor; |
|
||||||
using ICSharpCode.SharpDevelop.Gui; |
|
||||||
using ICSharpCode.SharpDevelop.Gui.Pads; |
|
||||||
|
|
||||||
namespace Debugger.AddIn |
|
||||||
{ |
|
||||||
public class BreakpointChangeMenuBuilder : ISubmenuBuilder, IMenuItemBuilder |
|
||||||
{ |
|
||||||
public ToolStripItem[] BuildSubmenu(Codon codon, object owner) |
|
||||||
{ |
|
||||||
List<ToolStripItem> items = new List<ToolStripItem>(); |
|
||||||
|
|
||||||
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent as ITextEditorProvider; |
|
||||||
|
|
||||||
BreakpointBookmark point = null; |
|
||||||
|
|
||||||
foreach (BreakpointBookmark breakpoint in DebuggerService.Breakpoints) { |
|
||||||
if ((breakpoint.FileName == provider.TextEditor.FileName) && |
|
||||||
(breakpoint.LineNumber == provider.TextEditor.Caret.Line)) { |
|
||||||
point = breakpoint; |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (point != null) { |
|
||||||
foreach (string item in BreakpointAction.GetNames(typeof(BreakpointAction))) { |
|
||||||
items.Add(MakeItem("${res:MainWindow.Windows.Debug.Conditional.Breakpoints." + item + "}", item, point, point.Action.ToString(), delegate(object sender, EventArgs e) {HandleItem(sender);})); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return items.ToArray(); |
|
||||||
} |
|
||||||
|
|
||||||
public ICollection BuildItems(Codon codon, object owner) |
|
||||||
{ |
|
||||||
return BuildSubmenu(codon, owner).TranslateToWpf(); |
|
||||||
} |
|
||||||
|
|
||||||
void HandleItem(object sender) |
|
||||||
{ |
|
||||||
MenuItem item = null; |
|
||||||
if (sender is MenuItem) |
|
||||||
item = (MenuItem)sender; |
|
||||||
|
|
||||||
if (item != null) { |
|
||||||
BreakpointBookmark bookmark = (BreakpointBookmark)item.Tag; |
|
||||||
|
|
||||||
switch (item.Name) { |
|
||||||
case "Break": |
|
||||||
bookmark.Action = BreakpointAction.Break; |
|
||||||
break; |
|
||||||
case "Condition": |
|
||||||
EditBreakpointScriptWindow window = new EditBreakpointScriptWindow(bookmark) { |
|
||||||
Owner = WorkbenchSingleton.MainWindow |
|
||||||
}; |
|
||||||
|
|
||||||
if (window.ShowDialog() ?? false) { |
|
||||||
bookmark = window.Data; |
|
||||||
} |
|
||||||
break; |
|
||||||
case "Trace": |
|
||||||
bookmark.Action = BreakpointAction.Trace; |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
ToolStripMenuItem MakeItem(string title, string name, BreakpointBookmark tag, string data, EventHandler onClick) |
|
||||||
{ |
|
||||||
ToolStripMenuItem menuItem = new ToolStripMenuItem(StringParser.Parse(title)); |
|
||||||
menuItem.Click += onClick; |
|
||||||
menuItem.Name = name; |
|
||||||
menuItem.Tag = tag; |
|
||||||
|
|
||||||
if (name == tag.Action.ToString()) |
|
||||||
menuItem.Checked = true; |
|
||||||
|
|
||||||
return menuItem; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,43 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
|
||||||
|
|
||||||
using ICSharpCode.SharpDevelop.Gui.Pads; |
|
||||||
using System; |
|
||||||
using System.Collections; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Windows.Forms; |
|
||||||
using Debugger.AddIn.Service; |
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.Core.Presentation; |
|
||||||
using ICSharpCode.Core.WinForms; |
|
||||||
using ICSharpCode.SharpDevelop; |
|
||||||
using ICSharpCode.SharpDevelop.Debugging; |
|
||||||
using ICSharpCode.SharpDevelop.Editor; |
|
||||||
using ICSharpCode.SharpDevelop.Gui; |
|
||||||
|
|
||||||
namespace Debugger.AddIn |
|
||||||
{ |
|
||||||
public class DisableBreakpointMenuCommand : AbstractMenuCommand |
|
||||||
{ |
|
||||||
public override void Run() |
|
||||||
{ |
|
||||||
ITextEditor editor = SD.GetActiveViewContentService<ITextEditor>(); |
|
||||||
if (editor == null) |
|
||||||
return; |
|
||||||
|
|
||||||
BreakpointBookmark point = null; |
|
||||||
|
|
||||||
foreach (BreakpointBookmark breakpoint in DebuggerService.Breakpoints) { |
|
||||||
if ((breakpoint.FileName == editor.FileName) && |
|
||||||
(breakpoint.LineNumber == editor.Caret.Line)) { |
|
||||||
point = breakpoint; |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (point != null) { |
|
||||||
point.IsEnabled = false; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,43 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
|
||||||
|
|
||||||
using ICSharpCode.SharpDevelop.Gui.Pads; |
|
||||||
using System; |
|
||||||
using System.Collections; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Windows.Forms; |
|
||||||
using Debugger.AddIn.Service; |
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.Core.Presentation; |
|
||||||
using ICSharpCode.Core.WinForms; |
|
||||||
using ICSharpCode.SharpDevelop; |
|
||||||
using ICSharpCode.SharpDevelop.Debugging; |
|
||||||
using ICSharpCode.SharpDevelop.Editor; |
|
||||||
using ICSharpCode.SharpDevelop.Gui; |
|
||||||
|
|
||||||
namespace Debugger.AddIn |
|
||||||
{ |
|
||||||
public class EnableBreakpointMenuCommand : AbstractMenuCommand |
|
||||||
{ |
|
||||||
public override void Run() |
|
||||||
{ |
|
||||||
ITextEditor editor = SD.GetActiveViewContentService<ITextEditor>(); |
|
||||||
if (editor == null) |
|
||||||
return; |
|
||||||
|
|
||||||
BreakpointBookmark point = null; |
|
||||||
|
|
||||||
foreach (BreakpointBookmark breakpoint in DebuggerService.Breakpoints) { |
|
||||||
if ((breakpoint.FileName == editor.FileName) && |
|
||||||
(breakpoint.LineNumber == editor.Caret.Line)) { |
|
||||||
point = breakpoint; |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (point != null) { |
|
||||||
point.IsEnabled = true; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,51 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
|
||||||
|
|
||||||
using ICSharpCode.SharpDevelop.Gui.Pads; |
|
||||||
using System; |
|
||||||
using System.Collections; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Windows.Forms; |
|
||||||
using Debugger.AddIn.Service; |
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.Core.Presentation; |
|
||||||
using ICSharpCode.Core.WinForms; |
|
||||||
using ICSharpCode.SharpDevelop; |
|
||||||
using ICSharpCode.SharpDevelop.Debugging; |
|
||||||
using ICSharpCode.SharpDevelop.Editor; |
|
||||||
using ICSharpCode.SharpDevelop.Gui; |
|
||||||
|
|
||||||
namespace Debugger.AddIn |
|
||||||
{ |
|
||||||
public class IsActiveBreakpointCondition : IConditionEvaluator |
|
||||||
{ |
|
||||||
public IsActiveBreakpointCondition() |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
public bool IsValid(object caller, Condition condition) |
|
||||||
{ |
|
||||||
ITextEditor editor = SD.GetActiveViewContentService<ITextEditor>(); |
|
||||||
if (editor == null) |
|
||||||
return false; |
|
||||||
if (string.IsNullOrEmpty(editor.FileName)) |
|
||||||
return false; |
|
||||||
|
|
||||||
BreakpointBookmark point = null; |
|
||||||
|
|
||||||
foreach (BreakpointBookmark breakpoint in DebuggerService.Breakpoints) { |
|
||||||
if ((breakpoint.FileName == editor.FileName) && |
|
||||||
(breakpoint.LineNumber == editor.Caret.Line)) { |
|
||||||
point = breakpoint; |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (point != null) { |
|
||||||
return point.IsEnabled; |
|
||||||
} |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,43 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
|
||||||
|
|
||||||
using ICSharpCode.SharpDevelop.Gui.Pads; |
|
||||||
using System; |
|
||||||
using System.Collections; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Windows.Forms; |
|
||||||
using Debugger.AddIn.Service; |
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.Core.Presentation; |
|
||||||
using ICSharpCode.Core.WinForms; |
|
||||||
using ICSharpCode.SharpDevelop; |
|
||||||
using ICSharpCode.SharpDevelop.Debugging; |
|
||||||
using ICSharpCode.SharpDevelop.Editor; |
|
||||||
using ICSharpCode.SharpDevelop.Gui; |
|
||||||
|
|
||||||
namespace Debugger.AddIn |
|
||||||
{ |
|
||||||
public class IsBreakpointCondition : IConditionEvaluator |
|
||||||
{ |
|
||||||
public IsBreakpointCondition() |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
public bool IsValid(object caller, Condition condition) |
|
||||||
{ |
|
||||||
ITextEditor editor = SD.GetActiveViewContentService<ITextEditor>(); |
|
||||||
if (editor == null) |
|
||||||
return false; |
|
||||||
if (string.IsNullOrEmpty(editor.FileName)) |
|
||||||
return false; |
|
||||||
|
|
||||||
foreach (BreakpointBookmark mark in DebuggerService.Breakpoints) { |
|
||||||
if ((mark.FileName == editor.FileName) && |
|
||||||
(mark.LineNumber == editor.Caret.Line)) |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
return false; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,49 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using Debugger; |
|
||||||
using Debugger.AddIn; |
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.NRefactory; |
|
||||||
using ICSharpCode.SharpDevelop.Debugging; |
|
||||||
using ICSharpCode.SharpDevelop.Services; |
|
||||||
using System.Windows.Controls; |
|
||||||
|
|
||||||
namespace ICSharpCode.SharpDevelop.Gui.Pads |
|
||||||
{ |
|
||||||
#warning AbstractComboBoxCommand
|
|
||||||
/* |
|
||||||
class SelectLanguageCommand : AbstractComboBoxCommand |
|
||||||
{ |
|
||||||
ConsolePad pad; |
|
||||||
ComboBox box; |
|
||||||
|
|
||||||
protected override void OnOwnerChanged(EventArgs e) |
|
||||||
{ |
|
||||||
this.pad = this.Owner as ConsolePad; |
|
||||||
if (this.pad == null) |
|
||||||
return; |
|
||||||
|
|
||||||
box = this.ComboBox as ComboBox; |
|
||||||
|
|
||||||
if (this.box == null) |
|
||||||
return; |
|
||||||
|
|
||||||
foreach (var name in Enum.GetNames(typeof(SupportedLanguage))) |
|
||||||
box.Items.Add(name); |
|
||||||
|
|
||||||
box.SelectedIndex = 0; |
|
||||||
|
|
||||||
base.OnOwnerChanged(e); |
|
||||||
} |
|
||||||
|
|
||||||
public override void Run() |
|
||||||
{ |
|
||||||
if (this.pad != null && this.box != null) { |
|
||||||
pad.SelectedLanguage = (SupportedLanguage)Enum.Parse(typeof(SupportedLanguage), box.SelectedValue.ToString()); |
|
||||||
} |
|
||||||
base.Run(); |
|
||||||
} |
|
||||||
}*/ |
|
||||||
} |
|
@ -0,0 +1,75 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the BSD license (for details please see \src\AddIns\Debugger\Debugger.AddIn\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Debugging; |
||||||
|
using ICSharpCode.SharpDevelop.Editor; |
||||||
|
|
||||||
|
namespace Debugger.AddIn |
||||||
|
{ |
||||||
|
public static class BreakpointUtil |
||||||
|
{ |
||||||
|
public static IEnumerable<BreakpointBookmark> BreakpointsOnCaret { |
||||||
|
get { |
||||||
|
ITextEditor editor = SD.GetActiveViewContentService<ITextEditor>(); |
||||||
|
if (editor == null) |
||||||
|
return new BreakpointBookmark[0]; |
||||||
|
|
||||||
|
return SD.BookmarkManager.Bookmarks.OfType<BreakpointBookmark>().Where(bp => bp.FileName == editor.FileName && bp.LineNumber == editor.Caret.Line); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class EnableBreakpointMenuCommand : AbstractMenuCommand |
||||||
|
{ |
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
foreach (BreakpointBookmark bp in BreakpointUtil.BreakpointsOnCaret) { |
||||||
|
bp.IsEnabled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class DisableBreakpointMenuCommand : AbstractMenuCommand |
||||||
|
{ |
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
foreach (BreakpointBookmark bp in BreakpointUtil.BreakpointsOnCaret) { |
||||||
|
bp.IsEnabled = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class EditBreakpointMenuCommand : AbstractMenuCommand |
||||||
|
{ |
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
foreach (BreakpointBookmark bp in BreakpointUtil.BreakpointsOnCaret) { |
||||||
|
EditBreakpointScriptWindow window = new EditBreakpointScriptWindow(bp) { |
||||||
|
Owner = SD.Workbench.MainWindow |
||||||
|
}; |
||||||
|
window.ShowDialog(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class IsActiveBreakpointCondition : IConditionEvaluator |
||||||
|
{ |
||||||
|
public bool IsValid(object caller, Condition condition) |
||||||
|
{ |
||||||
|
return BreakpointUtil.BreakpointsOnCaret.Any(bp => bp.IsEnabled); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class IsBreakpointCondition : IConditionEvaluator |
||||||
|
{ |
||||||
|
public bool IsValid(object caller, Condition condition) |
||||||
|
{ |
||||||
|
return BreakpointUtil.BreakpointsOnCaret.Any(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue