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

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

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

    onRegisterItems: function (e) {

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/data-model:extension/properties-dialog"
        }));

        e.addSeparator();

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/data-model:extension/delete-dialog"
        }));

    },

    onOpen: function (e) {

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

        PD.context.get_default().get_commands().setState({
            "pd/data-model/context-menu": {
                extension: selection
            }
        });

    }

});