private static string GetObjectXml(object obj) { PresentationAspect aspect = obj as PresentationAspect; if (aspect != null) { return("xml:<aspect><name>" + aspect.Name + "</name></aspect>"); } PresentationPointcut pointcut = obj as PresentationPointcut; if (pointcut != null) { return(String.Format("xml:<pointcut><aspect>{0}</aspect><pointcut>{1}</pointcut></pointcut>", pointcut.Aspect.Name, pointcut.Name)); } PresentationInterceptor interceptor = obj as PresentationInterceptor; if (interceptor != null) { return(String.Format("xml:<interceptor><aspect>{0}</aspect><pointcut>{1}</pointcut><type-name>{2}</type-name></interceptor>", interceptor.Pointcut.Aspect.Name, interceptor.Pointcut.Name, interceptor.TypeName)); } return(""); }
private void AddInterceptor(PresentationPointcut pointcut) { PresentationInterceptor interceptor = new PresentationInterceptor(pointcut); interceptor.TypeName = "[New Interceptor]"; pointcut.Interceptors.Add(interceptor); RefreshAll(); }
private void AddPointcut(PresentationAspect aspect) { PresentationPointcut pointcut = new PresentationPointcut(aspect); pointcut.Name = "New Pointcut"; aspect.Pointcuts.Add(pointcut); RefreshAll(); }
private void addInterceptorToolStripMenuItem_Click(object sender, EventArgs e) { PresentationPointcut pointcut = selected as PresentationPointcut; if (pointcut != null) { AddInterceptor(pointcut); } }
private void removePointcutToolStripMenuItem_Click(object sender, EventArgs e) { PresentationPointcut pointcut = selected as PresentationPointcut; if (pointcut != null) { RemovePointcut(pointcut); } }
private void AddPointcutTarget(PresentationPointcut pointcut) { PresentationPointcutTarget pointcutTarget = new PresentationPointcutTarget(pointcut); pointcutTarget.Signature = "[New Pointcut Target]"; pointcutTarget.TargetType = PointcutTargetType.Signature; pointcut.Targets.Add(pointcutTarget); RefreshAll(); }
private void SelectObject(object obj) { PresentationAspect aspect = obj as PresentationAspect; if (aspect != null) { propertyGrid.SelectedObject = new AspectProperties(aspect); ShowAspectTypes(aspect); } PresentationAspectTarget aspectTarget = obj as PresentationAspectTarget; if (aspectTarget != null) { propertyGrid.SelectedObject = new AspectTargetProperties(aspectTarget); } PresentationMixin mixin = obj as PresentationMixin; if (mixin != null) { propertyGrid.SelectedObject = new MixinProperties(mixin); } PresentationPointcut pointcut = obj as PresentationPointcut; if (pointcut != null) { propertyGrid.SelectedObject = new PointcutProperties(pointcut); ShowPointcutMethods(pointcut); } PresentationPointcutTarget pointcutTarget = obj as PresentationPointcutTarget; if (pointcutTarget != null) { propertyGrid.SelectedObject = new PointcutTargetProperties(pointcutTarget); } PresentationInterceptor interceptor = obj as PresentationInterceptor; if (interceptor != null) { propertyGrid.SelectedObject = new InterceptorProperties(interceptor); ShowInterceptorMethods(interceptor); } Type type = obj as Type; if (type != null) { propertyGrid.SelectedObject = new TypeProperties(type); } }
private PresentationInterceptor GetDropInterceptor(XmlNode payload) { XmlNode aspectNode = payload.SelectSingleNode("aspect"); XmlNode pointcutNode = payload.SelectSingleNode("pointcut"); XmlNode typeNameNode = payload.SelectSingleNode("type-name"); PresentationAspect aspect = model.GetAspect(aspectNode.InnerText); if (aspect != null) { PresentationPointcut pointcut = aspect.GetPointcutWithNameAndInterceptor(pointcutNode.InnerText, typeNameNode.InnerText); if (pointcut != null) { PresentationInterceptor interceptor = pointcut.GetInterceptor(typeNameNode.InnerText); return(interceptor); } } return(null); }
private static void SerializePointcut(PresentationPointcut pointcut, XmlDocument xmlDoc, XmlNode aspectNode) { XmlNode pointcutNode = xmlDoc.CreateElement("pointcut"); if (pointcut.Name != "") { XmlAttribute nameAttrib = xmlDoc.CreateAttribute("name"); nameAttrib.Value = pointcut.Name; pointcutNode.Attributes.Append(nameAttrib); } aspectNode.AppendChild(pointcutNode); foreach (PresentationPointcutTarget target in pointcut.Targets) { SerializePointcutTarget(target, xmlDoc, pointcutNode); } foreach (PresentationInterceptor interceptor in pointcut.Interceptors) { SerializeInterceptor(interceptor, xmlDoc, pointcutNode); } }
private void TreeViewDragDrop(TreeView treeView, DragEventArgs e) { Point pt = treeView.PointToClient(new Point(e.X, e.Y)); int x = pt.X; int y = pt.Y; string data = ""; NodeBase overNode = (NodeBase)treeView.GetNodeAt(new Point(x, y)); if (e.Data.GetDataPresent(typeof(string))) { data = (string)e.Data.GetData(typeof(string)); } if (data == null) { data = ""; } if (data.Length > 0) { string header; XmlNode payload = ParseDragData(data, out header); if (header == "aspect") { PresentationAspect dropAspect = GetDropAspect(payload); if (overNode != null) { if (overNode is TypeNode) { if (dropAspect != null) { dropAspect.AddTypeTarget(((TypeNode)overNode).Type); RefreshAll(); } } } } if (header == "pointcut") { PresentationPointcut dropPointcut = GetDropPointcut(payload); if (overNode != null) { if (overNode is TypeNode) { if (dropPointcut != null) { dropPointcut.AddTypeTarget(((TypeNode)overNode).Type); RefreshAll(); } } if (overNode is MethodNode) { if (dropPointcut != null) { MethodNode methodNode = overNode as MethodNode; if (methodNode.CanBeProxied()) { dropPointcut.AddMethodTarget(methodNode.MethodBase, methodNode.Type); RefreshAll(); } } } } } if (header == "interceptor") { PresentationInterceptor dropInterceptor = GetDropInterceptor(payload); if (overNode != null) { if (overNode is TypeNode) { if (dropInterceptor != null) { dropInterceptor.AddTypeTarget(((TypeNode)overNode).Type); RefreshAll(); } } if (overNode is MethodNode) { if (dropInterceptor != null) { MethodNode methodNode = overNode as MethodNode; if (methodNode.CanBeProxied()) { dropInterceptor.AddMethodTarget(methodNode.MethodBase, methodNode.Type); RefreshAll(); } } } } } } TurnOffTreeDragHilite(); }
private void ShowPointcutMethods(PresentationPointcut pointcut) { listViewMaster = pointcut; ShowAppliedMethods(pointcut.AppliedOnMethods); }
private void RemovePointcut(PresentationPointcut pointcut) { pointcut.Aspect.Pointcuts.Remove(pointcut); RefreshAll(); }