// Finds the node containing the specified object
        // returns true if it found the object
        internal static bool SelectObjectMember(IObjectMember om,
                                                bool createObj)
        {
            ObjectTreeNode node = FindObject(om.Obj, createObj);

            if (node != null)
            {
                node = node.FindMember(om.Member);
                if (node == null)
                {
                    ErrorDialog.Show("You requested to show member "
                                     + om.Member
                                     + " but it cannot be shown because "
                                     + "it is not visible according to the "
                                     + "preferences you have selected "
                                     + "in the object tree.  To show this "
                                     + "member, please modify those "
                                     + "preferences.",
                                     "Member not visible",
                                     MessageBoxIcon.Error);
                    return(false);
                }
                node.PointToNode();
                return(true);
            }
            return(false);
        }
        // Finds the node containing the specified object
        // returns true if it found the object
        internal static bool SelectObject(Object obj,
                                          bool createObj)
        {
            ObjectTreeNode node = FindObject(obj, createObj);

            if (node != null)
            {
                node.PointToNode();
                return(true);
            }
            return(false);
        }
        // Adds the newly created object to this node
        internal ObjectInfo AddNewObject(Object obj, IDragDropItem sourceNode)
        {
            // Returns null if it did not work
            ObjectInfo objInfo = AddObject(obj);

            if (objInfo == null)
            {
                return(null);
            }
            // Expand this and select the node that
            // contains the object we just created
            Expand();
            foreach (TreeNode n in LogicalNodes)
            {
                if (n is ObjectTreeNode)
                {
                    ObjectTreeNode objTreeNode =
                        (ObjectTreeNode)n;
                    if (objTreeNode.Obj == obj)
                    {
                        objTreeNode.PointToNode();
                    }
                }
            }
            // Point the control's site to this so that we can track
            // the selection of controls in the object tree
            // FIXME - this does not work since this node can be removed
            // from the tree, nothing should refer to these tree nodes
            if (obj is Control)
            {
                Control control = (Control)obj;
                if (control.Site != null)
                {
                    ((DesignerSite)control.Site).TargetNode = (ObjectTreeNode)TreeView.SelectedNode;
                }
            }
            // If we are giving focus to a control not on the
            // design surface (see create object above), don't
            // give focus to the newly created tree node
            if (sourceNode == null ||
                !(sourceNode is TypeTreeNode &&
                  obj is Control &&
                  !((TypeTreeNode)sourceNode).OnDesignSurface))
            {
                TreeView.Focus();
            }
            return(objInfo);
        }