/// class PD.Manage.Modules.Resources.ResourceOpenCommand
/// using PD.Manage.Modules.Resources.ResourceCommand

PD.Manage.Modules.Resources.ResourceOpenCommand =
PD.Manage.Modules.Resources.ResourceCommand.extend({

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

    setDefaults: function () {
        this._super();
        this.props("id", "resource/open");
        this.props("enabled", true);
        this.props("log", false);
        this.props("label", "Open");
        this.props("icon", PD.Path.to16x16("folder_open.png"));
        this.props("canExecute", true);
        this.state("group", null);
    },

    setState: function (state) {
        this._super(state);
        this.props("enabled", this.hasSelections() && !this.isMultiSelect());
    },

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

        var group = this.state("group") || "pd/resources",
            resource = _.first(this.getResources());

        switch (resource.type) {
            case "folder":
                PD.context.get_default().get_commands().execute(group + ":folder/open", e);
                break;
            case "file":
                PD.context.get_default().get_commands().execute(group + ":file/open", e);
                break;
        }

    }

});