/// class PD.Manage.Shared.AceEditor.EditorToggleInvisiblesCommand
// using PD.Commands.Command

PD.Manage.Shared.AceEditor.EditorToggleInvisiblesCommand =
PD.Commands.Command.extend({

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

    setDefaults: function () {

        this._super();

        this.props("id", "editor/invisibles/show");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("symbol_paragraph.png"));
        this.props("canExecute", true);
        this.props("toggled", false);
        this.props("tooltip", "Toggle Invisibles");

        this.state("editor", null);

    },

    setState: function (state) {
        this._super(state);
        this.props("enabled", this.isEnabled());
        this.props("toggled", this.isToggled());
    },

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

        var editor = this.state("editor");

        if (editor != null) {
            result = editor.showInvisibles(!editor.showInvisibles());
        }

    },

    isEnabled: function () {
        return this.state("editor") != null;
    },

    isToggled: function () {

        var result = false,
            editor = this.state("editor");

        if (editor != null) {
            result = editor.showInvisibles();
        }

        return result;

    }

});