/// class PD.Manage.ModuleCloseCommand

PD.Manage.ModuleCloseCommand =
PD.Commands.Command.extend({

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

    setDefaults: function () {
        this.props("id", "module/close");
        this.props("enabled", true);
        this.props("label", "Close");
        this.props("tooltip", "Close");
        this.state("module", null);
    },

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

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

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

        if (module != null) {
            PD.context.get_global().get_events().publish("Module:Unload", module.id);
        }

    },

    _isEnabled: function () {
        return this.state("module") != null;
    }

});