public ImportNamespaceSmartTagItem(AssemblyNamespace assemblyNamespace)
     : base(assemblyNamespace.Namespace)
 {
     _AssemblyNamespace = assemblyNamespace;
 }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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);
        }