/// class PD.Manage.Modules.SelectionListEditDialogCommand

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

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

    setDefaults: function () {

        this.props("id", "selection-list/properties-dialog");
        this.props("icon", PD.Path.to16x16("pencil.png"));
        this.props("label", "Edit");
        this.props("tooltip", "Edit the selected Selection List.");
        this.state("selectionList", null);

    },

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

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

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

        ProspectDirector.Web.UI.FeatureSets.NHibTargetEditorDialog.open({
            config: {
                title: "Edit Selection List - " + selectionList.name,
                height: "450px",
                width: "450px"
            },
            data: {
                targetArbiter: "ProspectDirector.Web.Manage.Modules.Extensions.SelectionListArbiter",
                targetType: "ProspectDirector.Web.Manage.Modules.Extensions.SelectionListUIO",
                layoutType: ProspectDirector.Web.UI.FeatureSets.Layouts.TabStripLayout,
                targetId: selectionList.id
            },
            callbacks: {
                ok: function (sender, e) {
                    PD.context.get_default().get_events().publish("selection-list/edit", selectionList);
                }
            }
        });

    },

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

});