Browse Source

Object graph visualizer - use Strings instead

of Expressions to refer to members.
The main purpose of having a String representation
of members is persisting expand state between
debugger steps.
newNRvisualizers
Martin Konicek 13 years ago
parent
commit
05288c1deb
  1. 6
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ExpandedPaths/ExpandedContentNodes.cs
  2. 14
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ExpandedPaths/ExpandedExpressions.cs
  3. 4
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ExpandedPaths/ExpandedPaths.cs
  4. 6
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/GraphExpression.cs
  5. 12
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/PositionedGraph.cs
  6. 2
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/TreeModel/ContentNode.cs
  7. 3
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphBuilder.cs
  8. 4
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraphControl.xaml.cs

6
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ExpandedPaths/ExpandedContentNodes.cs

@ -9,15 +9,13 @@ using System.Linq; @@ -9,15 +9,13 @@ using System.Linq;
namespace Debugger.AddIn.Visualizers.Graph
{
/// <summary>
/// Remembers which content nodes the user has expanded in the <see cref="PositionedGraph">.
/// Holds the expand state of the trees inside nodes of <see cref="PositionedGraph">.
/// </summary>
public class ExpandedContentNodes
{
private ExpandedPaths expanded = new ExpandedPaths();
public ExpandedContentNodes()
{
}
public ExpandedContentNodes() {}
public bool IsExpanded(ContentNode contentNode)
{

14
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ExpandedPaths/ExpandedExpressions.cs

@ -11,7 +11,7 @@ using ICSharpCode.NRefactory.Ast; @@ -11,7 +11,7 @@ using ICSharpCode.NRefactory.Ast;
namespace Debugger.AddIn.Visualizers.Graph
{
/// <summary>
/// Remembers which properties the user has expanded in the <see cref="PositionedGraph">.
/// Holds the expand state of fields and properties in <see cref="PositionedGraph">.
/// </summary>
public class ExpandedExpressions
{
@ -21,19 +21,19 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -21,19 +21,19 @@ namespace Debugger.AddIn.Visualizers.Graph
{
}
public bool IsExpanded(Expression expression)
public bool IsExpanded(String expression)
{
return expanded.IsExpanded(expression.PrettyPrint());
return expanded.IsExpanded(expression);
}
public void SetExpanded(Expression expression)
public void SetExpanded(String expression)
{
expanded.SetExpanded(expression.PrettyPrint());
expanded.SetExpanded(expression);
}
public void SetCollapsed(Expression expression)
public void SetCollapsed(String expression)
{
expanded.SetCollapsed(expression.PrettyPrint());
expanded.SetCollapsed(expression);
}
}
}

4
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ExpandedPaths/ExpandedPaths.cs

@ -13,9 +13,7 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -13,9 +13,7 @@ namespace Debugger.AddIn.Visualizers.Graph
{
private Dictionary<string, bool> expandedPaths = new Dictionary<string, bool>();
public ExpandedPaths()
{
}
public ExpandedPaths() {}
public bool IsExpanded(string path)
{

6
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/GraphExpression.cs

@ -14,12 +14,12 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -14,12 +14,12 @@ namespace Debugger.AddIn.Visualizers.Graph
/// </summary>
public class GraphExpression
{
public Expression Expr { get; set; }
public String Expr { get; set; }
public Func<Value> GetValue { get; set; }
public GraphExpression(Expression expr, Func<Value> getValue)
public GraphExpression(String expr, Func<Value> getValue)
{
if (expr == null) throw new ArgumentNullException("expr");
if (String.IsNullOrEmpty(expr)) throw new ArgumentNullException("expr");
if (getValue == null) throw new ArgumentNullException("getValue");
this.Expr = expr;
this.GetValue = getValue;

12
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/PositionedGraph.cs

@ -19,8 +19,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -19,8 +19,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
public System.Windows.Rect BoundingRect
{
get
{
get {
double minX = nodes.Select(node => node.Left).Min();
double maxX = nodes.Select(node => node.Left + node.Width).Max();
double minY = nodes.Select(node => node.Top).Min();
@ -48,12 +47,9 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -48,12 +47,9 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// </summary>
public IEnumerable<PositionedEdge> Edges
{
get
{
foreach (PositionedNode node in this.Nodes)
{
foreach (PositionedEdge edge in node.Edges)
{
get {
foreach (PositionedNode node in this.Nodes) {
foreach (PositionedEdge edge in node.Edges) {
yield return edge;
}
}

2
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/TreeModel/ContentNode.cs

@ -36,7 +36,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -36,7 +36,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// </summary>
public string FullPath
{
get { return this.containingNode.ObjectNode.Expression.Expr.PrettyPrint() + "/" + this.Path; }
get { return this.containingNode.ObjectNode.Expression.Expr + "/" + this.Path; }
}
private ContentNode parent;

3
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphBuilder.cs

@ -226,8 +226,7 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -226,8 +226,7 @@ namespace Debugger.AddIn.Visualizers.Graph
continue;
}
// ObjectGraphProperty needs an expression
// to know whether it is expanded, and to evaluate
// ObjectGraphProperty needs string representation to know whether it is expanded
var propExpression = new GraphExpression(
expression.Expr.AppendMemberReference((IDebugMemberInfo)memberProp),
() => expression.GetValue().GetMemberValue(WindowsDebugger.EvalThread, memberProp)

4
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraphControl.xaml.cs

@ -107,8 +107,8 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -107,8 +107,8 @@ namespace Debugger.AddIn.Visualizers.Graph
RefreshView();
return;
}
if (shownExpression == null || value.Expr.PrettyPrint() != shownExpression.Expr.PrettyPrint()) {
txtExpression.Text = value.Expr.PrettyPrint();
if (shownExpression == null || value.Expr != shownExpression.Expr) {
txtExpression.Text = value.Expr;
RefreshView();
}
}

Loading…
Cancel
Save