/// class PD.Manage.ModuleCloseAllCommand

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

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

    setDefaults: function () {
        this.props("id", "module/close-all");
        this.props("enabled", true);
        this.props("label", "Close All");
        this.props("tooltip", "Close All");
        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:UnloadAll", module);
        }

    },

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

});