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

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

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

    onRegisterItems: function (e) {

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

        e.addSeparator();

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

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

    },

    onOpen: function (e) {
        
        var grid = this.get_context()["grid"],
            item = grid.getSelections().first();
        
        PD.context.get_default().get_commands().setState({
            "pd/entity-types/context-menu": {
                entityTypeId: item ? item.id : null,
                entityTypeName: item ? item.Name : null
            }
        });

    }

});