public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { if (tv != null && tv.RootId != null && parentNode != null && parentNode.OwnerPointer != null && parentNode.OwnerPointer.RootPointer != null) { if (tv.Project != null && (tv.Project.ProjectType == EnumProjectType.WebAppPhp || tv.Project.ProjectType == EnumProjectType.WebAppAspx)) { if (tv.RootId.ClassId != parentNode.OwnerPointer.RootPointer.ClassId) { return; } } } IObjectPointer objRef = parentNode.OwnerPointer; TreeNodeClassRoot topClass = parentNode.TopLevelRootClassNode; bool forPhp = false; if (tv.Project != null) { forPhp = (tv.Project.ProjectType == EnumProjectType.WebAppPhp); } Dictionary <UInt32, IAction> actions = null; if (topClass != null) { if (!topClass.StaticScope) { actions = topClass.GetActions(); } } else { TreeNodeClassType rootType = parentNode.TopLevelNode as TreeNodeClassType; if (rootType != null) { actions = rootType.GetActions(); } } SortedList <string, TreeNode> newNodes = new SortedList <string, TreeNode>(); HtmlElement_BodyBase heb = (HtmlElement_BodyBase)parentNode.OwnerIdentity; MethodInfo[] mifs = heb.GetType().GetMethods(); if (mifs != null) { for (int i = 0; i < mifs.Length; i++) { if (parentNode.SelectionTarget == EnumObjectSelectType.Object) { if (mifs[i].ReturnType.Equals(typeof(void))) { continue; } ParameterInfo[] ps = mifs[i].GetParameters(); if (ps != null && ps.Length > 0) { continue; } } if (VPLUtil.IsNotForProgramming(mifs[i])) { continue; } if (!WebClientMemberAttribute.IsClientMethod(mifs[i]) && !WebServerMemberAttribute.IsServerMethod(mifs[i])) { continue; } MethodInfoPointer mp = new MethodInfoPointer(); mp.Owner = objRef; mp.SetMethodInfo(mifs[i]); int c; TreeNodeMethod nodeMethod = new TreeNodeMethod(ForStatic, mp); string key = mp.GetMethodSignature(out c); TreeNode nodeExist; if (newNodes.TryGetValue(key, out nodeExist)) { TreeNodeMethod mnd = (TreeNodeMethod)nodeExist; if (mnd.MethodInformation.DeclaringType.Equals(mnd.MethodInformation.ReflectedType)) { key = key + " - " + mifs[i].DeclaringType.Name; newNodes.Add(key, nodeMethod); } else { if (mifs[i].DeclaringType.Equals(mifs[i].ReflectedType)) { newNodes[key] = nodeMethod; key = key + " - " + mnd.MethodInformation.DeclaringType.Name; newNodes.Add(key, mnd); } else { key = key + " - " + mifs[i].DeclaringType.Name; newNodes.Add(key, nodeMethod); } } } else { newNodes.Add(key, nodeMethod); } //load actions if (actions != null) { bool bHasActions = false; foreach (IAction a in actions.Values) { ActionClass ac = a as ActionClass; if (ac != null) { MethodPointer mp0 = ac.ActionMethod as MethodPointer; if (mp0 != null) { if (mp0.IsSameObjectRef(mp)) { bHasActions = true; break; } } } } if (bHasActions) { nodeMethod.ShowActionIcon(); } } } parentNode.AddSortedNodes(newNodes); } }
public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode) { UInt32 scopeId = parentNode.ScopeMethodId; SortedList <string, TreeNode> newNodes = new SortedList <string, TreeNode>(); HtmlElement_BodyBase heb = (HtmlElement_BodyBase)parentNode.OwnerIdentity; PropertyDescriptorCollection pifs = TypeDescriptor.GetProperties(heb.GetType()); TreeNodeClassRoot topClass = parentNode.TopLevelRootClassNode; Dictionary <UInt32, IAction> actions = null; if (topClass != null) { if (!topClass.StaticScope) { actions = topClass.GetActions(); } } else { if (tv != null) { if (tv.RootClassNode != null) { actions = tv.RootClassNode.GetActions(); } } if (actions == null) { TreeNodeClassType rootType = parentNode.TopLevelNode as TreeNodeClassType; if (rootType != null) { actions = rootType.GetActions(); } } } for (int i = 0; i < pifs.Count; i++) { if (NotForProgrammingAttribute.IsNotForProgramming(pifs[i])) { continue; } if (!WebClientMemberAttribute.IsClientProperty(pifs[i]) && !WebServerMemberAttribute.IsServerProperty(pifs[i])) { continue; } TreeNodeProperty nodeProperty; PropertyPointer pp; pp = new PropertyPointer(); pp.Owner = new HtmlElementPointer(heb); pp.SetPropertyInfo(pifs[i]); if (!newNodes.ContainsKey(pp.Name)) { nodeProperty = new TreeNodeProperty(ForStatic, pp); try { newNodes.Add(pp.Name, nodeProperty); } catch (Exception err) { MathNode.Log(tv != null ? tv.FindForm() : null, err); } //load actions bool bHasActions = false; if (string.CompareOrdinal(pp.Name, "Cursor") == 0) { bHasActions = false; } if (actions != null) { foreach (IAction a in actions.Values) { if (a != null && a.IsStatic == parentNode.IsStatic) { if (nodeProperty.IncludeAction(a, tv, scopeId, false)) { bHasActions = true; break; } } } if (bHasActions) { nodeProperty.OnShowActionIcon(); } } } } parentNode.AddSortedNodes(newNodes); }