コード例 #1
0
        public TypeNode(Type type, PresentationModel model, AspectMatcher aspectMatcher, PointcutMatcher pointcutMatcher)
            : base(type.FullName)
        {
            this.type            = type;
            this.model           = model;
            this.aspectMatcher   = aspectMatcher;
            this.pointcutMatcher = pointcutMatcher;

            this.ImageIndex         = 1;
            this.SelectedImageIndex = 1;

            ArrayList aspects = null;

            if (model != null)
            {
                aspects = (ArrayList)aspectMatcher.MatchAspectsForType(type, model.Aspects);

                foreach (PresentationAspect aspect in aspects)
                {
                    aspect.AppliedOnTypes.Add(type);
                }

                if (aspects.Count > 0)
                {
                    this.ImageIndex         = 9;
                    this.SelectedImageIndex = 9;
                }

                //Order is important....
                //aspects.Sort(new AspectComparer());
                foreach (IGenericAspect aspect in aspects)
                {
                    TreeNode aspectNode = new AspectNode(aspect);
                    this.Nodes.Add(aspectNode);
                }
            }

            ArrayList ctors = new ArrayList(type.GetConstructors());

            ctors.Sort(new MethodComparer());
            foreach (MethodBase method in ctors)
            {
                TreeNode methodNode = new MethodNode(this.Type, method, aspects, model, pointcutMatcher);
                this.Nodes.Add(methodNode);
            }

            ArrayList methods = new ArrayList(type.GetMethods());

            methods.Sort(new MethodComparer());
            foreach (MethodBase method in methods)
            {
                if (!method.IsStatic)
                {
                    TreeNode methodNode = new MethodNode(this.Type, method, aspects, model, pointcutMatcher);
                    this.Nodes.Add(methodNode);
                }
            }
        }
コード例 #2
0
        public TypeNode(Type type, PresentationModel model, AspectMatcher aspectMatcher, PointcutMatcher pointcutMatcher)
            : base(type.FullName)
        {
            this.type = type;
            this.model = model;
            this.aspectMatcher = aspectMatcher;
            this.pointcutMatcher = pointcutMatcher;

            this.ImageIndex = 1;
            this.SelectedImageIndex = 1;

            ArrayList aspects = null;

            if (model != null)
            {
                aspects = (ArrayList)aspectMatcher.MatchAspectsForType(type, model.Aspects);

                foreach (PresentationAspect aspect in aspects)
                    aspect.AppliedOnTypes.Add(type);

                if (aspects.Count > 0)
                {
                    this.ImageIndex = 9;
                    this.SelectedImageIndex = 9;
                }

                //Order is important....
                //aspects.Sort(new AspectComparer());
                foreach (IGenericAspect aspect in aspects)
                {
                    TreeNode aspectNode = new AspectNode(aspect);
                    this.Nodes.Add(aspectNode);
                }
            }

            ArrayList ctors = new ArrayList(type.GetConstructors());
            ctors.Sort(new MethodComparer());
            foreach (MethodBase method in ctors)
            {
                TreeNode methodNode = new MethodNode(this.Type, method, aspects, model, pointcutMatcher);
                this.Nodes.Add(methodNode);
            }

            ArrayList methods = new ArrayList(type.GetMethods());
            methods.Sort(new MethodComparer());
            foreach (MethodBase method in methods)
            {
                if (!method.IsStatic)
                {
                    TreeNode methodNode = new MethodNode(this.Type, method, aspects, model, pointcutMatcher);
                    this.Nodes.Add(methodNode);
                }
            }
        }
