/// class PD.Manage.Modules.EntityTypeContextMenu
// using PD.Web.UI.Controls.ContextMenuSegment

PD.Manage.Modules.EntityTypeContextMenu =
PD.Web.UI.Controls.ContextMenuSegment.extend({

    //===================================
    // EVENT HANDLERS
    //===================================

    onRegisterItems: function (e) {

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/entity-type/context-menu:explorer-folder/create-dialog"
        }));

        e.addSeparator();

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/entity-type/context-menu:explorer-folder/create/empty-folder"
        }));

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/entity-type/context-menu:explorer-folder/create/canvas"
        }));

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/entity-type/context-menu:explorer-folder/create/content-list"
        }));

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/entity-type/context-menu:explorer-folder/create/document-folder"
        }));

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/entity-type/context-menu:explorer-folder/create/document-explorer"
        }));

        e.addSeparator();

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/entity-type/context-menu:explorer-folder/delete"
        }));

    },

    onOpen: function (e) {

        var tree = this.get_context()["tree"],
            item = tree.dataItem(e.target);

        PD.context.get_default().get_commands().setState({
            "pd/entity-type/context-menu": {
                folderId: item.id,
                folderName: item.name,
                folderRole: item.role
            }
        });

    }

});