#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

119 lines
3.2 KiB

// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Windows.Media;
using ICSharpCode.Core;
using ICSharpCode.Editor;
using ICSharpCode.NRefactory;
using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.SharpDevelop.Debugging
{
public enum BreakpointAction
{
Break,
Trace,
Condition
}
public class BreakpointBookmark : SDMarkerBookmark
{
bool isHealthy = true;
bool isEnabled = true;
string tooltip;
BreakpointAction action = BreakpointAction.Break;
string condition;
string scriptLanguage;
public string ScriptLanguage {
get { return scriptLanguage; }
set { scriptLanguage = value; }
}
public string Condition {
get { return condition; }
set { condition = value; }
}
public BreakpointAction Action {
get {
return action;
}
set {
if (action != value) {
action = value;
Redraw();
}
}
}
public virtual bool IsHealthy {
get {
return isHealthy;
}
set {
if (isHealthy != value) {
isHealthy = value;
Redraw();
}
}
}
public virtual bool IsEnabled {
get {
return isEnabled;
}
set {
if (isEnabled != value) {
isEnabled = value;
if (IsEnabledChanged != null)
IsEnabledChanged(this, EventArgs.Empty);
Redraw();
}
}
}
public event EventHandler IsEnabledChanged;
public string Tooltip {
get { return tooltip; }
set { tooltip = value; }
}
public BreakpointBookmark(FileName fileName, TextLocation location, BreakpointAction action, string scriptLanguage, string script) : base(fileName, location)
{
this.action = action;
this.scriptLanguage = scriptLanguage;
this.condition = script;
}
public static readonly IImage BreakpointImage = new ResourceServiceImage("Bookmarks.Breakpoint");
public static readonly IImage BreakpointConditionalImage = new ResourceServiceImage("Bookmarks.BreakpointConditional");
public static readonly IImage DisabledBreakpointImage = new ResourceServiceImage("Bookmarks.DisabledBreakpoint");
public static readonly IImage UnhealthyBreakpointImage = new ResourceServiceImage("Bookmarks.UnhealthyBreakpoint");
public static readonly IImage UnhealthyBreakpointConditionalImage = new ResourceServiceImage("Bookmarks.UnhealthyBreakpointConditional");
public override IImage Image {
get {
if (!this.IsEnabled)
return DisabledBreakpointImage;
else if (this.IsHealthy)
return this.Action == BreakpointAction.Break ? BreakpointImage : BreakpointConditionalImage;
else
return this.Action == BreakpointAction.Break ? UnhealthyBreakpointImage : UnhealthyBreakpointConditionalImage;
}
}
protected override ITextMarker CreateMarker(ITextMarkerService markerService)
{
IDocumentLine line = this.Document.GetLineByNumber(this.LineNumber);
ITextMarker marker = markerService.Create(line.Offset, line.Length);
marker.BackgroundColor = Color.FromRgb(180, 38, 38);
marker.ForegroundColor = Colors.White;
return marker;
}
}
}