コード例 #3
0
        public override void Refresh()
        {
            ArrayList aspects = (ArrayList)model.Aspects;

            //Order is important
            //aspects.Sort(new AspectComparer());

            #region Prune Aspects

            IList     prune    = new ArrayList();
            Hashtable existing = new Hashtable();
            foreach (IGenericAspect aspect in aspects)
            {
                existing[aspect] = aspect;
            }

            foreach (TreeNode node in this.Nodes)
            {
                AspectNode aspectNode = node as AspectNode;
                if (aspectNode != null)
                {
                    if (!existing.Contains(aspectNode.Aspect))
                    {
                        prune.Add(aspectNode);
                    }
                }
            }

            foreach (TreeNode pruneNode in prune)
            {
                this.Nodes.Remove(pruneNode);
            }

            #endregion

            #region Add Aspects

            IList insert = new ArrayList();
            existing = new Hashtable();

            foreach (TreeNode node in this.Nodes)
            {
                AspectNode aspectNode = node as AspectNode;
                if (aspectNode != null)
                {
                    existing[aspectNode.Aspect] = aspectNode.Aspect;
                }
            }

            foreach (IGenericAspect aspect in aspects)
            {
                if (!existing.Contains(aspect))
                {
                    insert.Add(aspect);
                }
            }

            foreach (IGenericAspect aspect in insert)
            {
                AspectNode insertNode = new AspectNode(aspect);
                this.Nodes.Add(insertNode);
            }

            #endregion

            #region Order Aspects

            int i = 0;
            foreach (IGenericAspect aspect in aspects)
            {
                NodeBase node = TreeViewManager.FindNodeByObject(this.Nodes, aspect);
                if (node.Index != i)
                {
                    this.Nodes.Remove(node);
                    this.Nodes.Insert(i, node);
                }
                i++;
            }

            #endregion


            base.Refresh();
        }
コード例 #4
0
        public override void Refresh()
        {
            if (model == null)
                return;

            ArrayList aspects = (ArrayList)aspectMatcher.MatchAspectsForType(type, model.Aspects);

            this.ImageIndex = 1;
            this.SelectedImageIndex = 1;

            foreach (PresentationAspect aspect in aspects)
                aspect.AppliedOnTypes.Add(type);

            if (aspects.Count > 0)
            {
                this.ImageIndex = 9;
                this.SelectedImageIndex = 9;
            }

            //Order is important
            //aspects.Sort(new AspectComparer());

            #region Prune Aspects

            IList prune = new ArrayList();
            Hashtable existing = new Hashtable();
            foreach (IGenericAspect aspect in aspects)
                existing[aspect] = aspect;

            foreach (TreeNode node in this.Nodes)
            {
                AspectNode aspectNode = node as AspectNode;
                if (aspectNode != null)
                {
                    if (!existing.Contains(aspectNode.Aspect))
                        prune.Add(aspectNode);
                }
            }

            foreach (TreeNode pruneNode in prune)
                this.Nodes.Remove(pruneNode);

            #endregion

            #region Add Aspects

            int insertAt = -1;
            int i = 0;
            IList insert = new ArrayList();
            existing = new Hashtable();

            foreach (TreeNode node in this.Nodes)
            {
                AspectNode aspectNode = node as AspectNode;
                if (aspectNode != null)
                    existing[aspectNode.Aspect] = aspectNode.Aspect;

                MethodNode methodNode = node as MethodNode;
                if (methodNode != null)
                {
                    if (insertAt == -1)
                        insertAt = i;
                    methodNode.Aspects = aspects;
                }
                i++;
            }

            foreach (IGenericAspect aspect in aspects)
                if (!existing.Contains(aspect))
                    insert.Add(aspect);

            foreach (IGenericAspect aspect in insert)
            {
                AspectNode insertNode = new AspectNode(aspect);
                this.Nodes.Insert(insertAt, insertNode);
            }

            #endregion

            #region Order Aspects

            i = 0;
            foreach (IGenericAspect aspect in aspects)
            {
                NodeBase node = TreeViewManager.FindNodeByObject(this.Nodes, aspect);
                if (node.Index != i)
                {
                    this.Nodes.Remove(node);
                    this.Nodes.Insert(i, node);
                }
                i++;
            }

            #endregion

            base.Refresh();
        }
