public ExpressionNode(TreeNode parent, IImage image, string name, Expression expression) : base(parent) { this.IconImage = image; this.Name = name; this.expression = expression; }
protected override void OnDrawText(DrawEventArgs args) { TreeNode content = ((TreeViewVarNode)args.Node).Content; if (content is ExpressionNode && ((ExpressionNode)content).Error != null) { args.TextColor = Color.Red; } else if (((TreeViewVarNode)args.Node).TextChanged) { args.TextColor = Color.Blue; } base.OnDrawText(args); }
public override void MouseDown(TreeNodeAdvMouseEventArgs args) { TreeNode content = ((TreeViewVarNode)args.Node).Content; if (content is IContextMenu && args.Button == MouseButtons.Right) { ContextMenuStrip menu = ((IContextMenu)content).GetContextMenu(); if (menu != null) { menu.Show(args.Node.Tree, args.Location); args.Handled = true; } } else { base.MouseDown(args); } }
/// <summary> /// A simple form of SetContentRecursive that changes the current ChildViewNode to /// display the data provided by <c>content</c>. If the node had any children and is expanded, /// it will recureively set those as well. /// </summary> /// <param name="content">Contains the name value and type of the variable stored in this particular TreeViewNode.</param> private void SetContentRecursive(TreeNode content) { this.textChanged = this.content != null && this.content.Name == content.Name && this.content.Text != content.Text; this.content = content; this.IsLeaf = (content.ChildNodes == null); childsLoaded = false; this.IsExpandedOnce = false; if (!IsLeaf && expandedNodes.ContainsKey(this.FullName) && expandedNodes[this.FullName]) { LoadChildren(); this.Expand(); } else { this.Children.Clear(); this.Collapse(); } // Process user commands Utils.DoEvents(process); // Repaint if (timeSinceLastRepaintEnd == null || timeSinceLastRepaintEnd.Elapsed > workTime) { using (new PrintTime("Repainting Local Variables Pad")) { try { this.Tree.EndUpdate(); // Enable painting Utils.DoEvents(process); // Paint } finally { this.Tree.BeginUpdate(); // Disable painting timeSinceLastRepaintEnd = new Stopwatch(); timeSinceLastRepaintEnd.Start(); } } } }
public ExpressionNode(TreeNode parent, IImage image, string name, Expression expression) : base(parent) { this.IconImage = image; this.Name = name; this.expression = expression; }
void EvaluateExpression() { evaluated = true; Value val; try { val = expression.Evaluate(WindowsDebugger.DebuggedProcess); } catch (GetValueException e) { error = e; this.Text = e.Message; return; } this.canSetText = val.Type.IsPrimitive; this.expressionType = val.Type; this.Type = val.Type.Name; this.valueIsNull = val.IsNull; // Note that these return enumerators so they are lazy-evaluated if (val.IsNull) { } else if (val.Type.IsPrimitive || val.Type.FullName == typeof(string).FullName) // Must be before IsClass { } else if (val.Type.IsArray) // Must be before IsClass { if (val.ArrayLength > 0) { this.ChildNodes = Utils.LazyGetChildNodesOfArray(this.Expression, val.ArrayDimensions); } } else if (val.Type.IsClass || val.Type.IsValueType) { if (val.Type.FullNameWithoutGenericArguments == typeof(List <>).FullName) { if ((int)val.GetMemberValue("_size").PrimitiveValue > 0) { this.ChildNodes = Utils.LazyGetItemsOfIList(this.expression); } } else { this.ChildNodes = Utils.LazyGetChildNodesOfObject(this.Expression, val.Type); } } else if (val.Type.IsPointer) { Value deRef = val.Dereference(); if (deRef != null) { this.ChildNodes = new ExpressionNode [] { new ExpressionNode(this.IconImage, "*" + this.Name, this.Expression.AppendDereference()) }; } } if (DebuggingOptions.Instance.ICorDebugVisualizerEnabled) { TreeNode info = ICorDebug.GetDebugInfoRoot(val.AppDomain, val.CorValue); this.ChildNodes = Utils.PrependNode(info, this.ChildNodes); } // Do last since it may expire the object if (val.Type.IsInteger) { fullText = FormatInteger(val.PrimitiveValue); } else if (val.Type.IsPointer) { fullText = String.Format("0x{0:X}", val.PointerAddress); } else if ((val.Type.FullName == typeof(string).FullName || val.Type.FullName == typeof(char).FullName) && !val.IsNull) { try { fullText = '"' + Escape(val.InvokeToString()) + '"'; } catch (GetValueException e) { error = e; fullText = e.Message; return; } } else if ((val.Type.IsClass || val.Type.IsValueType) && !val.IsNull) { try { fullText = val.InvokeToString(); } catch (GetValueException e) { error = e; fullText = e.Message; return; } } else { fullText = val.AsString(); } this.Text = (fullText.Length > 256) ? fullText.Substring(0, 256) + "..." : fullText; }
protected override bool CanEdit(TreeNodeAdv node) { TreeNode content = ((TreeViewVarNode)node).Content; return((content is ISetText) && ((ISetText)content).CanSetText); }
public TreeViewVarNode(Process process, TreeViewAdv localVarList, TreeNode content) : base(localVarList, new object()) { this.process = process; this.localVarList = localVarList; SetContentRecursive(content); }
/// <summary> /// A simple form of SetContentRecursive that changes the current ChildViewNode to /// display the data provided by <c>content</c>. If the node had any children and is expanded, /// it will recureively set those as well. /// </summary> /// <param name="content">Contains the name value and type of the variable stored in this particular TreeViewNode.</param> private void SetContentRecursive(TreeNode content) { this.textChanged = this.content != null && this.content.Name == content.Name && this.content.Text != content.Text; this.content = content; this.IsLeaf = (content.ChildNodes == null); childsLoaded = false; this.IsExpandedOnce = false; if (!IsLeaf && expandedNodes.ContainsKey(this.FullName) && expandedNodes[this.FullName]) { LoadChildren(); this.Expand(); } else { this.Children.Clear(); this.Collapse(); } // Process user commands Utils.DoEvents(process); // Repaint if (timeSinceLastRepaintEnd == null || timeSinceLastRepaintEnd.Elapsed > workTime) { using(new PrintTime("Repainting Local Variables Pad")) { try { this.Tree.EndUpdate(); // Enable painting Utils.DoEvents(process); // Paint } finally { this.Tree.BeginUpdate(); // Disable painting timeSinceLastRepaintEnd = new Stopwatch(); timeSinceLastRepaintEnd.Start(); } } } }
public TreeViewVarNode(Process process, TreeViewAdv localVarList, TreeNode content): base(localVarList, new object()) { this.process = process; this.localVarList = localVarList; SetContentRecursive(content); }