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

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

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

    onRegisterItems: function (e) {

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

        e.addSeparator();

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

        e.addSeparator();

        e.registerItem(new PD.Web.UI.Controls.ContextMenuCommandItem({
            commandId: "pd/view:view/copy"
        }));

    },

    onOpen: function (e) {

        var grid = this.get_context().viewGrid,
            selections = grid.getSelections().toArray();

        PD.context.get_default().get_commands().setState({
            "pd/view/context-menu": {
                view: _.first(selections)
            }
        });

    }

});