private void AddScope(TreeNodeCollection nodes, IScope scope) { TreeNode node = nodes.Add(string.Format("{0} ({1}+{2})", scope.Name, scope.Variables.Count, scope.SubScopes.Count)); node.Tag = scope; node.ImageIndex = 0; node.SelectedImageIndex = 0; foreach (var var in scope.Variables) { TreeNode varNode = node.Nodes.Add(string.Format("{0} = {1}", var.Name, var.Value)); varNode.Tag = var.Value; varNode.ToolTipText = string.Format("{0}{1}{1}{2}", Utils.TypeName(var.Value), Environment.NewLine, Utils.Wrap(var.Description ?? var.ItemDescription, 60)); varNode.ImageIndex = 1; varNode.SelectedImageIndex = 1; } foreach (var subScope in scope.SubScopes) { AddScope(node.Nodes, subScope); } if (Content.IsAtomic && Content.AtomicOperation.Scope == scope) { node.NodeFont = new Font(DefaultFont, FontStyle.Bold); node.ForeColor = Color.White; node.BackColor = Color.Crimson; node.Expand(); scopeTreeView.TopNode = node; node.ToolTipText = "Current scope of active operation"; } }
private void UpdateOperatorTrace() { listView.BeginUpdate(); listView.Items.Clear(); listView.SmallImageList.Images.Clear(); listView.SmallImageList.Images.Add(VSImageLibrary.Method); listView.SmallImageList.Images.Add(VSImageLibrary.Module); listView.SmallImageList.Images.Add(VSImageLibrary.BreakpointActive); foreach (var item in Content) { var viewItem = listView.Items.Add(item.Name ?? item.ItemName); viewItem.ToolTipText = string.Format("{0}{1}{1}{2}", Utils.TypeName(item), Environment.NewLine, Utils.Wrap(item.Description, 60)); viewItem.Tag = item; if (item.Breakpoint) { viewItem.ForeColor = Color.Red; viewItem.ImageIndex = 2; } else { viewItem.ImageIndex = item is CombinedOperator ? 1 : 0; } } if (listView.Items.Count > 0) { for (int i = 0; i < listView.Columns.Count; i++) { listView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); } } listView.EndUpdate(); }
private int AddStackOperations(TreeNodeCollection nodes, IEnumerable <IOperation> operations) { int count = 0; foreach (IOperation op in operations) { if (op is IAtomicOperation) { IAtomicOperation atom = op as IAtomicOperation; TreeNode node = nodes.Add(atom.Operator.Name ?? atom.Operator.ItemName); node.Tag = atom; node.ToolTipText = string.Format("{0}{1}{1}{2}", Utils.TypeName(atom.Operator), Environment.NewLine, Utils.Wrap(atom.Operator.Description ?? atom.Operator.ItemDescription, 60)); if (atom.Operator.Breakpoint) { node.ForeColor = Color.Red; node.ImageIndex = 2; node.SelectedImageIndex = 2; } else { node.ImageIndex = 0; node.SelectedImageIndex = 0; } count++; } else if (op is OperationCollection) { OperationCollection ops = op as OperationCollection; TreeNode node = nodes.Add( string.Format("{0} {2}Operation{1}", ops.Count, ops.Count == 1 ? string.Empty : "s", ops.Parallel ? "Parallel " : string.Empty )); node.Tag = op; node.ToolTipText = Utils.TypeName(ops); node.ImageIndex = 1; node.SelectedImageIndex = 1; count += AddStackOperations(node.Nodes, ops); } } return(count); }
private void AddExecutionContext(IExecutionContext executionContext, TreeNodeCollection nodes) { ExecutionContext context = executionContext as ExecutionContext; StringBuilder name = new StringBuilder(); if (context != null && context.Operator != null) { name.Append(context.Operator.Name); } else { name.Append("<Context>"); } name.Append("@").Append(executionContext.Scope.Name); TreeNode node = nodes.Add(name.ToString()); node.Tag = executionContext; node.ImageIndex = 0; node.SelectedImageIndex = 0; foreach (var param in executionContext.Parameters) { string actualName = null; object value = GetParameterValue(param, executionContext, out actualName); if (value == null) { value = "null"; } string label = actualName != null && actualName != param.Name ? string.Format("{0} ({1}) = {2}", param.Name, actualName, value) : string.Format("{0} = {1}", param.Name, value); TreeNode paramNode = node.Nodes.Add(label); paramNode.Tag = param; executionContextTreeView.ImageList.Images.Add(param.ItemImage ?? VSImageLibrary.Nothing); paramNode.ImageIndex = executionContextTreeView.ImageList.Images.Count - 1; paramNode.SelectedImageIndex = paramNode.ImageIndex; paramNode.ToolTipText = string.Format("{0}{1}{1}{2}", Utils.TypeName(param), Environment.NewLine, Utils.Wrap(param.Description ?? param.ItemDescription, 60)); } if (executionContext.Parent != null) { AddExecutionContext(executionContext.Parent, node.Nodes); } }