示例#1
0
 // When a link is clicked to this
 public void ShowTarget(Object linkModifier)
 {
     if (_treeNode != null)
     {
         _treeNode.PointToNode();
     }
 }
示例#2
0
 internal static void OpenFile(String fileName)
 {
     // Keep track if the assembly was actually loaded, if
     // not then it must already be loaded, so handle adding
     // it to the tree.
     _assyLoadedNode = null;
     LoadAssembly(fileName);
     if (_assyLoadedNode == null)
     {
         Assembly assy = Assembly.LoadFrom(fileName);
         if (assy.Equals(Assembly.GetExecutingAssembly()))
         {
             throw new Exception("You may not inspect the Component Inspector");
         }
         // Already loaded
         _assyLoadedNode = FindAssemblyNode(assy);
         if (_assyLoadedNode == null)
         {
             AssemblyTreeNode node = AddAssy(assy, null);
             RememberAssembly(assy, null, null);
             _assyLoadedNode = node;
         }
     }
     // Make sure this node is presented and selected
     SelectAssyTab();
     _assyLoadedNode.PointToNode();
 }
示例#3
0
        ConstructorInfo FindConstructor(ConstructorInfo[] constructors)
        {
            ConstructorInfo constructor = null;

            if (constructors.Length > 1)
            {
                // Ask them to chose a constructor, if the
                // constructor requires parameters, then select
                // it and get out, otherwise go ahead.
                constructor = ConstructorDialog.
                              GetConstructor(constructors);
                if (constructor != null &&
                    constructor.GetParameters().Length != 0)
                {
                    AssemblySupport.SelectAssyTab();
                    MemberTreeNode.FindMember(constructor).PointToNode();
                    return(null);
                }
            }
            else
            {
                constructor = constructors[0];
            }

            // This was cancelled
            if (constructor == null)
            {
                return(null);
            }

            // Since we need to get parameters, we can't finish
            // this operation now, we refer then to the constructor
            // that they should use and they can drag that
            // constructor where they want the object to do
            if (constructor.GetParameters().Length != 0)
            {
                BrowserTreeNode selNode =
                    MemberTreeNode.FindMember(constructor);
                ErrorDialog.
                Show("Please select the constructor member " +
                     "of this Type, fill in the parameters, " +
                     "and then drag " +
                     "the constructor to where you " +
                     "want this object " +
                     "to be created.",
                     "Provide Parameters",
                     MessageBoxIcon.Information);
                AssemblySupport.SelectAssyTab();
                selNode.PointToNode();
                return(null);
            }
            return(constructor);
        }
示例#4
0
        internal static void SelectTypeLib(TypeLibrary lib)
        {
            // Find and select the registered node
            BrowserTreeNode typeLibNode = FindTypeLib(lib.Key);

            if (typeLibNode != null)
            {
                typeLibNode.PointToNode();
            }
            else
            {
                throw new Exception("Bug, expected to be in type lib tree: "
                                    + lib);
            }
        }
        // This could either be a MemberInfo, Type or a TypeLibrary,
        // and we point
        // to the correct node
        public void ShowTarget(Object linkModifier)
        {
            BrowserTreeNode resultNode = null;

            // A type library
            if (linkModifier is TypeLibrary)
            {
                resultNode = ComSupport.FindTypeLib(((TypeLibrary)linkModifier).Key);
            }
            else
            {
                Type type;
                if (linkModifier is Type)
                {
                    type = (Type)linkModifier;
                }
                else
                {
                    type = ((MemberInfo)linkModifier).DeclaringType;
                }
                // Get the typelib node
                TypeLibrary typeLib = TypeLibrary.GetTypeLib(type);
                if (typeLib == null)
                {
                    return;
                }
                // Find the type, this could be a class or an interface
                ComTypeLibTreeNode typeLibNode = (ComTypeLibTreeNode)ComSupport.FindTypeLib(typeLib.Key);
                String             typeName    = typeLib.GetMemberName(type);
                typeLibNode.ExpandNode();
                resultNode = SearchNode(typeLibNode, typeName);
                // Find the member (Type is also a MemberInfo)
                if (!(linkModifier is Type))
                {
                    MemberInfo      mi           = (MemberInfo)linkModifier;
                    ComTypeTreeNode typeTreeNode = (ComTypeTreeNode)resultNode;
                    resultNode = FindMember(typeLibNode, typeTreeNode, mi);
                }
            }
            // Point to the result
            if (resultNode != null)
            {
                ObjectBrowser.TabControl.SelectedTab = ComSupport.ComTabPage;
                resultNode.PointToNode();
            }
        }