/// class PD.Manage.Modules.Rules.RulesetsContextMenu
// using PD.Web.UI.Controls.ContextMenuSegment

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

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

    onRegisterItems: function (e) {

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/rulesets/context-menu:rule-script/open"
        }));

        e.addSeparator();

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/rulesets/context-menu:rule-script/properties-dialog"
        }));

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/rulesets/context-menu:rule-script/delete"
        }));

    },

    onOpen: function (e) {

        var grid = this.get_context()["grid"];
        var selection = _.first(grid.getSelections().toArray());

        PD.context.get_default().get_commands().setState({
            "pd/rulesets/context-menu": {
                rulescript: selection
            }
        });

    }

});