Browse Source

- Tree for browsing has been rewritten to XAML. It allows nice styling options.

- Collection's properties got private setter.
- First draft of Dependency Matrix which uses a tree.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6251 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Tomáš Linhart 16 years ago
parent
commit
737c524a7c
  1. 18
      src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
  2. 38
      src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml
  3. 101
      src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml.cs
  4. 4
      src/AddIns/Analysis/CodeQuality/Src/Event.cs
  5. 7
      src/AddIns/Analysis/CodeQuality/Src/Field.cs
  6. 2
      src/AddIns/Analysis/CodeQuality/Src/INode.cs
  7. 45
      src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml
  8. 162
      src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs
  9. 15
      src/AddIns/Analysis/CodeQuality/Src/Method.cs
  10. 19
      src/AddIns/Analysis/CodeQuality/Src/MetricsReader.cs
  11. 6
      src/AddIns/Analysis/CodeQuality/Src/Module.cs
  12. 6
      src/AddIns/Analysis/CodeQuality/Src/Namespace.cs
  13. 29
      src/AddIns/Analysis/CodeQuality/Src/Type.cs

18
src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj

@ -38,19 +38,6 @@ @@ -38,19 +38,6 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<OutputPath>bin\Debug\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release' ">
<DebugType>pdbonly</DebugType>
<OutputPath>bin\Release\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
@ -128,6 +115,10 @@ @@ -128,6 +115,10 @@
<Compile Include="Src\Controls\DependencyVertex.cs" />
<Compile Include="Src\Controls\Matrix.cs" />
<Compile Include="Src\Controls\MatrixControl.cs" />
<Compile Include="Src\Controls\TreeMatrixControl.xaml.cs">
<DependentUpon>TreeMatrixControl.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\DependencyGraphCommand.cs" />
<Compile Include="Src\Event.cs" />
<Compile Include="Src\Field.cs" />
@ -144,6 +135,7 @@ @@ -144,6 +135,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Src\Controls\TreeMatrixControl.xaml" />
<Page Include="Src\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

38
src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
<UserControl x:Class="ICSharpCode.CodeQualityAnalysis.Controls.TreeMatrixControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.CodeQualityAnalysis.Controls">
<UserControl.Resources>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="Header" Value="test" />
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TreeView Name="leftTree" Grid.Row="1" Grid.Column="0">
<TreeView.Resources>
</TreeView.Resources>
</TreeView>
<TreeView Name="topTree" Grid.Row="0" Grid.Column="1">
<TreeView.LayoutTransform>
<RotateTransform Angle="-90" />
</TreeView.LayoutTransform>
</TreeView>
<WindowsFormsHost Grid.Column="1" Grid.Row="1">
<Controls:DependencyMatrixControl x:Name="matrixControl"></Controls:DependencyMatrixControl>
</WindowsFormsHost>
</Grid>
</UserControl>

101
src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml.cs

