public PointcutNode(IPointcut pointcut) : base(pointcut.Name) { this.pointcut = pointcut; this.ImageIndex = 6; this.SelectedImageIndex = 6; foreach (PointcutTarget target in pointcut.Targets) { PointcutTargetNode targetNode = new PointcutTargetNode(target); this.Nodes.Add(targetNode); } foreach (PresentationInterceptor interceptor in pointcut.Interceptors) { InterceptorNode interceptorNode = new InterceptorNode(interceptor); this.Nodes.Add(interceptorNode); } }
private void AddInterceptorNodes() { this.ImageIndex = 10; this.SelectedImageIndex = 10; foreach (IGenericAspect aspect in aspects) { foreach (PresentationPointcut pointcut in aspect.Pointcuts) { if (pointcut.IsMatch(method, this.Type)) { pointcut.AppliedOnMethods.Add(this.method); foreach (PresentationInterceptor interceptor in pointcut.Interceptors) { InterceptorNode interceptorNode = new InterceptorNode(interceptor); this.Nodes.Add(interceptorNode); } } } } }
private void RefreshInterceptorNodes() { this.ImageIndex = 10; this.SelectedImageIndex = 10; IList interceptors = new ArrayList(); foreach (IGenericAspect aspect in aspects) { foreach (PresentationPointcut pointcut in aspect.Pointcuts) { if (pointcut.IsMatch(method, this.Type)) { pointcut.AppliedOnMethods.Add(this.method); foreach (PresentationInterceptor interceptor in pointcut.Interceptors) { interceptors.Add(interceptor); } } } } #region Prune Interceptors IList prune = new ArrayList(); Hashtable existing = new Hashtable(); foreach (PresentationInterceptor interceptor in interceptors) existing[interceptor] = interceptor; foreach (TreeNode node in this.Nodes) { InterceptorNode interceptorNode = node as InterceptorNode; if (interceptorNode != null) { if (!existing.Contains(interceptorNode.Interceptor)) prune.Add(interceptorNode); } } foreach (TreeNode pruneNode in prune) this.Nodes.Remove(pruneNode); #endregion #region Add Interceptors IList insert = new ArrayList(); existing = new Hashtable(); foreach (TreeNode node in this.Nodes) { InterceptorNode interceptorNode = node as InterceptorNode; if (interceptorNode != null) existing[interceptorNode.Interceptor] = interceptorNode.Interceptor; } foreach (PresentationInterceptor interceptor in interceptors) if (!existing.Contains(interceptor)) insert.Add(interceptor); foreach (PresentationInterceptor interceptor in insert) { InterceptorNode insertNode = new InterceptorNode(interceptor); this.Nodes.Add(insertNode); } #endregion #region Order Interceptors int i = 0; foreach (PresentationInterceptor interceptor in interceptors) { NodeBase node = TreeViewManager.FindNodeByObject(this.Nodes, interceptor); if (node.Index != i) { this.Nodes.Remove(node); this.Nodes.Insert(i, node); } i++; } #endregion }
private void RefreshInterceptorNodes() { this.ImageIndex = 10; this.SelectedImageIndex = 10; IList interceptors = new ArrayList(); foreach (IGenericAspect aspect in aspects) { foreach (PresentationPointcut pointcut in aspect.Pointcuts) { if (pointcut.IsMatch(method, this.Type)) { pointcut.AppliedOnMethods.Add(this.method); foreach (PresentationInterceptor interceptor in pointcut.Interceptors) { interceptors.Add(interceptor); } } } } #region Prune Interceptors IList prune = new ArrayList(); Hashtable existing = new Hashtable(); foreach (PresentationInterceptor interceptor in interceptors) { existing[interceptor] = interceptor; } foreach (TreeNode node in this.Nodes) { InterceptorNode interceptorNode = node as InterceptorNode; if (interceptorNode != null) { if (!existing.Contains(interceptorNode.Interceptor)) { prune.Add(interceptorNode); } } } foreach (TreeNode pruneNode in prune) { this.Nodes.Remove(pruneNode); } #endregion #region Add Interceptors IList insert = new ArrayList(); existing = new Hashtable(); foreach (TreeNode node in this.Nodes) { InterceptorNode interceptorNode = node as InterceptorNode; if (interceptorNode != null) { existing[interceptorNode.Interceptor] = interceptorNode.Interceptor; } } foreach (PresentationInterceptor interceptor in interceptors) { if (!existing.Contains(interceptor)) { insert.Add(interceptor); } } foreach (PresentationInterceptor interceptor in insert) { InterceptorNode insertNode = new InterceptorNode(interceptor); this.Nodes.Add(insertNode); } #endregion #region Order Interceptors int i = 0; foreach (PresentationInterceptor interceptor in interceptors) { NodeBase node = TreeViewManager.FindNodeByObject(this.Nodes, interceptor); if (node.Index != i) { this.Nodes.Remove(node); this.Nodes.Insert(i, node); } i++; } #endregion }
public override void Refresh() { this.Text = this.pointcut.Name; #region Prune Targets IList prune = new ArrayList(); Hashtable existing = new Hashtable(); foreach (PointcutTarget target in pointcut.Targets) { existing[target] = target; } foreach (TreeNode node in this.Nodes) { PointcutTargetNode targetNode = node as PointcutTargetNode; if (targetNode != null) { if (!existing.Contains(targetNode.Target)) { prune.Add(targetNode); } } } foreach (TreeNode pruneNode in prune) { this.Nodes.Remove(pruneNode); } #endregion #region Add Targets int insertAt = -1; int i = 0; IList insert = new ArrayList(); existing = new Hashtable(); foreach (TreeNode node in this.Nodes) { PointcutTargetNode targetNode = node as PointcutTargetNode; if (targetNode != null) { existing[targetNode.Target] = targetNode.Target; } if (insertAt == -1) { InterceptorNode interceptorNode = node as InterceptorNode; if (interceptorNode != null) { insertAt = i; } } i++; } foreach (PointcutTarget target in pointcut.Targets) { if (!existing.Contains(target)) { insert.Add(target); } } foreach (PointcutTarget target in insert) { PointcutTargetNode insertNode = new PointcutTargetNode(target); this.Nodes.Insert(insertAt, insertNode); } #endregion base.Refresh(); }