Browse Source

Removed unused conditional breakpoint types and improved workflow of breakpoints.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3581 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
122177828b
  1. 21
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin
  2. 89
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/IsBreakpointCondition.cs
  3. 6
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.cs
  4. 32
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  5. 14
      src/Main/Base/Project/Src/Services/Debugger/BreakpointBookmark.cs
  6. 2
      src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkConverter.cs

21
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
<Runtime>
<Import assembly="Debugger.AddIn.dll">
<ConditionEvaluator name = "IsBreakpointSet" class = "Debugger.AddIn.IsBreakpointCondition"/>
<ConditionEvaluator name = "IsBreakpointActive" class="Debugger.AddIn.IsActiveBreakpointCondition" />
</Import>
<Import assembly="Debugger.Core.dll"/>
</Runtime>
@ -38,12 +39,28 @@ @@ -38,12 +39,28 @@
type = "Separator"/>
</Condition>
<MenuItem id="BreakpointSeparator" type = "Separator" />
<MenuItem id="ChangeBreakPoint" label="${res:MainWindow.Windows.Debug.Conditional.Breakpoints.Breakpoint}" type="Menu">
<Include id="SetBreakpoint" item="/SharpDevelop/Workbench/MainMenu/Debug/Toggle Breakpoint" />
<Condition name="IsBreakpointSet">
<MenuItem id="ChangeBreakPoint" label="${res:MainWindow.Windows.Debug.Conditional.Breakpoints.ChangeBreakpoint}" type="Menu">
<Condition name="IsBreakpointActive">
<MenuItem id="DisableBreakpoint"
class="Debugger.AddIn.DisableBreakpointMenuCommand"
label= "${res:MainWindow.Windows.Debug.Conditional.Breakpoints.DisableBreakpoint}" />
</Condition>
<ComplexCondition>
<Not>
<Condition name="IsBreakpointActive" />
</Not>
<MenuItem id="EnableBreakpoint"
class="Debugger.AddIn.EnableBreakpointMenuCommand"
label= "${res:MainWindow.Windows.Debug.Conditional.Breakpoints.EnableBreakpoint}" />
</ComplexCondition>
<MenuItem id="BreakpointSeparator" type = "Separator" />
<MenuItem id="MenuBuilder" type="Builder" class="Debugger.AddIn.BreakpointChangeMenuBuilder" />
</MenuItem>
</Condition>
</MenuItem>
</Path>
<Path name = "/SharpDevelop/Workbench/Pads">

89
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/IsBreakpointCondition.cs

