Changeset 4753 for branches/HeuristicLab.DebugEngine/DebugEngineView.cs
- Timestamp:
- 11/09/10 11:09:37 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DebugEngine/DebugEngineView.cs
r4747 r4753 27 27 using HeuristicLab.Core.Views; 28 28 using HeuristicLab.MainForm; 29 using HeuristicLab.Persistence.Auxiliary; 29 30 namespace HeuristicLab.DebugEngine { 30 31 /// <summary> … … 116 117 Invoke(new Action(UpdateView)); 117 118 } else { 119 executionStackTreeView.BeginUpdate(); 118 120 executionStackTreeView.Nodes.Clear(); 119 121 AddOperations(executionStackTreeView.Nodes, Content.ExecutionStack.ToArray()); 120 122 executionStackTreeView.ExpandAll(); 121 123 if (executionStackTreeView.Nodes.Count > 0) 124 executionStackTreeView.TopNode = executionStackTreeView.Nodes[0]; 125 executionStackTreeView.EndUpdate(); 126 127 128 scopeTreeView.BeginUpdate(); 122 129 scopeTreeView.Nodes.Clear(); 123 130 if (Content.CurrentOperation != null) { … … 125 132 } 126 133 scopeTreeView.ExpandAll(); 127 } 134 if (scopeTreeView.Nodes.Count > 0) 135 scopeTreeView.TopNode = scopeTreeView.Nodes[0]; 136 scopeTreeView.EndUpdate(); 137 } 138 } 139 140 private string TypeName(object obj) { 141 if (obj == null) 142 return "null"; 143 return TypeNameParser.Parse(obj.GetType().ToString()).GetTypeNameInCode(true); 128 144 } 129 145 … … 134 150 TreeNode node = nodes.Add(atom.Operator.Name); 135 151 node.Tag = atom; 152 node.ToolTipText = TypeName(atom); 136 153 if (atom.Operator.Breakpoint) 137 154 node.ForeColor = Color.Red; 138 155 foreach (var param in atom.Operator.Parameters) { 139 IItem value = null; 140 try { 141 value = param.ActualValue; 142 } catch (Exception) { } 143 TreeNode paramNode = node.Nodes.Add(string.Format("Param {0}={1}", param.Name, value)); 156 string typeName = "null"; 157 TreeNode paramNode = node.Nodes.Add(string.Format("Param {0} = {1}", param.Name, GetApproximateValue(param, ref typeName))); 144 158 paramNode.Tag = param; 159 paramNode.ToolTipText = string.Format("{0} = {1}", TypeName(param), typeName); 145 160 } 146 161 } else if (op is OperationCollection) { … … 148 163 TreeNode node = executionStackTreeView.Nodes.Add(string.Format("{0} Operations", ops.Count)); 149 164 node.Tag = op; 165 node.ToolTipText = TypeName(ops); 150 166 AddOperations(node.Nodes, ops); 151 167 } 152 168 } 169 } 170 171 private string GetApproximateValue(IParameter param, ref string typeName) { 172 string value = "<none>"; 173 try { 174 IExecutionContext context = Content.CurrentOperation as IExecutionContext; 175 IExecutionContext oldContext = param.ExecutionContext; 176 if (context != null) { 177 param.ExecutionContext = context; 178 } 179 value = param.ActualValue.ToString(); 180 typeName = TypeName(param.ActualValue); 181 if (context != oldContext) { 182 param.ExecutionContext = oldContext; 183 value = string.Format("~ {0}", value); 184 } 185 } catch (Exception) { } 186 return value; 153 187 } 154 188 … … 158 192 TreeNode varNode = node.Nodes.Add(string.Format("{0}={1}", var.Name, var.Value.ToString())); 159 193 varNode.Tag = var.Value; 194 varNode.ToolTipText = TypeName(var.Value); 160 195 } 161 196 foreach (var subScope in scope.SubScopes) {
Note: See TracChangeset
for help on using the changeset viewer.