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

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

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

    setDefaults: function () {

        this.props("id", "resource/properties-dialog");
        this.props("enabled", false);
        this.props("icon", PD.Path.to16x16("pencil.png"));
        this.props("label", "Edit");
        this.props("tooltip", "Edit the properties of the selected file or folder.");

        this.state("resources", null);
        this.state("group", null);

    },

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

    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/properties-dialog");
                break;
            case "file":
                PD.context.get_default().get_commands().execute(group + ":file/properties-dialog");
                break;
        }

    },

    //===================================
    // PRIVATE METHODS
    //===================================

    _isEnabled: function () {
        return this.hasSelections() && !this.isMultiSelect();
    }

});