diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-06-23 19:17:29 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-06-23 19:17:29 +0400 |
commit | 6dc36ff4d5e2c1226456fde183129c313611879a (patch) | |
tree | 5418db53c0f9c09018e812a216cb2471135e22ab /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad | |
parent | 932f8a028d0639a98df88e7587a39175dd7f65d7 (diff) |
Fixed type system conversion todos.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs index 7b62f7c5c9..b1059cc86f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs @@ -33,6 +33,7 @@ using System.IO; using MonoDevelop.Projects; using MonoDevelop.Core; using MonoDevelop.Ide.Gui.Components; +using ICSharpCode.NRefactory.TypeSystem; namespace MonoDevelop.Ide.Gui.Pads.ClassPad { @@ -78,33 +79,33 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad } public override void BuildChildNodes (ITreeBuilder builder, object dataObject) - { // TODO: Type system conversion. -// ProjectReference pref = (ProjectReference) dataObject; -// Dictionary<string, bool> namespaces = new Dictionary<string, bool> (); -// bool nestedNs = builder.Options ["NestedNamespaces"]; -// foreach (string fileName in pref.GetReferencedFileNames (IdeApp.Workspace.ActiveConfiguration)) { -// var unit = DomCecilCompilationUnit.Load (fileName, false, true); -// if (unit == null) -// continue; -// foreach (IType type in unit.Types) { -// if (type.IsSpecialName || type.Name.Contains ("<") || type.Name.Contains (">") || type.Name.Contains ("$")) -// continue; -// if (String.IsNullOrEmpty (type.Namespace)) { -// builder.AddChild (new ClassData (null, type)); -// continue; -// } -// string ns = type.Namespace; -// if (nestedNs) { -// int idx = ns.IndexOf ('.'); -// if (idx >= 0) -// ns = ns.Substring (0, idx); -// } -// if (namespaces.ContainsKey (ns)) -// continue; -// namespaces[ns] = true; -// builder.AddChild (new CompilationUnitNamespaceData (unit, ns)); -// } -// } + { + ProjectReference pref = (ProjectReference) dataObject; + Dictionary<string, bool> namespaces = new Dictionary<string, bool> (); + bool nestedNs = builder.Options ["NestedNamespaces"]; + foreach (string fileName in pref.GetReferencedFileNames (IdeApp.Workspace.ActiveConfiguration)) { + var unit = new CecilLoader ().LoadAssemblyFile (fileName); + if (unit == null) + continue; + foreach (var type in unit.GetTypes ()) { + if (type.IsSynthetic) + continue; + if (String.IsNullOrEmpty (type.Namespace)) { + builder.AddChild (new ClassData (unit, null, type)); + continue; + } + string ns = type.Namespace; + if (nestedNs) { + int idx = ns.IndexOf ('.'); + if (idx >= 0) + ns = ns.Substring (0, idx); + } + if (namespaces.ContainsKey (ns)) + continue; + namespaces[ns] = true; + builder.AddChild (new CompilationUnitNamespaceData (null, ns)); + } + } } public override bool HasChildNodes (ITreeBuilder builder, object dataObject) |