public DynamicTreeDebuggerRow(Process process, AbstractNode content)
		{
			this.process = process;
			
			DebuggerGridControl.AddColumns(this.ChildColumns);
			
			this[1].Paint += OnIconPaint;
			this[3].FinishLabelEdit += OnLabelEdited;
			this[3].MouseDown += OnMouseDown;
			
			this.Expanded += delegate { isExpanded = true; };
			this.Collapsed += delegate { isExpanded = false; };
			this.Shown += delegate { isShown = true; };
			this.Hidden += delegate { isShown = false; };
			
			SetContentRecursive(content);
		}
Esempio n. 2
0
		public override void InitOverride(AbstractNode source, Expanded expanded)
		{
			if (!(source is PropertyNode))
				throw new InvalidOperationException(string.Format("{0} must initialize from {1}", typeof(ContentPropertyNode).Name, typeof(PropertyNode).Name));
			
			PropertyNode sourcePropertyNode = source as PropertyNode;
			
			this.Name = sourcePropertyNode.Property.Name;
			// Important to set Text here, as we might be just building new view over existing (evaluated) model.
			// If the model is not evaluated yet, this will be string.Empty and filled in Evaluate().
			this.Text = sourcePropertyNode.Property.Value;
			this.IsNested = false;
			this.IsExpanded = false;			// always false, Property nodes are never expanded (they have IsPropertyExpanded)
			this.Property = new PositionedNodeProperty(
				sourcePropertyNode.Property, this.ContainingNode,
				expanded.Expressions.IsExpanded(sourcePropertyNode.Property.Expression.Expr));
			if (PositionedGraphNodeControl.IsShowMemberIcon) {
				EvalMemberIcon();
			}
		}
		public void SetContentRecursive(AbstractNode content)
		{
			this.content = content;
			
			this[1].Text = ""; // Icon
			this[2].Text = content.Name;
			this[3].Text = content.Text;
			this[3].AllowLabelEdit = (content is ISetText) && ((ISetText)content).CanSetText;
			
			this.ShowPlus = (content.ChildNodes != null);
			this.ShowMinusWhileExpanded = true;
			
			childsLoaded = false;
			if (content.ChildNodes != null && isExpanded) {
				LoadChilds();
			} else {
				this.ChildRows.Clear();
			}
			
			// Repaint and process user commands
			Utils.DoEvents(process);
		}
Esempio n. 4
0
        /// <summary>
        /// Constructor used by the factory method Create()
        /// </summary>
        /// <param name="val"></param>
        /// <exception cref="System.Management.Automation.GetValueException">
        /// Can be thrown by InvokeToString()
        /// </exception>
        public ValueNode(Value val)
        {
            this.expression = val.Expression;

            canSetText = false;
            if (val.Type.IsInteger)
            {
                canSetText =
                    (val.Expression is LocalVariableIdentifierExpression) ||
                    (val.Expression is ParameterIdentifierExpression) ||
                    (val.Expression is ArrayIndexerExpression) ||
                    (val.Expression is MemberReferenceExpression && ((MemberReferenceExpression)val.Expression).MemberInfo is FieldInfo);
            }

            this.Image = IconService.GetBitmap("Icons.16x16." + GetImageName(val));

            this.Name = val.Expression.CodeTail;

            if (DebuggingOptions.Instance.ShowValuesInHexadecimal && val.Type.IsInteger)
            {
                fullText = String.Format("0x{0:X}", val.PrimitiveValue);
            }
            else if (val.Type.IsPointer)
            {
                fullText = String.Format("0x{0:X}", val.PointerAddress);
            }
            else
            {
                fullText = val.AsString;
            }

            if (val.Type != null)
            {
                this.Type = val.Type.Name;
            }
            else
            {
                this.Type = String.Empty;
            }

            // Note that these return enumerators so they are lazy-evaluated
            this.ChildNodes = null;
            if (val.IsNull)
            {
            }
            else if (val.Type.IsClass || val.Type.IsValueType)
            {
                this.ChildNodes = Utils.GetChildNodesOfObject(this.Expression, val.Type);
            }
            else if (val.Type.IsArray)
            {
                this.ChildNodes = Utils.GetChildNodesOfArray(this.Expression, val.ArrayDimensions);
            }
            else if (val.Type.IsPointer)
            {
                Value deRef = val.Dereference();
                if (deRef != null)
                {
                    this.ChildNodes = new AbstractNode [] { new ValueNode(deRef) };
                }
            }

            if (DebuggingOptions.Instance.ICorDebugVisualizerEnabled)
            {
                AbstractNode info = ICorDebug.GetDebugInfoRoot(val.Process, val.CorValue);
                this.ChildNodes = PrependNode(info, this.ChildNodes);
            }

            // Do last since it may expire the object
            if ((val.Type.IsClass || val.Type.IsValueType) && !val.IsNull)
            {
                fullText = val.InvokeToString();
            }

            this.Text = (fullText.Length > 256) ? fullText.Substring(0, 256) + "..." : fullText;
        }
Esempio n. 5
0
        protected override bool CanEdit(TreeNodeAdv node)
        {
            AbstractNode content = ((TreeViewVarNode)node).Content;

            return((content is ISetText) && ((ISetText)content).CanSetText);
        }
Esempio n. 6
0
 public TreeViewVarNode(Process process, TreeViewAdv localVarList, AbstractNode content) : base(localVarList, new object())
 {
     this.process      = process;
     this.localVarList = localVarList;
     SetContentRecursive(content);
 }
Esempio n. 7
0
		IEnumerable<AbstractNode> PrependNode(AbstractNode node, IEnumerable<AbstractNode> rest)
		{
			yield return node;
			if (rest != null) {
				foreach(AbstractNode absNode in rest) {
					yield return absNode;
				}
			}
		}