/// class PD.Manage.Modules.Rules.RuleScriptOpenCommand

PD.Manage.Modules.Rules.RuleScriptOpenCommand =
PD.Commands.Command.extend({

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

    setDefaults: function () {

        this.props("id", "rule-script/open");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("document_text.png"));
        this.props("label", "Open");
        this.props("tooltip", "Open the selected Rule Script.");

        this.state("rulescript", null);

    },

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

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

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

        if (rulescript != null) {
            window.location.hash = "/module/rule-script-editor/" + rulescript.id;
        }

    }

});