示例#1
0
		protected BrowserTreeNode FindMember(ComTypeLibTreeNode typeLibNode, ComTypeTreeNode typeTreeNode, MemberInfo mi)
		{
			// If we have a class, we need to look at all of
			// its implemented interfaces
			if (typeTreeNode.MemberInfo is ComClassInfo) {
				BrowserTreeNode resultNode = null;
			
				ComClassInfo classInfo = (ComClassInfo)typeTreeNode.MemberInfo;
				foreach (BasicInfo iface in classInfo.Interfaces) {
					BrowserTreeNode ifaceNode = 
						SearchNode(typeLibNode, iface.Name);
					String searchName = mi.Name;
					// See if its a member name qualified by this
					// interface name
					if (mi.Name.StartsWith(iface.Name)) {
						searchName = mi.Name.Substring(iface.Name.Length + 1);
						if (mi is EventInfo && 
							searchName.StartsWith("Event_"))
							searchName = searchName.Substring(6);
					}
					resultNode = SearchNode(ifaceNode, searchName);
					if (resultNode != null)
						return resultNode;
				}
				throw new Exception("(bug) - cant find member " + mi);
			} else {
				return SearchNode(typeTreeNode, mi.Name);
			}
		}
示例#2
0
 // Return true if this is being made a favorite, which
 // should cause the expansion of the original node to be cancelled
 protected bool MakeFavorite(bool doExpand)
 {
     if (_typeLib.Registered && !HasRemoveFavorite())
     {
         // This may already be a favorite, since it got
         // moved there when it was translated (if it was just
         // translated)
         BrowserTreeNode foundNode = ComSupport.FindTypeLib(_typeLib.Key, ComSupport.FavoriteTypeLibNode);
         if (foundNode == null)
         {
             // Not in the favorites, put it there
             foundNode = new ComTypeLibTreeNode(_typeLib);
             ComSupport.FavoriteTypeLibNode.AddLogicalNode(foundNode);
         }
         _typeLib.RememberMe();
         if (doExpand)
         {
             foundNode.Expand();
             foundNode.PointToNode();
             // Cancel expansion of original node
             return(true);
         }
     }
     return(false);
 }
 // Allocates the correct type of node
 protected override BrowserTreeNode AllocateChildNode(Object obj)
 {
     ComTypeLibTreeNode node = new ComTypeLibTreeNode((TypeLibrary)obj);
     return node;
 }
        // Allocates the correct type of node
        protected override BrowserTreeNode AllocateChildNode(Object obj)
        {
            ComTypeLibTreeNode node = new ComTypeLibTreeNode((TypeLibrary)obj);

            return(node);
        }
示例#5
0
		// Adds the remembered type lib to the favorites part
		// of the type library tree
		internal static BrowserTreeNode AddTypeLib(TypeLibrary lib)
		{
			BrowserTreeNode findRoot;
			findRoot = _favTypeLibNode;
			if (findRoot == null)
				return null;
			BrowserTreeNode typeLibNode = FindTypeLib(lib.Key, findRoot);
			if (typeLibNode == null) {
				typeLibNode = new ComTypeLibTreeNode(lib);
				// This might be called on the thread to restore open typelibs
				_comTree.Invoke(new BrowserTreeNode.AddLogicalInvoker(findRoot.AddLogicalNode),
					     new Object[] { typeLibNode });
			}
			return typeLibNode;
		}
		// Return true if this is being made a favorite, which
		// should cause the expansion of the original node to be cancelled
		protected bool MakeFavorite(bool doExpand)
		{
			if (_typeLib.Registered && !HasRemoveFavorite()) {
				// This may already be a favorite, since it got
				// moved there when it was translated (if it was just
				// translated)
				BrowserTreeNode foundNode = ComSupport.FindTypeLib(_typeLib.Key, ComSupport.FavoriteTypeLibNode);
				if (foundNode == null) {
					// Not in the favorites, put it there
					foundNode = new ComTypeLibTreeNode(_typeLib);
					ComSupport.FavoriteTypeLibNode.AddLogicalNode(foundNode);
				}
				_typeLib.RememberMe();
				if (doExpand) {
					foundNode.Expand();
					foundNode.PointToNode();
					// Cancel expansion of original node
					return true;
				}
			}
			return false;
		}