public IEnumerable <CompletionData> GetControlCompletionData(IType baseType)
        {
            bool isSWC = baseType.FullName == "System.Web.UI.Control";

            string aspPrefix = "asp:";

            foreach (IType cls in WebTypeContext.ListSystemControlClasses(baseType, Project))
            {
                yield return(new AspTagCompletionData(aspPrefix, cls));
            }

            foreach (var rd in RegisteredTags)
            {
                if (!rd.IsValid())
                {
                    continue;
                }

                var ard = rd as AssemblyRegisterDirective;
                if (ard != null)
                {
                    var dom = TypeCtx.ResolveAssembly(ard.Assembly);
                    if (dom == null)
                    {
                        continue;
                    }

                    string prefix = ard.TagPrefix + ":";
                    foreach (IType cls in WebTypeContext.ListControlClasses(baseType, dom, ard.Namespace))
                    {
                        yield return(new AspTagCompletionData(prefix, cls));
                    }
                    continue;
                }

                if (!isSWC)
                {
                    continue;
                }

                ControlRegisterDirective cd = rd as ControlRegisterDirective;
                if (cd != null)
                {
                    yield return(new CompletionData(string.Concat(cd.TagPrefix, ":", cd.TagName),
                                                    Gtk.Stock.GoForward));
                }
            }

            //return controls from web.config
            foreach (var cd in TypeCtx.GetRegisteredTypeCompletionData(DirectoryPath, baseType))
            {
                yield return(cd);
            }
        }
        public string GetTypeName(string tagPrefix, string tagName, string htmlTypeAttribute)
        {
            if (tagPrefix == null || tagPrefix.Length < 1)
            {
                return(WebTypeContext.HtmlControlLookup(tagName, htmlTypeAttribute));
            }

            if (0 == string.Compare(tagPrefix, "asp", StringComparison.OrdinalIgnoreCase))
            {
                string systemType = TypeCtx.SystemTypeNameLookup(tagName);
                if (!string.IsNullOrEmpty(systemType))
                {
                    return(systemType);
                }
            }

            foreach (var rd in RegisteredTags)
            {
                if (string.Compare(rd.TagPrefix, tagPrefix, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    continue;
                }

                var ard = rd as AssemblyRegisterDirective;
                if (ard != null)
                {
                    var dom = TypeCtx.ResolveAssembly(ard.Assembly);
                    if (dom == null)
                    {
                        continue;
                    }

                    string fullName = WebTypeContext.AssemblyTypeNameLookup(dom, ard.Namespace, tagName);
                    if (fullName != null)
                    {
                        return(fullName);
                    }
                }

                var crd = rd as ControlRegisterDirective;
                if (crd != null && string.Compare(crd.TagName, tagName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    string fullName = TypeCtx.GetUserControlTypeName(crd.Src, Doc.FileName);
                    if (fullName != null)
                    {
                        return(fullName);
                    }
                }
            }

            //returns null if type not found
            return(TypeCtx.GetRegisteredTypeName(DirectoryPath, tagPrefix, tagName));
        }
        public IType GetControlType(string tagPrefix, string tagName)
        {
            if (String.IsNullOrEmpty(tagPrefix))
            {
                return(null);
            }

            IType type = null;

            if (0 == string.Compare(tagPrefix, "asp", StringComparison.OrdinalIgnoreCase))
            {
                type = TypeCtx.SystemTypeLookup(tagName);
                if (type != null)
                {
                    return(type);
                }
            }

            foreach (var rd in RegisteredTags)
            {
                if (string.Compare(rd.TagPrefix, tagPrefix, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    continue;
                }

                AssemblyRegisterDirective ard = rd as AssemblyRegisterDirective;
                if (ard != null)
                {
                    string assembly = ard.Assembly;
                    var    dom      = TypeCtx.ResolveAssembly(ard.Assembly);
                    if (dom == null)
                    {
                        continue;
                    }
                    type = WebTypeContext.AssemblyTypeLookup(dom, ard.Namespace, tagName);
                    if (type != null)
                    {
                        return(type);
                    }
                    continue;
                }

                var crd = rd as ControlRegisterDirective;
                if (crd != null && string.Compare(crd.TagName, tagName, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    return(TypeCtx.GetUserControlType(crd.Src, Doc.FileName));
                }
            }

            //returns null if type not found
            return(TypeCtx.GetRegisteredType(DirectoryPath, tagPrefix, tagName));
        }
        public IList <ProjectDom> GetDoms()
        {
            var asms = new HashSet <string> (Project.RegistrationCache.GetAssembliesForPath(DirectoryPath));

            foreach (var s in Doc.Info.Assemblies)
            {
                asms.Add(s.Name);
            }

            var doms = new List <ProjectDom> ();

            doms.Add(TypeCtx.ProjectDom);

            foreach (var asmName in asms)
            {
                var dom = TypeCtx.ResolveAssembly(asmName);
                if (dom != null)
                {
                    doms.Add(dom);
                }
            }
            return(doms);
        }