~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageNamespaceTreeNode.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Collections.Generic;
 
6
 
 
7
namespace ICSharpCode.CodeCoverage
 
8
{
 
9
        public class CodeCoverageNamespaceTreeNode : CodeCoverageMethodsTreeNode
 
10
        {
 
11
                string namespacePrefix = String.Empty;
 
12
                                
 
13
                public CodeCoverageNamespaceTreeNode(string name, List<CodeCoverageMethod> methods)
 
14
                        : this(String.Empty, name, methods)
 
15
                {
 
16
                }
 
17
                
 
18
                public CodeCoverageNamespaceTreeNode(string namespacePrefix, string name, List<CodeCoverageMethod> methods) : base(name, methods, CodeCoverageImageListIndex.Namespace)
 
19
                {
 
20
                        sortOrder = 1;
 
21
                        this.namespacePrefix = namespacePrefix;
 
22
                }
 
23
                
 
24
                protected override void Initialize()
 
25
                {
 
26
                        Nodes.Clear();
 
27
                        
 
28
                        // Add namespace nodes.
 
29
                        string fullNamespace = CodeCoverageMethod.GetFullNamespace(namespacePrefix, Name);
 
30
                        foreach (string namespaceName in CodeCoverageMethod.GetChildNamespaces(Methods, fullNamespace)) {
 
31
                                string childFullNamespace = CodeCoverageMethod.GetFullNamespace(fullNamespace, namespaceName);
 
32
                                CodeCoverageNamespaceTreeNode node = new CodeCoverageNamespaceTreeNode(fullNamespace, namespaceName, CodeCoverageMethod.GetAllMethods(Methods, childFullNamespace));
 
33
                                node.AddTo(this);
 
34
                        }
 
35
                        
 
36
                        // Add class nodes for this namespace.
 
37
                        foreach (string className in CodeCoverageMethod.GetClassNames(Methods, fullNamespace)) {
 
38
                                CodeCoverageClassTreeNode classNode = new CodeCoverageClassTreeNode(className, CodeCoverageMethod.GetMethods(Methods, fullNamespace, className));
 
39
                                classNode.AddTo(this);
 
40
                        }
 
41
                        
 
42
                        // Sort nodes added.
 
43
                        SortChildNodes();
 
44
                }
 
45
        }
 
46
}