/// class PD.Manage.Modules.ObjectModel.EntityTypeEditDialogCommand

PD.Manage.Modules.ObjectModel.EntityTypeEditDialogCommand =
PD.Commands.Command.extend({

    //===================================
    // PUBLIC METHODS
    //===================================

    setDefaults: function () {

        this.props("id", "entity-type/edit-dialog");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("PENCIL.PNG"));
        this.props("label", "Edit");
        this.props("tooltip", "Edit the properties of<br/>the selected Entity Type.");

        this.state("entityTypeId", null);

    },

    setState: function (state) {
        this._super(state);
        this.props("enabled", this.state("entityTypeId") != null)
    },

    execute: function (e) {
        this._super(e);

        ProspectDirector.Modules.EntityTypes.Dialog.EntityTypeProperties.show({
            params: {
                id: this.state("entityTypeId")
            },
            callbacks: {
                ok: function (sender, e) {
                    PD.context.get_default().get_events().publish("entity-type/update", {
                        id: e.id,
                        name: e.name
                    });
                }
            }
        });

    }

});