private static TreeNode ConvertNode(Node node)
        {
            TreeNode treeNode = new TreeNode(node.Text);

            foreach(Node childNode in node.Children){
                treeNode.Nodes.Add(ConvertNode(childNode));
            }

            return treeNode;
        }
Beispiel #2
0
 public void Add(Node node)
 {
     PrepareChildList();
     children.Add(node);
 }
Beispiel #3
0
        private static Node GenerateTreeViewDataForType(JavaFileInfo fileInfo, Type type)
        {
            Type.TypeData data = type.GetData();
            Type.DataEnum dataEnum = data as Type.DataEnum;

            Node node = new Node(type.ToString());

            if (fileInfo != null){
                Node packageNode = new Node("[Package]");
                packageNode.Add(fileInfo.Package);
                node.Add(packageNode);

                Node importNode = new Node("[Imports]");
                importNode.AddRangeAsStrings(fileInfo.Imports);
                node.Add(importNode);
            }

            if (data.Fields.Count > 0){
                Node fieldNode = new Node("[Fields]");
                fieldNode.AddRangeAsStrings(data.Fields);
                node.Add(fieldNode);
            }

            if (data.Methods.Count > 0){
                Node methodNode = new Node("[Methods]");
                methodNode.AddRangeAsStrings(data.Methods);
                node.Add(methodNode);
            }

            if (type.NestedTypes.Count > 0){
                Node nestedNode = new Node("[Nested Types]");
                nestedNode.AddRange(type.NestedTypes.Select(nestedType => GenerateTreeViewDataForType(null, nestedType)));
                node.Add(nestedNode);
            }

            if (dataEnum != null){
                Node enumNode = new Node("[Enum Values]");
                enumNode.AddRange(dataEnum.EnumValues);
                node.Add(enumNode);
            }

            return node;
        }