/// class PD.Manage.Modules.Resources.FileSaveCommand
// using PD.Commands.Command

PD.Manage.Modules.Resources.FileSaveCommand =
PD.Commands.Command.extend({

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

    setDefaults: function () {
        this._super();
        this.props("id", "resources/file/save");
        this.props("label", "Save");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("floppy_disk.png"));
        this.props("canExecute", true);

        this.state("fileId", null);
        this.state("editor", null);

    },

    setState: function (state) {
        this._super(state);
    },

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

        var that = this,
            fileId = this.state("fileId"),
            editor = this.state("editor"),
            service = new PD.Manage.Services.ResourcesService();

        service.saveFile(fileId, editor.content(), function (result) {
            PD.messageStack.success("File Saved Successfully!");
            //PD.context.get_default().get_events().publish("file/save", {
            //    fileId: fileId
            //});
        });

    }

});