Beispiel #1
0
        /// <summary>
        /// <para>Create menu items based on the nodes registered with the <see cref="INodeCreationService"/> for the spefied type.</para>
        /// </summary>
        /// <param name="nodeType">
        /// <para>The type to create menu items.</para>
        /// </param>
        protected void CreateDynamicMenuItems(Type nodeType)
        {
            INodeCreationService  service = ServiceHelper.GetNodeCreationService(Site);
            StringCollection      names   = service.GetDisplayNames(nodeType);
            ConfigurationMenuItem item    = null;

            foreach (string name in names)
            {
                NodeCreationEntry entry = service.GetNodeCreationEntry(name);
                item = new ConfigurationMenuItem(name, entry.ConfigurationNodeCommand, this, Shortcut.None, SR.GenericCreateStatusText(name), InsertionPoint.New);
                if (!entry.AllowMultiple)
                {
                    if (Hierarchy.ContainsNodeType(this, nodeType /*entry.BaseTypeToCompare*/))
                    {
                        item.Enabled = false;
                    }
                }
                AddMenuItem(item);
            }
        }