Browse Source

Use ICSharpCode.TreeView in DependencyMatrixControl

pull/19/head
PeterForstmeier 15 years ago
parent
commit
582a1cf7f1
  1. 5
      src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
  2. 12
      src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.sln
  3. 34
      src/AddIns/Analysis/CodeQuality/Src/Controls/DependecyTreeNode.cs
  4. 40
      src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml
  5. 38
      src/AddIns/Analysis/CodeQuality/Src/Controls/TreeMatrixControl.xaml.cs

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

@ -113,6 +113,7 @@
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs"> <Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link> <Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile> </Compile>
<Compile Include="Src\Controls\DependecyTreeNode.cs" />
<Compile Include="Src\Controls\DependencyEdge.cs" /> <Compile Include="Src\Controls\DependencyEdge.cs" />
<Compile Include="Src\Controls\DependencyGraph.cs" /> <Compile Include="Src\Controls\DependencyGraph.cs" />
<Compile Include="Src\Controls\DependencyGraphLayout.cs" /> <Compile Include="Src\Controls\DependencyGraphLayout.cs" />
@ -210,6 +211,10 @@
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project> <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name> <Name>Mono.Cecil</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Libraries\SharpTreeView\ICSharpCode.TreeView\ICSharpCode.TreeView.csproj">
<Project>{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}</Project>
<Name>ICSharpCode.TreeView</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> <ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> <Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name> <Name>ICSharpCode.SharpDevelop</Name>

12
src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.sln

@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Do
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "..\..\..\Libraries\Mono.Cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "..\..\..\Libraries\Mono.Cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TreeView", "..\..\..\Libraries\SharpTreeView\ICSharpCode.TreeView\ICSharpCode.TreeView.csproj", "{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -73,13 +75,21 @@ Global
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.Build.0 = Release|Any CPU {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.Build.0 = Release|Any CPU
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.ActiveCfg = Release|Any CPU {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.ActiveCfg = Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = net_2_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.ActiveCfg = net_2_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.Build.0 = net_2_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.ActiveCfg = net_2_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x86.ActiveCfg = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.Build.0 = net_2_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = net_2_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.Build.0 = net_2_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.Build.0 = net_2_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.ActiveCfg = net_2_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|x86.ActiveCfg = net_2_0_Debug|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|x86.Build.0 = Debug|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|x86.ActiveCfg = Debug|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|Any CPU.Build.0 = Release|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|x86.Build.0 = Release|Any CPU
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

34
src/AddIns/Analysis/CodeQuality/Src/Controls/DependecyTreeNode.cs

@ -0,0 +1,34 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 02.09.2011
* Time: 15:10
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using ICSharpCode.TreeView;
namespace ICSharpCode.CodeQualityAnalysis.Controls
{
/// <summary>
/// Description of DependecyTreeNode.
/// </summary>
public class DependecyTreeNode:SharpTreeNode
{
private INode node;
public DependecyTreeNode(INode node)
{
this.node = node;
}
public override object Text
{
get { return node.Name; }
}
public override object ToolTip {
get { return node.Name; }
}
}
}

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

@ -1,21 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<UserControl <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"> 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"
xmlns:tree="http://icsharpcode.net/sharpdevelop/treeview">
<UserControl.Resources> <UserControl.Resources>
<Style <Style
TargetType="{x:Type TreeViewItem}"> TargetType="{x:Type tree:SharpTreeNodeView}"
<Setter >
Property="BorderBrush" <Setter Property="Height" Value="36" />
Value="Red" />
<Setter
Property="Header"
Value="test" />
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition <RowDefinition
Height="Auto" /> Height="70" />
<RowDefinition <RowDefinition
Height="3" /> Height="3" />
<RowDefinition <RowDefinition
@ -24,39 +25,38 @@
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition <ColumnDefinition
Width="Auto" /> Width="70" />
<ColumnDefinition <ColumnDefinition
Width="3" /> Width="3" />
<ColumnDefinition <ColumnDefinition
Width="*" /> Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TreeView <tree:SharpTreeView
Name="leftTree" Name="leftTree"
Grid.Row="2" Grid.Row="2"
Grid.Column="0"> Grid.Column="0">
<TreeView.Resources></TreeView.Resources> </tree:SharpTreeView>
</TreeView>
<GridSplitter Grid.Column="1" Width="3" <GridSplitter Grid.Column="1" Width="3"
Grid.RowSpan="3" Grid.RowSpan="3"
ResizeDirection="Columns" ResizeDirection="Columns"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"></GridSplitter> VerticalAlignment="Stretch"></GridSplitter>
<TreeView <tree:SharpTreeView
Name="topTree" Name="topTree"
Grid.Row="0" Grid.Row="0"
Grid.Column="2"> Grid.Column="2">
<TreeView.LayoutTransform> <tree:SharpTreeView.LayoutTransform>
<RotateTransform <RotateTransform
Angle="-90" /> Angle="-90" />
</TreeView.LayoutTransform> </tree:SharpTreeView.LayoutTransform>
</TreeView> </tree:SharpTreeView>
<GridSplitter Grid.Row="1" <GridSplitter Grid.Row="1"
Grid.Column="2" Grid.Column="2"
Height="3" Height="3"
ResizeDirection="Rows" ResizeDirection="Rows"
HorizontalAlignment="Stretch"></GridSplitter> HorizontalAlignment="Stretch"></GridSplitter>

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

@ -44,48 +44,44 @@ namespace ICSharpCode.CodeQualityAnalysis.Controls
{ {
FillTree (leftTree,module); FillTree (leftTree,module);
FillTree (topTree,module); FillTree (topTree,module);
} }
private void FillTree (System.Windows.Controls.TreeView tree,Module module)
private void FillTree (ICSharpCode.TreeView.SharpTreeView tree,Module module)
{ {
var root = CreateTreeItem(module);
tree.Root = root;
foreach (var ns in module.Namespaces) foreach (var ns in module.Namespaces)
{ {
var leftType = CreateTreeItem(ns.Name); var namespaceNode = CreateTreeItem(ns);
tree.Root.Children.Add(namespaceNode);
tree.Items.Add(leftType);
foreach (var type in ns.Types) foreach (var type in ns.Types)
{ {
var lType = CreateTreeItem(type.Name); var typeNode = CreateTreeItem(type);
namespaceNode.Children.Add(typeNode);
leftType.Items.Add(lType);
foreach (var method in type.Methods) foreach (var method in type.Methods)
{ {
var leftMethod = CreateTreeItem(method.Name); var methodName = CreateTreeItem(method);
leftType.Items.Add(leftMethod); namespaceNode.Children.Add(methodName);
} }
foreach (var field in type.Fields) foreach (var field in type.Fields)
{ {
var leftField = CreateTreeItem(field.Name); var fieldNode = CreateTreeItem(field);
leftType.Items.Add(leftField); namespaceNode.Children.Add(fieldNode);
} }
} }
} }
} }
private TreeViewItem CreateTreeItem (string ns) private DependecyTreeNode CreateTreeItem (INode node)
{ {
var nsType = new TreeViewItem DependecyTreeNode dtn = new DependecyTreeNode(node);
{ return dtn;
Header = ns,
ToolTip = ns
};
// nsType.Height = matrixControl.CellHeight;
return nsType;
} }
} }
} }

Loading…
Cancel
Save