Ejemplo n.º 1
0
            protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                {
                    return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
                }

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                ExternModelContext externModelContext = component as ExternModelContext;

                System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>  list  = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();
                System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, true);
                foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                {
                    BaseModelContext p = modelElement as BaseModelContext;
                    if (p.MetaModel.IsTopMost)
                    {
                        continue;
                    }

                    list.Add(p);
                }
                return(list);
            }
        protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
        {
            Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
            if (domainClassInfo == null || component == null)
            {
                return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
            }

            Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);
            System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist;
            if (component is ReferenceRelationship)
            {
                ilist = store.ElementDirectory.FindElements(ReferenceRelationship.DomainClassId);
            }
            else
            {
                ilist = store.ElementDirectory.FindElements(EmbeddingRelationship.DomainClassId);
            }
            System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();

            DomainRelationship domainClass1 = component as DomainRelationship;

            foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
            {
                DomainRelationship domainClass2 = modelElement as DomainRelationship;
                if ((domainClass2 != null) && ShouldIncludeCandidate(domainClass1, domainClass2))
                {
                    list.Add(modelElement);
                }
            }
            return(list);
        }
Ejemplo n.º 3
0
            protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                {
                    return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
                }

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();
                DomainProperty domainProperty = component as DomainProperty;

                if (domainProperty == null)
                {
                    if (component is IList)
                    {
                        if ((component as IList).Count > 0)
                        {
                            domainProperty = (component as IList)[0] as DomainProperty;
                        }
                    }
                }

                if (domainProperty != null)
                {
                    list.AddRange(domainProperty.Element.ParentModelContext.MetaModel.DomainTypes);

                    System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, true);
                    foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                    {
                        DomainType p      = modelElement as DomainType;
                        bool       bFound = false;
                        foreach (DomainType e in list)
                        {
                            if (e.Name == p.Name &&
                                e.Namespace == p.Namespace)
                            {
                                bFound = true;
                                break;
                            }
                        }

                        if (!bFound)
                        {
                            list.Add(p);
                        }
                    }
                }
                return(list);
            }
            protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                {
                    return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
                }

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                DomainRole domainRole = component as DomainRole;

                System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();
                list.AddRange(domainRole.Relationship.GetMetaModel().PropertyGridEditors);

                System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, false);
                foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                {
                    PropertyGridEditor p = modelElement as PropertyGridEditor;
                    bool bFound          = false;
                    foreach (PropertyGridEditor e in list)
                    {
                        if (e.Name == p.Name)
                        {
                            bFound = true;
                            break;
                        }
                    }

                    if (!bFound)
                    {
                        list.Add(p);
                    }
                }
                return(list);
            }