/// <summary>
 /// Visits the data member
 /// </summary>
 /// <param name="line">Line to add the tag for</param>
 /// <param name="context">DataMemberNode to visit</param>
 /// <param name="lineNo">Current line numer</param>
 /// <param name="collectedSpans">Collection of spancs found</param>
 private void Visit(ITextSnapshotLine line, DataMemberNode context, int lineNo, List <TagSpan <Z80TestTokenTag> > collectedSpans)
 {
     if (context == null ||
         lineNo < context.Span.StartLine ||
         lineNo > context.Span.EndLine)
     {
         return;
     }
     Visit(line, context.IdSpan, lineNo, collectedSpans, Z80TestTokenType.Identifier);
     if (context is ValueMemberNode valMember)
     {
         Visit(line, valMember.Expr, lineNo, collectedSpans);
     }
     else if (context is MemoryPatternMemberNode memMember)
     {
         foreach (var pattern in memMember.Patterns)
         {
             Visit(line, pattern, lineNo, collectedSpans);
         }
     }
     else if (context is PortMockMemberNode portMember)
     {
         Visit(line, portMember.Expr, lineNo, collectedSpans);
         foreach (var pulse in portMember.Pulses)
         {
             Visit(line, pulse, lineNo, collectedSpans);
         }
     }
 }
        private void SetSelectedItem(TreeNode node)
        {
            selectedItem = null;

            if (node is DataMemberNode)
            {
                DataMemberNode dataMemberNode = (DataMemberNode)node;
                if (selectLists == dataMemberNode.IsList)
                {
                    selectedItem = new DesignBinding(dataMemberNode.DataSource, dataMemberNode.DataMember);
                }
            }
            else if (node is NoneNode)
            {
                selectedItem = DesignBinding.Null;
            }
        }
        protected void FillDataMembers(BindingContext bindingManager, object dataSource, string dataMember, string propertyName, bool isList, TreeNodeCollection nodes, int depth)
        {
            if (depth > MaximumDepth)
            {
                return;
            }
            if (!isList && selectLists)
            {
                return;
            }

            DataMemberNode dataMemberNode = new DataMemberNode(dataMember, propertyName, isList);

            nodes.Add(dataMemberNode);
            if (selectedItem != null && selectedItem.Equals(dataSource, dataMember))
            {
                selectedNode = dataMemberNode;
            }

            if (isList)
            {
                CurrencyManager listManager             = (CurrencyManager)bindingManager[dataSource, dataMember];
                PropertyDescriptorCollection properties = listManager.GetItemProperties();
                for (int i = 0; i < properties.Count; i++)
                {
                    ListBindableAttribute listBindable = (ListBindableAttribute)properties[i].Attributes[typeof(ListBindableAttribute)];

                    // if the attribute exists and it is false, then skip this property.
                    //
                    if (listBindable != null && !listBindable.ListBindable)
                    {
                        continue;
                    }
                    FillDataMembers(bindingManager, dataSource, dataMember + "." + properties[i].Name, properties[i].Name, typeof(IList).IsAssignableFrom(properties[i].PropertyType), dataMemberNode.Nodes, depth + 1);
                }
            }
        }
 private void AddProjectDataMemberContents(TreeNodeCollection nodes, DataMemberNode projectDataMemberNode, DataSourceDescriptor dsd, PropertyDescriptor propDesc, object dataSourceInstance)
 {
     if ((!this.selectListMembers && projectDataMemberNode.IsList) && (dataSourceInstance != null))
     {
         PropertyDescriptorCollection listItemProperties = ListBindingHelper.GetListItemProperties(dataSourceInstance, new PropertyDescriptor[] { propDesc });
         if (listItemProperties != null)
         {
             foreach (PropertyDescriptor descriptor in listItemProperties)
             {
                 if (this.IsBindableDataMember(descriptor) && descriptor.IsBrowsable)
                 {
                     bool isList = this.IsListMember(descriptor);
                     if (!isList)
                     {
                         this.AddProjectDataMember(nodes, dsd, descriptor, dataSourceInstance, isList);
                     }
                 }
             }
         }
     }
 }
 private void AddProjectDataMemberContents(DataMemberNode projectDataMemberNode, DataSourceDescriptor dsd, PropertyDescriptor pd, object dataSourceInstance)
 {
     this.AddProjectDataMemberContents(projectDataMemberNode.Nodes, projectDataMemberNode, dsd, pd, dataSourceInstance);
 }
 private void AddDataMemberContents(TreeNodeCollection nodes, object dataSource, string dataMember, bool isList)
 {
     if (isList)
     {
         PropertyDescriptorCollection itemProperties = this.GetItemProperties(dataSource, dataMember);
         if (itemProperties != null)
         {
             for (int i = 0; i < itemProperties.Count; i++)
             {
                 PropertyDescriptor property = itemProperties[i];
                 if (this.IsBindableDataMember(property))
                 {
                     bool flag = this.IsListMember(property);
                     if (!this.selectListMembers || flag)
                     {
                         DataMemberNode node = new DataMemberNode(this, dataSource, dataMember + "." + property.Name, property.Name, flag);
                         nodes.Add(node);
                         if ((this.selectedItem != null) && (this.selectedItem.DataSource == node.DataSource))
                         {
                             if (this.selectedItem.Equals(dataSource, node.DataMember))
                             {
                                 this.selectedNode = node;
                             }
                             else if (!string.IsNullOrEmpty(this.selectedItem.DataMember) && (this.selectedItem.DataMember.IndexOf(node.DataMember) == 0))
                             {
                                 this.AddDataMemberContents(node);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 private void AddDataMemberContents(TreeNodeCollection nodes, DataMemberNode dataMemberNode)
 {
     this.AddDataMemberContents(nodes, dataMemberNode.DataSource, dataMemberNode.DataMember, dataMemberNode.IsList);
 }
 private void AddDataMemberContents(DataMemberNode dataMemberNode)
 {
     this.AddDataMemberContents(dataMemberNode.Nodes, dataMemberNode);
 }
 private void AddDataMember(TreeNodeCollection nodes, object dataSource, string dataMember, string propertyName, bool isList)
 {
     bool flag = isList && (dataSource is BindingSource);
     bool flag2 = this.showDataMembers && !this.selectListMembers;
     bool flag3 = flag && flag2;
     bool flag4 = (flag && !flag2) || (this.context.Instance is BindingSource);
     if (!flag3 && (!this.selectListMembers || isList))
     {
         DataMemberNode node = new DataMemberNode(this, dataSource, dataMember, propertyName, isList);
         nodes.Add(node);
         if (((this.selectedItem != null) && this.selectedItem.Equals(dataSource, dataMember)) && (node != null))
         {
             this.selectedNode = node;
         }
         if (!flag4)
         {
             this.AddDataMemberContents(node);
         }
     }
 }