public ImportNamespaceSmartTagItem(AssemblyNamespace assemblyNamespace) : base(assemblyNamespace.Namespace) { _AssemblyNamespace = assemblyNamespace; }
static TypeToAssemblyNamespaceMap ScanAssemblyReferenceTypes(List<AssemblyReference> assemblyReferences) { TypeToAssemblyNamespaceMap result = new TypeToAssemblyNamespaceMap(); if (assemblyReferences == null) return result; foreach (AssemblyReference assemblyReference in assemblyReferences) { ITypeElement[] types = GetTypesDeclaredInAssembly(assemblyReference); if (types == null) continue; foreach (ITypeElement typeElement in types) { if (typeElement == null) continue; if (typeElement.ParentNamespace == null) continue; string typeNamespace = typeElement.ParentNamespace.FullName; if (String.IsNullOrEmpty(typeNamespace)) continue; AssemblyNamespaceList namespaceList; if (!result.TryGetValue(typeElement.Name, out namespaceList)) { namespaceList = new AssemblyNamespaceList(); result.Add(typeElement.Name, namespaceList); } AssemblyNamespace nameSpace = new AssemblyNamespace(); nameSpace.AssemblyFilePath = assemblyReference.FilePath; nameSpace.Namespace = typeNamespace; namespaceList.Add(nameSpace); } } return result; }
static TypeToAssemblyNamespaceMap ScanProjectTypes(List<ProjectElement> projectsToGetTypes) { TypeToAssemblyNamespaceMap result = new TypeToAssemblyNamespaceMap(); if (projectsToGetTypes == null) return result; foreach (ProjectElement projectToGetTypes in projectsToGetTypes) { ITypeElement[] projectTypes = GetTypesDeclaredInProject(projectToGetTypes); if (projectTypes == null) continue; foreach (ITypeElement typeElement in projectTypes) { if (typeElement == null) continue; if (typeElement.ParentNamespace == null) continue; string typeNamespace = typeElement.ParentNamespace.FullName; if (String.IsNullOrEmpty(typeNamespace)) continue; AssemblyNamespaceList namespaceList; if (!result.TryGetValue(typeElement.Name, out namespaceList)) { namespaceList = new AssemblyNamespaceList(); result.Add(typeElement.Name, namespaceList); } AssemblyNamespace nameSpace = new AssemblyNamespace(); nameSpace.ReferenceProject = projectToGetTypes; nameSpace.Namespace = typeNamespace; namespaceList.Add(nameSpace); } } return result; }
static void ImportNamespace(Project envDteProject, AssemblyNamespace assemblyNamespace) { if (envDteProject == null) return; if (!assemblyNamespace.IsProjectReference) { string referenceName = assemblyNamespace.GetReferenceName(); AddReference(envDteProject, referenceName); } else AddProjectReference(envDteProject, assemblyNamespace.ReferenceProject); CodeRush.Source.DeclareNamespaceReference(assemblyNamespace.Namespace); }