@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
/*
* Created by SharpDevelop.
* User: Tomas
* Date: 26.7.2010
* Time: 10:08
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Forms;
namespace ICSharpCode.CodeQualityAnalysis.Controls
{
/// <summary>
/// Interaction logic for TreeMatrixControl.xaml
/// </summary>
public partial class TreeMatrixControl : System.Windows.Controls.UserControl
{
public Matrix<INode> Matrix
{
get
{
return matrixControl.Matrix;
}
set
{
matrixControl.Matrix = value;
}
}
public TreeMatrixControl()
{
InitializeComponent();
matrixControl.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
matrixControl.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
matrixControl.BorderStyle = BorderStyle.FixedSingle;
matrixControl.RowHeadersVisible = false;
matrixControl.ColumnHeadersVisible = false;
}
public void DrawMatrix()
{
matrixControl.DrawMatrix();
}
public void DrawTree(Module module)
{
foreach (var ns in module.Namespaces)
{
var nsType = new TreeViewItem
{
Header = ns.Name
};
leftTree.Items.Add(nsType);
foreach (var type in ns.Types)
{
var itemType = new TreeViewItem
{
Header = type.Name
};
nsType.Items.Add(itemType);
foreach (var method in type.Methods)
{
var itemMethod = new TreeViewItem
{
Header = method.Name
};
itemType.Items.Add(itemMethod);
}
foreach (var field in type.Fields)
{
var itemField = new TreeViewItem
{
Header = field.Name
};
itemType.Items.Add(itemField);
}
}
}
}
}
}

4
src/AddIns/Analysis/CodeQuality/Src/Event.cs

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
using QuickGraph;
namespace ICSharpCode.CodeQualityAnalysis
@ -46,5 +48,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -46,5 +48,7 @@ namespace ICSharpCode.CodeQualityAnalysis
// Events aren't visible. They are showed like fields instead.
return this.ToString();
}
public BitmapSource Icon { get { return null; } }
}
}

7
src/AddIns/Analysis/CodeQuality/Src/Field.cs

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
using QuickGraph;
namespace ICSharpCode.CodeQualityAnalysis
@ -66,13 +68,14 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -66,13 +68,14 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// If the field has generic instance so all types used in generic are presented in this set.
/// </summary>
public ISet<Type> GenericTypes { get; set; }
public ISet<Type> GenericTypes { get; private set; }
public Field()
{
FieldType = null;
IsEvent = false;
Owner = null;
GenericTypes = new HashSet<Type>();
Dependency = null;
}
@ -117,5 +120,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -117,5 +120,7 @@ namespace ICSharpCode.CodeQualityAnalysis
return builder.ToString();
}
public BitmapSource Icon { get { return NodeIconService.GetIcon(this); } }
}
}

2
src/AddIns/Analysis/CodeQuality/Src/INode.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
namespace ICSharpCode.CodeQualityAnalysis
{
@ -11,5 +12,6 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -11,5 +12,6 @@ namespace ICSharpCode.CodeQualityAnalysis
IDependency Dependency { set; get; }
string GetInfo();
Relationship GetRelationship(INode node);
BitmapSource Icon { get; }
}
}

45
src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls;assembly=ICSharpCode.WpfDesign.Designer"
xmlns:Graph="clr-namespace:ICSharpCode.CodeQualityAnalysis.Controls"
xmlns:src="clr-namespace:ICSharpCode.CodeQualityAnalysis"
Title="Code Quality Analysis"
x:Name="root">
<Window.Resources>
@ -10,6 +11,40 @@ @@ -10,6 +11,40 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Resources/GraphTemplate.xaml" />
</ResourceDictionary.MergedDictionaries>
<DataTemplate x:Key="MemberTemplate">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Icon}" Margin="0, 0, 0, 3" />
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</DataTemplate>
<HierarchicalDataTemplate x:Key="TypeTemplate"
ItemTemplate="{StaticResource MemberTemplate}"
ItemsSource="{Binding Members}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Icon}" />
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate x:Key="NamespaceTemplate"
ItemsSource="{Binding Types}"
ItemTemplate="{StaticResource TypeTemplate}">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Icon}" />
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Namespaces}"
ItemTemplate="{StaticResource NamespaceTemplate}"
x:Key="ModuleTemplate">
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Path=Icon}" />
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</HierarchicalDataTemplate>
</ResourceDictionary>
</Window.Resources>
@ -37,7 +72,11 @@ @@ -37,7 +72,11 @@
</ToolBar>
</ToolBarTray>
<TreeView Name="definitionTree" Grid.Row="1" Grid.Column="0" SelectedItemChanged="definitionTree_SelectedItemChanged" />
<TreeView Name="definitionTree" Grid.Row="1" Grid.Column="0"
SelectedItemChanged="definitionTree_SelectedItemChanged"
ItemsSource="{Binding}"
ItemTemplate="{StaticResource ModuleTemplate}">
</TreeView>
<Controls:ZoomControl Grid.Row="1" Grid.Column="1" Name="zoom" AlwaysShowZoomButtons="True" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
<Graph:DependencyGraphLayout x:Name="graphLayout"
@ -52,9 +91,7 @@ @@ -52,9 +91,7 @@
</Grid>
</TabItem>
<TabItem Header="Dependency Matrix">
<WindowsFormsHost>
<Graph:DependencyMatrixControl x:Name="matrixControl"></Graph:DependencyMatrixControl>
</WindowsFormsHost>
<Graph:TreeMatrixControl x:Name="matrixControl"></Graph:TreeMatrixControl>
</TabItem>
</TabControl>
</Window>

162
src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
@ -12,6 +13,7 @@ using System.Windows.Media; @@ -12,6 +13,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GraphSharp.Controls;
using ICSharpCode.CodeQualityAnalysis.Controls;
using ICSharpCode.Core.Presentation;
@ -27,15 +29,36 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -27,15 +29,36 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : Window, INotifyPropertyChanged
{
private MetricsReader metricsReader;
public event PropertyChangedEventHandler PropertyChanged;
public MetricsReader MetricsReader
{
private MetricsReader _metricsReader;
get
{
return metricsReader;
}
set
{
metricsReader = value;
NotifyPropertyChanged("MetricsReader");
}
}
public MainWindow()
{
InitializeComponent();
}
private void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
private void btnOpenAssembly_Click(object sender, RoutedEventArgs e)
{
var fileDialog = new OpenFileDialog
@ -50,9 +73,8 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -50,9 +73,8 @@ namespace ICSharpCode.CodeQualityAnalysis
definitionTree.Items.Clear();
_metricsReader = new MetricsReader(fileDialog.FileName);
FillTree();
MetricsReader = new MetricsReader(fileDialog.FileName);
definitionTree.ItemsSource = metricsReader.Modules;
FillMatrix();
}
@ -67,74 +89,11 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -67,74 +89,11 @@ namespace ICSharpCode.CodeQualityAnalysis
graphLayout.ContinueLayout();
}
/// <summary>
/// Fill tree with module, types and methods and fields
/// </summary>
private void FillTree()
{
var itemModule = new MetricTreeViewItem
{
Text = _metricsReader.MainModule.Name,
Dependency = _metricsReader.MainModule,
Icon = NodeIconService.GetIcon(_metricsReader.MainModule)
};
definitionTree.Items.Add(itemModule);
foreach (var ns in _metricsReader.MainModule.Namespaces)
{
var nsType = new MetricTreeViewItem
{
Text = ns.Name,
Dependency = ns,
Icon = NodeIconService.GetIcon(ns)
};
itemModule.Items.Add(nsType);
foreach (var type in ns.Types)
{
var itemType = new MetricTreeViewItem
{
Text = type.Name,
Dependency = type,
Icon = NodeIconService.GetIcon(type)
};
nsType.Items.Add(itemType);
foreach (var method in type.Methods)
{
var itemMethod = new MetricTreeViewItem
{
Text = method.Name,
Dependency = null,
Icon = NodeIconService.GetIcon(method)
};
itemType.Items.Add(itemMethod);
}
foreach (var field in type.Fields)
{
var itemField = new MetricTreeViewItem
{
Text = field.Name,
Dependency = null,
Icon = NodeIconService.GetIcon(field)
};
itemType.Items.Add(itemField);
}
}
}
}
private void FillMatrix()
{
var matrix = new DependencyMatrix();
foreach (var ns in _metricsReader.MainModule.Namespaces) {
foreach (var ns in metricsReader.MainModule.Namespaces) {
matrix.HeaderRows.Add(new MatrixCell<INode>(ns));
foreach (var type in ns.Types) {
matrix.HeaderRows.Add(new MatrixCell<INode>(type));
@ -147,11 +106,12 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -147,11 +106,12 @@ namespace ICSharpCode.CodeQualityAnalysis
matrixControl.Matrix = matrix;
matrixControl.DrawMatrix();
matrixControl.DrawTree(metricsReader.MainModule);
}
private void definitionTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
var item = definitionTree.SelectedItem as MetricTreeViewItem;
var item = definitionTree.SelectedItem as INode;
if (item != null && item.Dependency != null)
{
@ -228,67 +188,5 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -228,67 +188,5 @@ namespace ICSharpCode.CodeQualityAnalysis
encoder.Save(outStream);
}
}
private class MetricTreeViewItem : TreeViewItem
{
private readonly Image _iconControl;
private readonly TextBlock _textControl;
private BitmapSource _bitmap;
public IDependency Dependency { get; set; }
/// <summary>
/// Gets or sets the text content for the item
/// </summary>
public string Text
{
get
{
return _textControl.Text;
}
set
{
_textControl.Text = value;
}
}
/// <summary>
/// Gets or sets the icon for the item
/// </summary>
public BitmapSource Icon
{
get
{
return _bitmap;
}
set
{
_iconControl.Source = _bitmap = value;
}
}
public MetricTreeViewItem()
{
var stack = new StackPanel
{
Orientation = Orientation.Horizontal
};
Header = stack;
_iconControl = new Image
{
Margin = new Thickness(0, 0, 5, 0)
};
_textControl = new TextBlock()
{
VerticalAlignment = VerticalAlignment.Center
};
stack.Children.Add(_iconControl);
stack.Children.Add(_textControl);
}
}
}
}

15
src/AddIns/Analysis/CodeQuality/Src/Method.cs

@ -1,7 +1,10 @@ @@ -1,7 +1,10 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
using QuickGraph;
namespace ICSharpCode.CodeQualityAnalysis
@ -11,22 +14,22 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -11,22 +14,22 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// Parameters which are used by method
/// </summary>
public ISet<MethodParameter> Parameters { get; set; }
public ISet<MethodParameter> Parameters { get; private set; }
/// <summary>
/// Types which are used in body of method
/// </summary>
public ISet<Type> TypeUses { get; set; }
public ISet<Type> TypeUses { get; private set; }
/// <summary>
/// Methods which are called in body of method
/// </summary>
public ISet<Method> MethodUses { get; set; }
public ISet<Method> MethodUses { get; private set; }
/// <summary>
/// Fields which are accesed in body of method
/// </summary>
public ISet<Field> FieldUses { get; set; }
public ISet<Field> FieldUses { get; private set; }
/// <summary>
/// A name of method
@ -96,7 +99,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -96,7 +99,7 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// If the return type is generic instance so all types used in generic are presented in this set.
/// </summary>
public ISet<Type> GenericReturnTypes { get; set; }
public ISet<Type> GenericReturnTypes { get; private set; }
/// <summary>
/// Whether the return type is generic instance
@ -167,6 +170,8 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -167,6 +170,8 @@ namespace ICSharpCode.CodeQualityAnalysis
return builder.ToString();
}
public BitmapSource Icon { get { return NodeIconService.GetIcon(this); } }
}
public class MethodParameter

19
src/AddIns/Analysis/CodeQuality/Src/MetricsReader.cs

@ -16,10 +16,12 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -16,10 +16,12 @@ namespace ICSharpCode.CodeQualityAnalysis
IDictionary<MemberReference, string> nameCache;
public Module MainModule { get; private set; }
public ISet<Module> Modules { get; private set; }
public MetricsReader(string file)
{
nameCache = new Dictionary<MemberReference, string>();
Modules = new HashSet<Module>();
ReadAssembly(file);
}
@ -31,6 +33,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -31,6 +33,7 @@ namespace ICSharpCode.CodeQualityAnalysis
{
var assembly = AssemblyDefinition.ReadAssembly(file);
ReadModule(assembly.MainModule);
// support for additional modules but never seen assembly with more than one
}
/// <summary>
@ -39,11 +42,13 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -39,11 +42,13 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <param name="moduleDefinition">A module which contains information</param>
private void ReadModule(ModuleDefinition moduleDefinition)
{
this.MainModule = new Module()
MainModule = new Module()
{
Name = moduleDefinition.Name
};
Modules.Add(MainModule);
if (moduleDefinition.HasTypes)
ReadTypes(MainModule, moduleDefinition.Types);
}
@ -183,8 +188,8 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -183,8 +188,8 @@ namespace ICSharpCode.CodeQualityAnalysis
if (typeDefinition.BaseType.IsGenericInstance)
{
type.IsBaseTypeGenericInstance = true;
type.GenericBaseTypes = ReadGenericArguments(type.Namespace.Module,
(GenericInstanceType)typeDefinition.BaseType);
type.GenericBaseTypes.UnionWith(ReadGenericArguments(type.Namespace.Module,
(GenericInstanceType)typeDefinition.BaseType));
}
}
@ -298,8 +303,8 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -298,8 +303,8 @@ namespace ICSharpCode.CodeQualityAnalysis
if (fieldDefinition.FieldType.IsGenericInstance)
{
field.IsGenericInstance = true;
field.GenericTypes = ReadGenericArguments(type.Namespace.Module,
(GenericInstanceType)fieldDefinition.FieldType);
field.GenericTypes.UnionWith(ReadGenericArguments(type.Namespace.Module,
(GenericInstanceType)fieldDefinition.FieldType));
}
field.FieldType = fieldType;
@ -342,8 +347,8 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -342,8 +347,8 @@ namespace ICSharpCode.CodeQualityAnalysis
if (methodDefinition.ReturnType.IsGenericInstance)
{
method.IsReturnTypeGenericInstance = true;
method.GenericReturnTypes = ReadGenericArguments(type.Namespace.Module,
(GenericInstanceType) methodDefinition.ReturnType);
method.GenericReturnTypes.UnionWith(ReadGenericArguments(type.Namespace.Module,
(GenericInstanceType) methodDefinition.ReturnType));
}
// reading types from parameters

6
src/AddIns/Analysis/CodeQuality/Src/Module.cs

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
using ICSharpCode.CodeQualityAnalysis.Controls;
using QuickGraph;
@ -14,7 +16,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -14,7 +16,7 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// Namespaces within module
/// </summary>
public ISet<Namespace> Namespaces { get; set; }
public ISet<Namespace> Namespaces { get; private set; }
/// <summary>
/// Name of module
@ -86,5 +88,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -86,5 +88,7 @@ namespace ICSharpCode.CodeQualityAnalysis
return builder.ToString();
}
public BitmapSource Icon { get { return NodeIconService.GetIcon(this); } }
}
}

6
src/AddIns/Analysis/CodeQuality/Src/Namespace.cs

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
using ICSharpCode.CodeQualityAnalysis.Controls;
using QuickGraph;
@ -14,7 +16,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -14,7 +16,7 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// Types within namespace
/// </summary>
public ISet<Type> Types { get; set; }
public ISet<Type> Types { get; private set; }
/// <summary>
/// Name of namespace
@ -224,5 +226,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -224,5 +226,7 @@ namespace ICSharpCode.CodeQualityAnalysis
return builder.ToString();
}
public BitmapSource Icon { get { return NodeIconService.GetIcon(this); } }
}
}

29
src/AddIns/Analysis/CodeQuality/Src/Type.cs

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
using ICSharpCode.CodeQualityAnalysis.Controls;
using QuickGraph;
@ -14,7 +16,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -14,7 +16,7 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// Nested types like inner classes, interfaces and so on.
/// </summary>
public ISet<Type> NestedTypes { get; set; }
public ISet<Type> NestedTypes { get; private set; }
/// <summary>
/// Type which owns this type. If this isn't nested type so Owner is null.
@ -29,22 +31,33 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -29,22 +31,33 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// Interfaces which are implemented by this type
/// </summary>
public ISet<Type> ImplementedInterfaces { get; set; }
public ISet<Type> ImplementedInterfaces { get; private set; }
/// <summary>
/// Methods within type
/// </summary>
public ISet<Method> Methods { get; set; }
public ISet<Method> Methods { get; private set; }
/// <summary>
/// Fields within type
/// </summary>
public ISet<Field> Fields { get; set; }
public ISet<Field> Fields { get; private set; }
/// <summary>
/// Members of type such as methods and fields
/// </summary>
public IEnumerable<INode> Members
{
get
{
return new HashSet<INode>(Methods).Union(Fields);
}
}
/// <summary>
/// Events within type
/// </summary>
public ISet<Event> Events { get; set; }
public ISet<Event> Events { get; private set; }
/// <summary>
/// Name of type with a name of namespace.
@ -135,12 +148,12 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -135,12 +148,12 @@ namespace ICSharpCode.CodeQualityAnalysis
/// <summary>
/// If the base type is generic instance so all types used in generic are presented in this set.
/// </summary>
public ISet<Type> GenericBaseTypes { get; set; }
public ISet<Type> GenericBaseTypes { get; private set; }
/// <summary>
/// If one of implemented interfaces is generic instance so all types used in generic are presented in this set.
/// </summary>
public ISet<Type> GenericImplementedInterfacesTypes { get; set; }
public ISet<Type> GenericImplementedInterfacesTypes { get; private set; }
public Type()
{
@ -302,5 +315,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -302,5 +315,7 @@ namespace ICSharpCode.CodeQualityAnalysis
return builder.ToString();
}
public BitmapSource Icon { get { return NodeIconService.GetIcon(this); } }
}
}

Loading…
Cancel
Save