/// <summary>
        /// Create the child nodes and register their events.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The ExplorerNodeMenuItemsRequestedEventArgs.</param>
        void NodeType_NodeMenuItemsRequested(object sender, ExplorerNodeMenuItemsRequestedEventArgs e)
        {
            //Add the child nodes
            if (EnabledExtensionsOptionsPage.GetSetting <bool>(EnabledExtensionsOptions.ContentTypeCopyID, true))
            {
                IMenuItem copyIdItem = e.MenuItems.Add(CKSProperties.ContentTypeNodeExtension_CopyIdNodeName, 1);
                copyIdItem.Click += new EventHandler <MenuItemEventArgs>(CopyIdItem_Click);
            }

            if (EnabledExtensionsOptionsPage.GetSetting <bool>(EnabledExtensionsOptions.ImportContentType, true))
            {
                if (DTEManager.ActiveSharePointProject != null)
                {
                    IMenuItem importContentTypeItem = e.MenuItems.Add(CKSProperties.ContentTypeNodeExtension_ImportNodeName, 2);
                    importContentTypeItem.Click += new EventHandler <MenuItemEventArgs>(ImportContentTypeItem_Click);
                }
            }

            if (EnabledExtensionsOptionsPage.GetSetting <bool>(EnabledExtensionsOptions.CreatePageLayoutFromContentType, true))
            {
                IMenuItem createPageLayoutMenuItem = e.MenuItems.Add(CKSProperties.ContentTypeNodeExtension_CreatePublishingPageLayoutName);
                createPageLayoutMenuItem.Click += new EventHandler <Microsoft.VisualStudio.SharePoint.MenuItemEventArgs>(CreatePageLayoutContentTypeNodeExtension_Click);

                IContentTypeNodeInfo ctInfo = e.Node.Annotations.GetValue <IContentTypeNodeInfo>();
                createPageLayoutMenuItem.IsEnabled = e.Node.Context.SharePointConnection.ExecuteCommand <string, bool>(ContentTypeSharePointCommandIds.IsPublishingContentTypeCommand, ctInfo.Name);
            }
        }
        /// <summary>
        /// The copy id item click event copies the selected content type node id to the clipboard.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The MenuItemEventArgs.</param>
        void CopyIdItem_Click(object sender, MenuItemEventArgs e)
        {
            IExplorerNode        owner      = (IExplorerNode)e.Owner;
            IContentTypeNodeInfo annotation = owner.Annotations.GetValue <IContentTypeNodeInfo>();
            string id = owner.Context.SharePointConnection.ExecuteCommand <string, string>(ContentTypeSharePointCommandIds.GetContentTypeID, annotation.Name);

            if (!String.IsNullOrEmpty(id))
            {
                Clipboard.SetData(DataFormats.Text, id);
            }
        }
        /// <summary>
        /// Handles the Click event of the CreatePageLayoutContentTypeNodeExtension control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.VisualStudio.SharePoint.MenuItemEventArgs" /> instance containing the event data.</param>
        void CreatePageLayoutContentTypeNodeExtension_Click(object sender, Microsoft.VisualStudio.SharePoint.MenuItemEventArgs e)
        {
            IExplorerNode ctNode = e.Owner as IExplorerNode;

            if (ctNode != null)
            {
                IContentTypeNodeInfo ctInfo = ctNode.Annotations.GetValue <IContentTypeNodeInfo>();

                string pageLayoutContents = ctNode.Context.SharePointConnection.ExecuteCommand <string, string>(ContentTypeSharePointCommandIds.CreatePageLayoutCommand, ctInfo.Name);
                DTEManager.CreateNewTextFile(SafeContentTypeName(ctInfo.Name) + ".aspx", pageLayoutContents);
            }
        }
        /// <summary>
        /// Import the selected content type into the currently selected project.
        /// </summary>
        /// <param name="contentTypeNode">Selected Content Type node.</param>
        public static void ImportContentType(IExplorerNode contentTypeNode)
        {
            if (contentTypeNode == null)
            {
                throw new ArgumentNullException("contentTypeNode");
            }

            Cursor.Current = Cursors.WaitCursor;

            IContentTypeNodeInfo annotation      = contentTypeNode.Annotations.GetValue <IContentTypeNodeInfo>();
            ContentTypeInfo      contentTypeInfo = contentTypeNode.Context.SharePointConnection.ExecuteCommand <string, ContentTypeInfo>(ContentTypeSharePointCommandIds.GetContentTypeImportProperties, annotation.Name);

            ImportContentType(contentTypeInfo);
        }
        /// <summary>
        /// The import item click event imports the selected content type into the currently selected project.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The MenuItemEventArgs.</param>
        void ImportContentTypeItem_Click(object sender, MenuItemEventArgs e)
        {
            //TODO: Would be useful to check if the selected content type is already part of the solution before import is allowed.... see the content type wizard for ideas
            IExplorerNode        owner      = (IExplorerNode)e.Owner;
            IContentTypeNodeInfo annotation = owner.Annotations.GetValue <IContentTypeNodeInfo>();

            if (owner.Context.SharePointConnection.ExecuteCommand <string, bool>(ContentTypeSharePointCommandIds.IsBuiltInContentType, annotation.Name))
            {
                if (MessageBox.Show(CKSProperties.ContentTypeNodeExtension_ImportConfirmationQuestion,
                                    CKSProperties.ContentTypeNodeExtension_ImportConfirmationDialogTitle,
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    ImportContentType(e);
                }
            }
            else
            {
                ImportContentType(e);
            }
        }