コード例 #5
0
        public override void Refresh()
        {
            if (model == null)
            {
                return;
            }

            ArrayList aspects = (ArrayList)aspectMatcher.MatchAspectsForType(type, model.Aspects);

            this.ImageIndex         = 1;
            this.SelectedImageIndex = 1;

            foreach (PresentationAspect aspect in aspects)
            {
                aspect.AppliedOnTypes.Add(type);
            }

            if (aspects.Count > 0)
            {
                this.ImageIndex         = 9;
                this.SelectedImageIndex = 9;
            }

            //Order is important
            //aspects.Sort(new AspectComparer());

            #region Prune Aspects

            IList     prune    = new ArrayList();
            Hashtable existing = new Hashtable();
            foreach (IGenericAspect aspect in aspects)
            {
                existing[aspect] = aspect;
            }

            foreach (TreeNode node in this.Nodes)
            {
                AspectNode aspectNode = node as AspectNode;
                if (aspectNode != null)
                {
                    if (!existing.Contains(aspectNode.Aspect))
                    {
                        prune.Add(aspectNode);
                    }
                }
            }

            foreach (TreeNode pruneNode in prune)
            {
                this.Nodes.Remove(pruneNode);
            }

            #endregion

            #region Add Aspects

            int   insertAt = -1;
            int   i        = 0;
            IList insert   = new ArrayList();
            existing = new Hashtable();

            foreach (TreeNode node in this.Nodes)
            {
                AspectNode aspectNode = node as AspectNode;
                if (aspectNode != null)
                {
                    existing[aspectNode.Aspect] = aspectNode.Aspect;
                }

                MethodNode methodNode = node as MethodNode;
                if (methodNode != null)
                {
                    if (insertAt == -1)
                    {
                        insertAt = i;
                    }
                    methodNode.Aspects = aspects;
                }
                i++;
            }

            foreach (IGenericAspect aspect in aspects)
            {
                if (!existing.Contains(aspect))
                {
                    insert.Add(aspect);
                }
            }

            foreach (IGenericAspect aspect in insert)
            {
                AspectNode insertNode = new AspectNode(aspect);
                this.Nodes.Insert(insertAt, insertNode);
            }

            #endregion

            #region Order Aspects

            i = 0;
            foreach (IGenericAspect aspect in aspects)
            {
                NodeBase node = TreeViewManager.FindNodeByObject(this.Nodes, aspect);
                if (node.Index != i)
                {
                    this.Nodes.Remove(node);
                    this.Nodes.Insert(i, node);
                }
                i++;
            }

            #endregion

            base.Refresh();
        }
コード例 #6
0
        public override void Refresh()
        {
            ArrayList aspects = (ArrayList)model.Aspects;

            //Order is important
            //aspects.Sort(new AspectComparer());

            #region Prune Aspects

            IList prune = new ArrayList();
            Hashtable existing = new Hashtable();
            foreach (IGenericAspect aspect in aspects)
                existing[aspect] = aspect;

            foreach (TreeNode node in this.Nodes)
            {
                AspectNode aspectNode = node as AspectNode;
                if (aspectNode != null)
                {
                    if (!existing.Contains(aspectNode.Aspect))
                        prune.Add(aspectNode);
                }
            }

            foreach (TreeNode pruneNode in prune)
                this.Nodes.Remove(pruneNode);

            #endregion

            #region Add Aspects

            IList insert = new ArrayList();
            existing = new Hashtable();

            foreach (TreeNode node in this.Nodes)
            {
                AspectNode aspectNode = node as AspectNode;
                if (aspectNode != null)
                    existing[aspectNode.Aspect] = aspectNode.Aspect;
            }

            foreach (IGenericAspect aspect in aspects)
                if (!existing.Contains(aspect))
                    insert.Add(aspect);

            foreach (IGenericAspect aspect in insert)
            {
                AspectNode insertNode = new AspectNode(aspect);
                this.Nodes.Add(insertNode);
            }

            #endregion

            #region Order Aspects

            int i = 0;
            foreach (IGenericAspect aspect in aspects)
            {
                NodeBase node = TreeViewManager.FindNodeByObject(this.Nodes, aspect);
                if (node.Index != i)
                {
                    this.Nodes.Remove(node);
                    this.Nodes.Insert(i, node);
                }
                i++;
            }

            #endregion

            base.Refresh();
        }