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

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

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

    setDefaults: function () {
        this._super();
        this.props("id", "folder/open");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("folder_plus.png"));
        this.props("canExecute", true);
    },

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

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

        var resource = _.first(this.getResources());

        PD.context.get_default().get_events().publish("folder/open", {
            folderId: resource.id
        });

        PD.context
            .get_default()
            .get_events()
            .publish("location/change", {
                folderId: resource.id,
                source: "browser"
            });

    }

});