@ -45,6 +45,84 @@ namespace Debugger.AddIn @@ -45,6 +45,84 @@ namespace Debugger.AddIn
}
}
public class IsActiveBreakpointCondition : IConditionEvaluator
{
public IsActiveBreakpointCondition()
{
}
public bool IsValid(object caller, Condition condition)
{
if (WorkbenchSingleton.Workbench == null || WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null)
return false;
ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent as ITextEditorControlProvider;
if (provider == null)
return false;
if (string.IsNullOrEmpty(provider.TextEditorControl.FileName))
return false;
BreakpointBookmark point = null;
foreach (BreakpointBookmark breakpoint in DebuggerService.Breakpoints) {
if ((breakpoint.FileName == provider.TextEditorControl.FileName) &&
(breakpoint.LineNumber == provider.TextEditorControl.ActiveTextAreaControl.Caret.Line)) {
point = breakpoint;
break;
}
}
if (point != null) {
return point.IsEnabled;
}
return false;
}
}
public class EnableBreakpointMenuCommand : AbstractMenuCommand
{
public override void Run()
{
ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent as ITextEditorControlProvider;
BreakpointBookmark point = null;
foreach (BreakpointBookmark breakpoint in DebuggerService.Breakpoints) {
if ((breakpoint.FileName == provider.TextEditorControl.FileName) &&
(breakpoint.LineNumber == provider.TextEditorControl.ActiveTextAreaControl.Caret.Line)) {
point = breakpoint;
break;
}
}
if (point != null) {
point.IsEnabled = true;
}
}
}
public class DisableBreakpointMenuCommand : AbstractMenuCommand
{
public override void Run()
{
ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent as ITextEditorControlProvider;
BreakpointBookmark point = null;
foreach (BreakpointBookmark breakpoint in DebuggerService.Breakpoints) {
if ((breakpoint.FileName == provider.TextEditorControl.FileName) &&
(breakpoint.LineNumber == provider.TextEditorControl.ActiveTextAreaControl.Caret.Line)) {
point = breakpoint;
break;
}
}
if (point != null) {
point.IsEnabled = false;
}
}
}
public class BreakpointChangeMenuBuilder : ISubmenuBuilder
{
public System.Windows.Forms.ToolStripItem[] BuildSubmenu(Codon codon, object owner)
@ -80,25 +158,16 @@ namespace Debugger.AddIn @@ -80,25 +158,16 @@ namespace Debugger.AddIn
BreakpointBookmark bookmark = (BreakpointBookmark)item.Tag;
switch (item.Name) {
case "Ask":
bookmark.Action = BreakpointAction.Ask;
break;
case "Break":
bookmark.Action = BreakpointAction.Break;
break;
case "Continue":
bookmark.Action = BreakpointAction.Continue;
break;
case "Script":
case "Condition":
EditBreakpointScriptForm form = new EditBreakpointScriptForm(bookmark);
if (form.ShowDialog() == DialogResult.OK) {
bookmark = form.Data;
}
break;
case "Terminate":
bookmark.Action = BreakpointAction.Terminate;
break;
case "Trace":
bookmark.Action = BreakpointAction.Trace;
break;

6
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.cs

@ -35,9 +35,9 @@ namespace Debugger.AddIn.Service @@ -35,9 +35,9 @@ namespace Debugger.AddIn.Service
this.data = data;
this.data.Action = BreakpointAction.Script;
this.data.Action = BreakpointAction.Condition;
this.txtCode.Document.TextContent = data.Script;
this.txtCode.Document.TextContent = data.Condition;
this.cmbLanguage.Items.AddRange(new string[] { "C#", "VBNET" });
this.cmbLanguage.SelectedIndex =
(!string.IsNullOrEmpty(data.ScriptLanguage)) ?
@ -84,7 +84,7 @@ namespace Debugger.AddIn.Service @@ -84,7 +84,7 @@ namespace Debugger.AddIn.Service
{
if (!this.CheckSyntax())
return;
this.data.Script = this.txtCode.Document.TextContent;
this.data.Condition = this.txtCode.Document.TextContent;
this.DialogResult = DialogResult.OK;
this.Close();
}

32
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -523,41 +523,17 @@ namespace ICSharpCode.SharpDevelop.Services @@ -523,41 +523,17 @@ namespace ICSharpCode.SharpDevelop.Services
new EventHandler<BreakpointEventArgs>(
delegate(object sender, BreakpointEventArgs e)
{
LoggingService.Debug(bookmark.Action + " " + bookmark.ScriptLanguage + " " + bookmark.Script);
LoggingService.Debug(bookmark.Action + " " + bookmark.ScriptLanguage + " " + bookmark.Condition);
switch (bookmark.Action) {
case BreakpointAction.Ask:
Bitmap icon = WinFormsResourceService.GetBitmap(false ? "Icons.32x32.Error" : "Icons.32x32.Warning");
DebuggerEventForm.Result result =
DebuggerEventForm.Show(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHit}"),
string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAt}"), bookmark.LineNumber, bookmark.FileName), icon, true);
switch (result) {
case DebuggerEventForm.Result.Break:
break;
case DebuggerEventForm.Result.Continue:
this.debuggedProcess.AsyncContinue();
break;
case DebuggerEventForm.Result.Terminate:
this.debuggedProcess.AsyncTerminate();
break;
}
break;
case BreakpointAction.Break:
break;
case BreakpointAction.Continue:
this.debuggedProcess.AsyncContinue();
break;
case BreakpointAction.Script:
if (Evaluate(bookmark.Script, bookmark.ScriptLanguage))
DebuggerService.PrintDebugMessage(string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAtBecause}") + "\n", bookmark.LineNumber + 1, bookmark.FileName, bookmark.Script));
case BreakpointAction.Condition:
if (Evaluate(bookmark.Condition, bookmark.ScriptLanguage))
DebuggerService.PrintDebugMessage(string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAtBecause}") + "\n", bookmark.LineNumber + 1, bookmark.FileName, bookmark.Condition));
else
this.debuggedProcess.AsyncContinue();
break;
case BreakpointAction.Terminate:
this.debuggedProcess.AsyncTerminate();
break;
case BreakpointAction.Trace:
DebuggerService.PrintDebugMessage(string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAt}") + "\n", bookmark.LineNumber + 1, bookmark.FileName));
break;

14
src/Main/Base/Project/Src/Services/Debugger/BreakpointBookmark.cs

@ -14,7 +14,7 @@ using ICSharpCode.SharpDevelop.Bookmarks; @@ -14,7 +14,7 @@ using ICSharpCode.SharpDevelop.Bookmarks;
namespace ICSharpCode.SharpDevelop.Debugging
{
public enum BreakpointAction {
Ask, Break, Continue, Terminate, Trace, Script
Break, Trace, Condition
}
public class BreakpointBookmark : SDMarkerBookmark
@ -24,8 +24,8 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -24,8 +24,8 @@ namespace ICSharpCode.SharpDevelop.Debugging
static readonly Color defaultColor = Color.FromArgb(180, 38, 38);
BreakpointAction action = BreakpointAction.Ask;
string script;
BreakpointAction action = BreakpointAction.Break;
string condition;
string scriptLanguage;
public string ScriptLanguage {
@ -33,9 +33,9 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -33,9 +33,9 @@ namespace ICSharpCode.SharpDevelop.Debugging
set { scriptLanguage = value; }
}
public string Script {
get { return script; }
set { script = value; }
public string Condition {
get { return condition; }
set { condition = value; }
}
public BreakpointAction Action {
@ -65,7 +65,7 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -65,7 +65,7 @@ namespace ICSharpCode.SharpDevelop.Debugging
{
this.action = action;
this.scriptLanguage = scriptLanguage;
this.script = script;
this.condition = script;
}
public override void Draw(IconBarMargin margin, Graphics g, Point p)

2
src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkConverter.cs

@ -87,7 +87,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -87,7 +87,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
b.Append('|');
b.Append(bbm.ScriptLanguage);
b.Append('|');
b.Append(bbm.Script);
b.Append(bbm.Condition);
}
return b.ToString();
} else {

Loading…
Cancel
Save