/// class PD.Manage.Modules.ExtensionPropertiesDialogCommand

PD.Manage.Modules.ExtensionPropertiesDialogCommand =
PD.Commands.Command.extend({

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

    init: function (options) {
        this._super(options);
        this.props("id", "extension/properties-dialog");
        this.props("icon", PD.Path.to16x16("table_edit.png"));
        this.props("label", "Edit");
        this.props("tooltip", "Edit the selected Extension.");
        this.state("extension", null);
        this.state("isList", false);
    },

    setState: function (state) {
        this._super(state);
        this.props("enabled", this.isEnabled())
    },

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

        var extension = this.state("extension");

        ProspectDirector.Web.UI.FeatureSets.NHibTargetEditorDialog.open({
            config: {
                title: "Edit Extension - " + extension.name,
                height: "550px",
                width: "500px"
            },
            data: {
                targetArbiter: "ProspectDirector.Web.Manage.Modules.Extensions.ExtensionArbiter",
                targetType: "ProspectDirector.Web.Manage.Modules.Extensions.ExtensionUIO",
                layoutType: ProspectDirector.Web.UI.FeatureSets.Layouts.TabStripLayout,
                targetId: extension.id,
                properties: {
                    isList: this.state("isList")
                }
            },
            callbacks: {
                ok: function (sender, e) {
                    PD.context.get_default().get_events().publish("extension/update", {
                        id: e.id
                    });
                }
            }
        });

    },

    isEnabled: function () {
        return this.state("extension") != null && this.state("extension").id != null;
    }

});