Permalink
Browse files

CodeQualityAnalyis Sort members in TreeViews

  • Loading branch information...
1 parent 95c3cd9 commit 554f23a2ae43e5bfd352e48cba7deed78b470605 @PeterForstmeier PeterForstmeier committed Dec 18, 2011
View
5 src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.addin
@@ -14,10 +14,15 @@
</Runtime>
<Path name = "/SharpDevelop/Workbench/MainMenu/Analysis">
+ <MenuItem id = "GenerateDependencyGraph"
+ label = "Generate Dependency Graph"
+ class = "ICSharpCode.CodeQualityAnalysis.DependencyGraphCommand" />
+ <!--
<Condition name = "ProjectActive" activeproject="*">
<MenuItem id = "GenerateDependencyGraph"
label = "Generate Dependency Graph"
class = "ICSharpCode.CodeQualityAnalysis.DependencyGraphCommand" />
</Condition>
+-->
</Path>
</AddIn>
View
3 src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs
@@ -251,6 +251,9 @@ void ShowTreemapExecute ()
Nodes = PrepareNodes();
var aa = SelectedNode as INode;
+ var m = aa as Method;
+ var t = aa as Type;
+ var n = aa as Namespace;
switch (selectedMetrics)
{
View
27 src/AddIns/Analysis/CodeQuality/Src/Utility/Helper.cs
@@ -2,11 +2,13 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
+
using ICSharpCode.TreeView;
-using System.Runtime.InteropServices;
namespace ICSharpCode.CodeQualityAnalysis.Utility
{
@@ -24,23 +26,38 @@ public static void FillTree(SharpTreeView tree, Module module)
tree.Root = root;
tree.ShowRoot = false;
- foreach (var ns in module.Namespaces)
+ var sortedNameSpaces = new List<Namespace>();
+ sortedNameSpaces.AddRange (module.Namespaces);
+ sortedNameSpaces.Sort((Namespace a,Namespace b) => String.Compare(a.Name, b.Name) );
+
+ foreach (var ns in sortedNameSpaces)
+// foreach (var ns in module.Namespaces)
{
var namespaceNode = CreateTreeItem(ns);
tree.Root.Children.Add(namespaceNode);
- foreach (var type in ns.Types)
+ var sortedTypes = new List<Type>();
+ sortedTypes.AddRange(ns.Types);
+ sortedTypes.Sort((Type a,Type b) => String.Compare(a.Name, b.Name) );
+ foreach (var type in sortedTypes)
{
var typeNode = CreateTreeItem(type);
namespaceNode.Children.Add(typeNode);
- foreach (var method in type.Methods)
+ var sortedMethods = new List<Method>();
+ sortedMethods.AddRange(type.Methods);
+ sortedMethods.Sort((Method a,Method b) => String.Compare(a.Name, b.Name) );
+ foreach (var method in sortedMethods)
{
var methodName = CreateTreeItem(method);
typeNode.Children.Add(methodName);
}
- foreach (var field in type.Fields)
+
+ var sortedFields = new List<Field>();
+ sortedFields.AddRange(type.Fields);
+ sortedFields.Sort((Field a,Field b) => String.Compare(a.Name, b.Name) );
+ foreach (var field in sortedFields)
{
var fieldNode = CreateTreeItem(field);
typeNode.Children.Add(fieldNode);

0 comments on commit 554f23a

Please sign in to comment.