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

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

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

    onRegisterItems: function (e) {

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/groups:group/edit-dialog"
        }));

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/groups:group/delete"
        }));

        if (PD.ENVIRONMENT.AUTH_MODE !== 1) {
            return;
        }

        e.addSeparator();

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/groups:sync/group"
        }));

    },

    onOpen: function (e) {

        var grid = this.get_context().viewGrid;

        if (grid) {
            PD.context.get_default().get_commands().setState({
                "pd/groups/context-menu": {
                    groups: grid.getSelections().toArray()
                }
            });
        }

    }

});