/// class PD.Manage.Modules.ObjectModel.ExplorerFolderCreateDialogCommand

PD.Manage.Modules.ObjectModel.ExplorerFolderCreateDialogCommand =
PD.Commands.Command.extend({

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

    setDefaults: function () {

        this.props("id", "explorer-folder/create-dialog");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("PLUS.PNG"));
        this.props("label", "New");
        this.props("tooltip", "Create a new folder.<br/><br/>The new folder will be added<br/>to the currently selected folder.");

        this.state("folderId", null);

    },

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

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

        var that = this,
            folderId = this.state("folderId");

        PD.monitor.execute(function () {
            that._showDialog(folderId);
        });

    },

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

    _showDialog: function (parentId) {

        ProspectDirector.Modules.EntityTypes.Dialog.ExplorerFolderNew.show({
            params: {
                parentFolderId: parentId
            },
            callbacks: {
                "ok": function (sender, data) {
                    PD.context.get_default().get_events().publish("explorer-folder/create", {
                        node: data,
                        parentId: parentId
                    });
                }
            }
        });

    }

});