Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3461 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
12 changed files with 631 additions and 11 deletions
@ -0,0 +1,122 @@
@@ -0,0 +1,122 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision: 2039 $</version>
|
||||
// </file>
|
||||
using Debugger.AddIn.Service; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.Core.WinForms; |
||||
using ICSharpCode.NRefactory; |
||||
using ICSharpCode.SharpDevelop.Debugging; |
||||
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace Debugger.AddIn |
||||
{ |
||||
public class IsBreakpointCondition : IConditionEvaluator |
||||
{ |
||||
public IsBreakpointCondition() |
||||
{ |
||||
} |
||||
|
||||
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; |
||||
|
||||
foreach (BreakpointBookmark mark in DebuggerService.Breakpoints) { |
||||
if ((mark.FileName == provider.TextEditorControl.FileName) && |
||||
(mark.LineNumber == provider.TextEditorControl.ActiveTextAreaControl.Caret.Line)) |
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public class BreakpointChangeMenuBuilder : ISubmenuBuilder |
||||
{ |
||||
public System.Windows.Forms.ToolStripItem[] BuildSubmenu(Codon codon, object owner) |
||||
{ |
||||
List<ToolStripItem> items = new List<ToolStripItem>(); |
||||
|
||||
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; |
||||
} |
||||
} |
||||
|
||||
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(); |
||||
} |
||||
|
||||
void HandleItem(object sender) |
||||
{ |
||||
ToolStripMenuItem item = null; |
||||
if (sender is ToolStripMenuItem) |
||||
item = (ToolStripMenuItem)sender; |
||||
|
||||
if (item != null) { |
||||
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": |
||||
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; |
||||
} |
||||
} |
||||
} |
||||
|
||||
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; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: HP |
||||
* Date: 25.08.2008 |
||||
* Time: 09:37 |
||||
*/ |
||||
namespace Debugger.AddIn.Service |
||||
{ |
||||
partial class EditBreakpointScriptForm |
||||
{ |
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the form.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing) { |
||||
if (components != null) { |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This method is required for Windows Forms designer support.
|
||||
/// Do not change the method contents inside the source code editor. The Forms designer might
|
||||
/// not be able to load this method if it was changed manually.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
this.txtCode = new ICSharpCode.TextEditor.TextEditorControl(); |
||||
this.cmbLanguage = new System.Windows.Forms.ComboBox(); |
||||
this.btnCheckSyntax = new System.Windows.Forms.Button(); |
||||
this.label1 = new System.Windows.Forms.Label(); |
||||
this.btnOK = new System.Windows.Forms.Button(); |
||||
this.btnCancel = new System.Windows.Forms.Button(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// txtCode
|
||||
//
|
||||
this.txtCode.IsReadOnly = false; |
||||
this.txtCode.Location = new System.Drawing.Point(3, 31); |
||||
this.txtCode.Name = "txtCode"; |
||||
this.txtCode.Size = new System.Drawing.Size(575, 355); |
||||
this.txtCode.TabIndex = 0; |
||||
//
|
||||
// cmbLanguage
|
||||
//
|
||||
this.cmbLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; |
||||
this.cmbLanguage.FormattingEnabled = true; |
||||
this.cmbLanguage.Location = new System.Drawing.Point(153, 4); |
||||
this.cmbLanguage.Name = "cmbLanguage"; |
||||
this.cmbLanguage.Size = new System.Drawing.Size(121, 21); |
||||
this.cmbLanguage.TabIndex = 1; |
||||
this.cmbLanguage.SelectedIndexChanged += new System.EventHandler(this.CmbLanguageSelectedIndexChanged); |
||||
//
|
||||
// btnCheckSyntax
|
||||
//
|
||||
this.btnCheckSyntax.Location = new System.Drawing.Point(280, 2); |
||||
this.btnCheckSyntax.Name = "btnCheckSyntax"; |
||||
this.btnCheckSyntax.Size = new System.Drawing.Size(119, 22); |
||||
this.btnCheckSyntax.TabIndex = 2; |
||||
this.btnCheckSyntax.Text = "Check Syntax"; |
||||
this.btnCheckSyntax.UseVisualStyleBackColor = true; |
||||
this.btnCheckSyntax.Click += new System.EventHandler(this.BtnCheckSyntaxClick); |
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(3, 7); |
||||
this.label1.Name = "label1"; |
||||
this.label1.Size = new System.Drawing.Size(144, 16); |
||||
this.label1.TabIndex = 3; |
||||
this.label1.Text = "Scripting Language:"; |
||||
//
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.Location = new System.Drawing.Point(415, 390); |
||||
this.btnOK.Name = "btnOK"; |
||||
this.btnOK.Size = new System.Drawing.Size(75, 23); |
||||
this.btnOK.TabIndex = 4; |
||||
this.btnOK.Text = "OK"; |
||||
this.btnOK.UseVisualStyleBackColor = true; |
||||
this.btnOK.Click += new System.EventHandler(this.BtnOKClick); |
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
||||
this.btnCancel.Location = new System.Drawing.Point(496, 390); |
||||
this.btnCancel.Name = "btnCancel"; |
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23); |
||||
this.btnCancel.TabIndex = 5; |
||||
this.btnCancel.Text = "Cancel"; |
||||
this.btnCancel.UseVisualStyleBackColor = true; |
||||
//
|
||||
// EditBreakpointScriptForm
|
||||
//
|
||||
this.AcceptButton = this.btnOK; |
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.CancelButton = this.btnCancel; |
||||
this.ClientSize = new System.Drawing.Size(583, 418); |
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; |
||||
this.Controls.Add(this.btnCancel); |
||||
this.Controls.Add(this.btnOK); |
||||
this.Controls.Add(this.label1); |
||||
this.Controls.Add(this.btnCheckSyntax); |
||||
this.Controls.Add(this.cmbLanguage); |
||||
this.Controls.Add(this.txtCode); |
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; |
||||
this.MaximizeBox = false; |
||||
this.MinimizeBox = false; |
||||
this.Name = "EditBreakpointScriptForm"; |
||||
this.ShowIcon = false; |
||||
this.Text = "Edit Debugger Script"; |
||||
this.ResumeLayout(false); |
||||
} |
||||
private System.Windows.Forms.Button btnCancel; |
||||
private System.Windows.Forms.Button btnOK; |
||||
private System.Windows.Forms.Label label1; |
||||
private System.Windows.Forms.Button btnCheckSyntax; |
||||
private System.Windows.Forms.ComboBox cmbLanguage; |
||||
private ICSharpCode.TextEditor.TextEditorControl txtCode; |
||||
} |
||||
} |
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
/* |
||||
* Created by SharpDevelop. |
||||
* User: HP |
||||
* Date: 25.08.2008 |
||||
* Time: 09:37 |
||||
*/ |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using System; |
||||
using System.Drawing; |
||||
using System.IO; |
||||
using System.Windows.Forms; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.NRefactory; |
||||
using ICSharpCode.SharpDevelop.Debugging; |
||||
|
||||
namespace Debugger.AddIn.Service |
||||
{ |
||||
/// <summary>
|
||||
/// Description of EditBreakpointScriptForm.
|
||||
/// </summary>
|
||||
public partial class EditBreakpointScriptForm : Form |
||||
{ |
||||
BreakpointBookmark data; |
||||
|
||||
public BreakpointBookmark Data { |
||||
get { return data; } |
||||
} |
||||
|
||||
public EditBreakpointScriptForm(BreakpointBookmark data) |
||||
{ |
||||
//
|
||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
//
|
||||
InitializeComponent(); |
||||
|
||||
this.data = data; |
||||
|
||||
this.data.Action = BreakpointAction.Script; |
||||
|
||||
this.txtCode.Document.TextContent = data.Script; |
||||
this.cmbLanguage.Items.AddRange(new string[] { "C#", "VBNET" }); |
||||
this.cmbLanguage.SelectedIndex = |
||||
(!string.IsNullOrEmpty(data.ScriptLanguage)) ? |
||||
this.cmbLanguage.Items.IndexOf(data.ScriptLanguage.ToUpper()) : |
||||
this.cmbLanguage.Items.IndexOf(ProjectService.CurrentProject.Language.ToUpper()); |
||||
this.txtCode.SetHighlighting(data.ScriptLanguage.ToUpper()); |
||||
|
||||
// Setup translation text
|
||||
this.Text = StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.Title}"); |
||||
|
||||
this.btnCancel.Text = StringParser.Parse("${res:Global.CancelButtonText}"); |
||||
this.btnOK.Text = StringParser.Parse("${res:Global.OKButtonText}"); |
||||
|
||||
this.label1.Text = StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.ScriptingLanguage}") + ":"; |
||||
this.btnCheckSyntax.Text = StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.CheckSyntax}"); |
||||
} |
||||
|
||||
void CmbLanguageSelectedIndexChanged(object sender, EventArgs e) |
||||
{ |
||||
this.txtCode.SetHighlighting(this.cmbLanguage.SelectedItem.ToString()); |
||||
this.data.ScriptLanguage = this.cmbLanguage.SelectedItem.ToString(); |
||||
} |
||||
|
||||
void BtnCheckSyntaxClick(object sender, EventArgs e) |
||||
{ |
||||
CheckSyntax(); |
||||
} |
||||
|
||||
bool CheckSyntax() |
||||
{ |
||||
SupportedLanguage language = (SupportedLanguage)Enum.Parse(typeof(SupportedLanguage), this.cmbLanguage.SelectedItem.ToString().Replace("#", "Sharp"), true); |
||||
using (IParser parser = ParserFactory.CreateParser(language, new StringReader(this.txtCode.Document.TextContent))) { |
||||
parser.ParseExpression(); |
||||
if (parser.Errors.Count > 0) { |
||||
MessageService.ShowError(parser.Errors.ErrorOutput); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
void BtnOKClick(object sender, EventArgs e) |
||||
{ |
||||
if (!this.CheckSyntax()) |
||||
return; |
||||
this.data.Script = this.txtCode.Document.TextContent; |
||||
this.DialogResult = DialogResult.OK; |
||||
this.Close(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,120 @@
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<root> |
||||
<!-- |
||||
Microsoft ResX Schema |
||||
|
||||
Version 2.0 |
||||
|
||||
The primary goals of this format is to allow a simple XML format |
||||
that is mostly human readable. The generation and parsing of the |
||||
various data types are done through the TypeConverter classes |
||||
associated with the data types. |
||||
|
||||
Example: |
||||
|
||||
... ado.net/XML headers & schema ... |
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||
<resheader name="version">2.0</resheader> |
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||
</data> |
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||
<comment>This is a comment</comment> |
||||
</data> |
||||
|
||||
There are any number of "resheader" rows that contain simple |
||||
name/value pairs. |
||||
|
||||
Each data row contains a name, and value. The row also contains a |
||||
type or mimetype. Type corresponds to a .NET class that support |
||||
text/value conversion through the TypeConverter architecture. |
||||
Classes that don't support this are serialized and stored with the |
||||
mimetype set. |
||||
|
||||
The mimetype is used for serialized objects, and tells the |
||||
ResXResourceReader how to depersist the object. This is currently not |
||||
extensible. For a given mimetype the value must be set accordingly: |
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||
that the ResXResourceWriter will generate, however the reader can |
||||
read any of the formats listed below. |
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||
value : The object must be serialized into a byte array |
||||
: using a System.ComponentModel.TypeConverter |
||||
: and then encoded with base64 encoding. |
||||
--> |
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
<xsd:complexType> |
||||
<xsd:choice maxOccurs="unbounded"> |
||||
<xsd:element name="metadata"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" use="required" type="xsd:string" /> |
||||
<xsd:attribute name="type" type="xsd:string" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="assembly"> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="alias" type="xsd:string" /> |
||||
<xsd:attribute name="name" type="xsd:string" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="data"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="resheader"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:schema> |
||||
<resheader name="resmimetype"> |
||||
<value>text/microsoft-resx</value> |
||||
</resheader> |
||||
<resheader name="version"> |
||||
<value>2.0</value> |
||||
</resheader> |
||||
<resheader name="reader"> |
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
</root> |
Loading…
Reference in new issue