diff --git a/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj b/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
index 2dc50c8917..4c19557479 100644
--- a/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
+++ b/src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
@@ -152,8 +152,10 @@
+
+
diff --git a/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs b/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs
index b3817cc24f..1907d78059 100644
--- a/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs
+++ b/src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs
@@ -140,7 +140,7 @@ namespace ICSharpCode.CodeQualityAnalysis
graphLayout.ChangeGraph(graph);
var viewModel = this.DataContext as MainWindowViewModel;
//testhalber
- viewModel.SelectedNode = item.INode;
+ viewModel.SelectedTreeNode = item.INode;
}
}
diff --git a/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs b/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs
index 395266ade0..8788fe7804 100644
--- a/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs
+++ b/src/AddIns/Analysis/CodeQuality/Src/MainWindowModel.cs
@@ -128,7 +128,7 @@ namespace ICSharpCode.CodeQualityAnalysis
public bool MetrixTabEnable
{
- get {return SelectedNode != null;}
+ get {return SelectedTreeNode != null;}
}
string typeInfo;
@@ -144,7 +144,8 @@ namespace ICSharpCode.CodeQualityAnalysis
public Module MainModule {
get { return mainModule; }
- set { mainModule = value;
+ set {
+ mainModule = value;
base.RaisePropertyChanged(() =>this.MainModule);
Summary = String.Format("Module Name: {0} Namespaces: {1} Types {2} Methods: {3} Fields: {4}",
mainModule.Name,
@@ -152,17 +153,16 @@ namespace ICSharpCode.CodeQualityAnalysis
mainModule.TypesCount,
mainModule.MethodsCount,
mainModule.FieldsCount);
- //queryModule = new QueryMethod(MainModule);
}
}
- private INode selectedNode;
+ private INode selectedTreeNode;
- public INode SelectedNode {
- get { return selectedNode; }
- set { selectedNode = value;
- base.RaisePropertyChanged(() =>this.SelectedNode);
+ public INode SelectedTreeNode {
+ get { return selectedTreeNode; }
+ set { selectedTreeNode = value;
+ base.RaisePropertyChanged(() =>this.SelectedTreeNode);
base.RaisePropertyChanged(() =>this.MetrixTabEnable);
Summary = UpdateToolStrip();
}
@@ -171,7 +171,7 @@ namespace ICSharpCode.CodeQualityAnalysis
string UpdateToolStrip()
{
- var t = SelectedNode as Type;
+ var t = SelectedTreeNode as Type;
if (t != null)
{
return string.Format("Type Namer {0} Methods {1} Fields {2}",
@@ -179,7 +179,7 @@ namespace ICSharpCode.CodeQualityAnalysis
t.GetAllMethods().Count(),
t.GetAllFields().Count());
}
- var ns = SelectedNode as Namespace;
+ var ns = SelectedTreeNode as Namespace;
if ( ns != null) {
return string.Format("Namespace Name {0} Types : {1} Methods: {2} Fields : {3}",
ns.Name,
@@ -212,25 +212,26 @@ namespace ICSharpCode.CodeQualityAnalysis
void ActivateMetricsExecute ()
{
+ BaseQuery query = null;
itemsWithCommand.Clear();
+
switch (SelectedMetricsLevel) {
case MetricsLevel.Assembly:
-
+ query = new QueryAssembly(MainModule);
break;
case MetricsLevel.Namespace:
- QueryNameSpace queryNs = new QueryNameSpace(MainModule);
- ItemsWithCommand = queryNs.GetQueryList();
+ query = new QueryNameSpace(MainModule);
break;
case MetricsLevel.Type:
-
+ query = new QueryType(MainModule);
break;
case MetricsLevel.Method:
- QueryMethod queryModule = new QueryMethod(MainModule);
- ItemsWithCommand = queryModule.GetQueryList();
+ query = new QueryMethod(MainModule);
break;
default:
throw new Exception("Invalid value for MetricsLevel");
}
+ ItemsWithCommand = query.GetQueryList();
}
#endregion
@@ -263,10 +264,20 @@ namespace ICSharpCode.CodeQualityAnalysis
void ExecuteSelectedItem()
{
- TreeValueProperty = SelectedItemWithCommand.Metrics;
- var list = SelectedItemWithCommand.Action.Invoke();
- if (list != null ) {
- Nodes = new ObservableCollection(list);
+ /*
+ var s = SelectedTreeNode;
+ var b = s as Namespace;
+ var c = s as Type;
+ var d = s as Method;
+ var a = s as Module;
+ */
+ if (SelectedItemWithCommand != null) {
+ TreeValueProperty = SelectedItemWithCommand.Metrics;
+
+ var list = SelectedItemWithCommand.Action.Invoke();
+ if (list != null ) {
+ Nodes = new ObservableCollection(list);
+ }
}
}
diff --git a/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/BaseQuery.cs b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/BaseQuery.cs
index 0b44182b34..ebd0f4e8f3 100644
--- a/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/BaseQuery.cs
+++ b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/BaseQuery.cs
@@ -21,11 +21,11 @@ namespace ICSharpCode.CodeQualityAnalysis.Utility.Queries
MainModule = mainModule;
}
- public Module MainModule {get; private set;}
+ protected Module MainModule {get; private set;}
public virtual List GetQueryList ()
{
- throw new InvalidOperationException("Must override");
+ return null;
}
}
}
diff --git a/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryAssembly.cs b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryAssembly.cs
new file mode 100644
index 0000000000..4c41ad0bb9
--- /dev/null
+++ b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryAssembly.cs
@@ -0,0 +1,42 @@
+/*
+ * Created by SharpDevelop.
+ * User: Peter Forstmeier
+ * Date: 05.01.2012
+ * Time: 20:13
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+using System.Collections.Generic;
+using ICSharpCode.Core;
+
+namespace ICSharpCode.CodeQualityAnalysis.Utility.Queries
+{
+ ///
+ /// Description of QueryAssembly.
+ ///
+ public class QueryAssembly:BaseQuery
+ {
+ public QueryAssembly(Module mainModule):base(mainModule)
+ {
+ }
+
+ public override System.Collections.Generic.List GetQueryList()
+ {
+ List items = new List();
+ items.Add(new ItemWithAction()
+ {
+ Description = "# of NameSpaces",
+ Metrics = "Instructions.Count",
+ Action = ExecuteNotImplemented
+ });
+ return items;
+ }
+
+ private List ExecuteNotImplemented()
+ {
+ MessageService.ShowMessage("Not Implemented yet","CodeQualityAnalysis");
+ return null;
+ }
+ }
+}
diff --git a/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryMethod.cs b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryMethod.cs
index 0914debd32..f9c43ce774 100644
--- a/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryMethod.cs
+++ b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryMethod.cs
@@ -24,7 +24,6 @@ namespace ICSharpCode.CodeQualityAnalysis.Utility.Queries
{
}
-
private List QueryForMethod()
{
IEnumerable query = new List();
@@ -35,17 +34,6 @@ namespace ICSharpCode.CodeQualityAnalysis.Utility.Queries
return query.ToList();
}
- /*
- private List QueryForMethod()
- {
- IEnumerable query = new List();
- query = from ns in MainModule.Namespaces
- from type in ns.Types
- from method in type.Methods
- select method;
- return query.ToList();
- }
- */
public override List GetQueryList()
{
@@ -58,7 +46,7 @@ namespace ICSharpCode.CodeQualityAnalysis.Utility.Queries
});
items.Add(new ItemWithAction()
{
- Description = "Cyclomatic Complexity",
+ Description = "IL Cyclomatic Complexity",
Metrics = Metrics.CyclomaticComplexity.ToString(),
Action = ExecuteMethodComplexity
});
diff --git a/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryNameSpace.cs b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryNameSpace.cs
index 506e4707dd..1ef384ca44 100644
--- a/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryNameSpace.cs
+++ b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryNameSpace.cs
@@ -25,6 +25,12 @@ namespace ICSharpCode.CodeQualityAnalysis.Utility.Queries
public override List GetQueryList()
{
List items = new List();
+ items.Add(new ItemWithAction()
+ {
+ Description = "# of IL Instructions",
+ Metrics = "Instructions.Count",
+ Action = ExecuteNotImplemented
+ });
items.Add(new ItemWithAction()
{
Description = "# of Methods",
diff --git a/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryType.cs b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryType.cs
new file mode 100644
index 0000000000..f8747fa7fe
--- /dev/null
+++ b/src/AddIns/Analysis/CodeQuality/Src/Utility/Queries/QueryType.cs
@@ -0,0 +1,62 @@
+/*
+ * Created by SharpDevelop.
+ * User: Peter Forstmeier
+ * Date: 03.01.2012
+ * Time: 19:51
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+using System.Collections.Generic;
+using ICSharpCode.Core;
+
+namespace ICSharpCode.CodeQualityAnalysis.Utility.Queries
+{
+ ///
+ /// Description of QueryType.
+ ///
+ public class QueryType:BaseQuery
+ {
+ public QueryType(Module mainModule):base(mainModule)
+ {
+ }
+
+ public override System.Collections.Generic.List GetQueryList()
+ {
+ List items = new List();
+ items.Add(new ItemWithAction()
+ {
+ Description = "# of IL Instructions",
+ Metrics = "Instructions.Count",
+ Action = ExecuteNotImplemented
+ });
+
+ items.Add(new ItemWithAction()
+ {
+ Description = "IL Cyclomatic Complexity",
+ Metrics = Metrics.CyclomaticComplexity.ToString(),
+ Action = ExecuteNotImplemented
+ });
+ items.Add(new ItemWithAction()
+ {
+ Description = "# of Methods",
+ Metrics = Metrics.CyclomaticComplexity.ToString(),
+ Action = ExecuteNotImplemented
+ });
+ items.Add(new ItemWithAction()
+ {
+ Description = "# of Fields",
+ Metrics = Metrics.Variables.ToString(),
+ Action = ExecuteNotImplemented
+ });
+
+ return items;
+ }
+
+ private List ExecuteNotImplemented()
+ {
+ MessageService.ShowMessage("Not Implemented yet","CodeQualityAnalysis");
+ return null;
+ }
+ }
+}