Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4275 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
17 changed files with 316 additions and 338 deletions
@ -0,0 +1,38 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
namespace Debugger.AddIn.Visualizers.Graph |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Remembers which expressions the user has expanded.
|
||||||
|
/// </summary>
|
||||||
|
public class ExpandedNodes |
||||||
|
{ |
||||||
|
private Dictionary<string, bool> expandedNodes = new Dictionary<string, bool>(); |
||||||
|
|
||||||
|
public ExpandedNodes() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsExpanded(string expression) |
||||||
|
{ |
||||||
|
return expandedNodes.ContainsKey(expression) && (expandedNodes[expression] == true); |
||||||
|
} |
||||||
|
|
||||||
|
public void Expand(string expression) |
||||||
|
{ |
||||||
|
expandedNodes[expression] = true; |
||||||
|
} |
||||||
|
|
||||||
|
public void Collapse(string expression) |
||||||
|
{ |
||||||
|
expandedNodes[expression] = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace Debugger.AddIn.Visualizers.Graph.Layout |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// EventArgs carrying <see cref="PositionedNodeProperty"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class PositionedPropertyEventArgs : EventArgs |
||||||
|
{ |
||||||
|
private PositionedNodeProperty property; |
||||||
|
|
||||||
|
public PositionedPropertyEventArgs(PositionedNodeProperty property) |
||||||
|
{ |
||||||
|
this.property = property; |
||||||
|
} |
||||||
|
|
||||||
|
public PositionedNodeProperty Property { get { return this.property; } } |
||||||
|
} |
||||||
|
} |
@ -1,39 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníèek" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
using System; |
|
||||||
using System.Text; |
|
||||||
using System.Windows.Forms; |
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.SharpDevelop; |
|
||||||
using ICSharpCode.SharpDevelop.Gui; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// ViewContent of the visualizer.
|
|
||||||
/// </summary>
|
|
||||||
public class ObjectGraphVisualizerViewContent : AbstractViewContent |
|
||||||
{ |
|
||||||
VisualizerWinFormsControl control = new VisualizerWinFormsControl(); |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="System.Windows.Forms.Control"/> representing the view.
|
|
||||||
/// </summary>
|
|
||||||
public override object Control |
|
||||||
{ |
|
||||||
get |
|
||||||
{ |
|
||||||
return control; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public ObjectGraphVisualizerViewContent() |
|
||||||
{ |
|
||||||
this.TitleName = "Object graph visualizer"; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,12 +0,0 @@ |
|||||||
<UserControl x:Class="Debugger.AddIn.Visualizers.Graph.VisualizerWPFControl" |
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"> |
|
||||||
<StackPanel> |
|
||||||
<StackPanel Orientation="Horizontal"> |
|
||||||
<TextBlock VerticalAlignment="Center" Padding="4">Expression:</TextBlock> |
|
||||||
<TextBox VerticalAlignment="Center" Margin="4" Width="100"></TextBox> |
|
||||||
<Button Padding="4" Margin="4">Inspect</Button> |
|
||||||
</StackPanel> |
|
||||||
<Canvas></Canvas> |
|
||||||
</StackPanel> |
|
||||||
</UserControl> |
|
@ -1,33 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Text; |
|
||||||
using System.Windows; |
|
||||||
using System.Windows.Controls; |
|
||||||
using System.Windows.Data; |
|
||||||
using System.Windows.Documents; |
|
||||||
using System.Windows.Input; |
|
||||||
using System.Windows.Media; |
|
||||||
using System.Windows.Media.Imaging; |
|
||||||
using System.Windows.Navigation; |
|
||||||
using System.Windows.Shapes; |
|
||||||
|
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for VisualizerWPFControl.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class VisualizerWPFControl : UserControl |
|
||||||
{ |
|
||||||
public VisualizerWPFControl() |
|
||||||
{ |
|
||||||
InitializeComponent(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,92 +0,0 @@ |
|||||||
namespace Debugger.AddIn.Visualizers.Graph |
|
||||||
{ |
|
||||||
partial class VisualizerWinFormsControl |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Designer variable used to keep track of non-visual components.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null; |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Disposes resources used by the control.
|
|
||||||
/// </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.components = new System.ComponentModel.Container(); |
|
||||||
this.txtExpression = new System.Windows.Forms.TextBox(); |
|
||||||
this.btnInspect = new System.Windows.Forms.Button(); |
|
||||||
this.lblInfo = new System.Windows.Forms.Label(); |
|
||||||
this.lblExpression = new System.Windows.Forms.Label(); |
|
||||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); |
|
||||||
this.SuspendLayout(); |
|
||||||
//
|
|
||||||
// txtExpression
|
|
||||||
//
|
|
||||||
this.txtExpression.Location = new System.Drawing.Point(88, 13); |
|
||||||
this.txtExpression.Name = "txtExpression"; |
|
||||||
this.txtExpression.Size = new System.Drawing.Size(131, 20); |
|
||||||
this.txtExpression.TabIndex = 0; |
|
||||||
this.toolTip1.SetToolTip(this.txtExpression, "Expression (e.g. variable name) to be inspected"); |
|
||||||
//
|
|
||||||
// btnInspect
|
|
||||||
//
|
|
||||||
this.btnInspect.Location = new System.Drawing.Point(225, 10); |
|
||||||
this.btnInspect.Name = "btnInspect"; |
|
||||||
this.btnInspect.Size = new System.Drawing.Size(75, 23); |
|
||||||
this.btnInspect.TabIndex = 1; |
|
||||||
this.btnInspect.Text = "Inspect"; |
|
||||||
this.btnInspect.UseVisualStyleBackColor = true; |
|
||||||
this.btnInspect.Click += new System.EventHandler(this.BtnInspectClick); |
|
||||||
//
|
|
||||||
// lblInfo
|
|
||||||
//
|
|
||||||
this.lblInfo.Location = new System.Drawing.Point(11, 58); |
|
||||||
this.lblInfo.Name = "lblInfo"; |
|
||||||
this.lblInfo.Size = new System.Drawing.Size(349, 23); |
|
||||||
this.lblInfo.TabIndex = 2; |
|
||||||
this.lblInfo.Text = "< Result >"; |
|
||||||
//
|
|
||||||
// lblExpression
|
|
||||||
//
|
|
||||||
this.lblExpression.Location = new System.Drawing.Point(11, 14); |
|
||||||
this.lblExpression.Name = "lblExpression"; |
|
||||||
this.lblExpression.Size = new System.Drawing.Size(71, 23); |
|
||||||
this.lblExpression.TabIndex = 4; |
|
||||||
this.lblExpression.Text = "Expression:"; |
|
||||||
//
|
|
||||||
// VisualizerWinFormsControl
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
|
||||||
this.Controls.Add(this.lblExpression); |
|
||||||
this.Controls.Add(this.lblInfo); |
|
||||||
this.Controls.Add(this.btnInspect); |
|
||||||
this.Controls.Add(this.txtExpression); |
|
||||||
this.Name = "VisualizerWinFormsControl"; |
|
||||||
this.Size = new System.Drawing.Size(525, 426); |
|
||||||
this.ResumeLayout(false); |
|
||||||
this.PerformLayout(); |
|
||||||
} |
|
||||||
private System.Windows.Forms.Button btnInspect; |
|
||||||
private System.Windows.Forms.ToolTip toolTip1; |
|
||||||
private System.Windows.Forms.Label lblExpression; |
|
||||||
private System.Windows.Forms.Label lblInfo; |
|
||||||
private System.Windows.Forms.TextBox txtExpression; |
|
||||||
} |
|
||||||
} |
|
@ -1,84 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníèek" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
using System; |
|
||||||
using System.ComponentModel; |
|
||||||
using System.Drawing; |
|
||||||
using System.Windows.Forms; |
|
||||||
using System.Linq; |
|
||||||
|
|
||||||
using ICSharpCode.SharpDevelop.Debugging; |
|
||||||
using ICSharpCode.SharpDevelop.Services; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Windows forms control making up the object graph visualizer user interface/
|
|
||||||
/// </summary>
|
|
||||||
public partial class VisualizerWinFormsControl : UserControl |
|
||||||
{ |
|
||||||
WindowsDebugger _debuggerService = null; |
|
||||||
|
|
||||||
public VisualizerWinFormsControl() |
|
||||||
{ |
|
||||||
//
|
|
||||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
|
||||||
//
|
|
||||||
InitializeComponent(); |
|
||||||
|
|
||||||
_debuggerService = DebuggerService.CurrentDebugger as WindowsDebugger; |
|
||||||
if (_debuggerService == null) |
|
||||||
throw new ApplicationException("Only windows debugger is currently supported"); |
|
||||||
|
|
||||||
_debuggerService.IsProcessRunningChanged += new EventHandler(debuggerService_IsProcessRunningChanged); |
|
||||||
} |
|
||||||
|
|
||||||
public void debuggerService_IsProcessRunningChanged(object sender, EventArgs e) |
|
||||||
{ |
|
||||||
// on step, breakpoint hit
|
|
||||||
if (!_debuggerService.IsProcessRunning) |
|
||||||
{ |
|
||||||
refreshGraph(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
void BtnInspectClick(object sender, EventArgs e) |
|
||||||
{ |
|
||||||
refreshGraph(); |
|
||||||
} |
|
||||||
|
|
||||||
void refreshGraph() |
|
||||||
{ |
|
||||||
ObjectGraphBuilder graphBuilder = new ObjectGraphBuilder(_debuggerService); |
|
||||||
ObjectGraph graph = null; |
|
||||||
|
|
||||||
try |
|
||||||
{ |
|
||||||
graph = graphBuilder.BuildGraphForExpression(txtExpression.Text); |
|
||||||
} |
|
||||||
catch(DebuggerVisualizerException ex) |
|
||||||
{ |
|
||||||
guiHandleException(ex); |
|
||||||
return; |
|
||||||
} |
|
||||||
catch(Debugger.GetValueException ex) |
|
||||||
{ |
|
||||||
guiHandleException(ex); |
|
||||||
|
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
// just a simple message for checking the graph is build ok, will be replaced by graph drawing of course
|
|
||||||
//lblInfo.Text = string.Format("Done. Number of graph nodes: {0}, number of edges: {1}", graph.Nodes.Count(), graph.Edges.Count());
|
|
||||||
} |
|
||||||
|
|
||||||
void guiHandleException(System.Exception ex) |
|
||||||
{ |
|
||||||
lblInfo.Text = "< Result >"; |
|
||||||
MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue