Exemplo n.º 1
0
    /**
     * Create and/or show the editor for the specified document
     * @param {!Document} document - document to edit
     * @param {!Pane} pane - pane to show it in
     * @param {!Object} editorOptions - If specified, contains
     * editor options that can be passed to CodeMirror
     * @private
     */
    function _showEditor(document, pane, editorOptions) {
        // Ensure a main editor exists for this document to show in the UI
        var createdNewEditor = false,
            editor = document._masterEditor;
        
        if (!editor) {
            // Performance (see #4757) Chrome wastes time messing with selection
            // that will just be changed at end, so clear it for now
            if (window.getSelection && window.getSelection().empty) {  // Chrome
                window.getSelection().empty();
            }
            
            // Editor doesn't exist: populate a new Editor with the text
            editor = _createFullEditorForDocument(document, pane, editorOptions);
            createdNewEditor = true;
        } else if (editor.$el.parent()[0] !== pane.$content[0]) {
            // editor does exist but is not a child of the pane so add it to the 
            //  pane (which will switch the view's container as well)
            pane.addView(editor);
        }

        // show the view
        pane.showView(editor);

        if (MainViewManager.getActivePaneId() === pane.id) {
            // give it focus
            editor.focus();
        }

        if (createdNewEditor) {
            _restoreEditorViewState(editor);
        }
    }
Exemplo n.º 2
0
    WorkingSetView.prototype._redraw = function () {
        var paneId = MainViewManager.getActivePaneId();
        
        if (paneId === this.paneId) {
            this.$el.addClass("active");
        } else {
            this.$el.removeClass("active");
        }

        this._updateVisibility();
        this._adjustForScrollbars();
        this._fireSelectionChanged();
    };
Exemplo n.º 3
0
 WorkingSetView.prototype._redraw = function () {
     var fileList = MainViewManager.getWorkingSet(this.paneId),
         paneId = MainViewManager.getActivePaneId();
     
     if (paneId === this.paneId) {
         this.$el.addClass("active");
     } else {
         this.$el.removeClass("active");
     }
     
     if (!fileList || fileList.length === 0) {
         this.$openFilesContainer.hide();
         this.$workingSetListViewHeader.hide();
     } else {
         this.$openFilesContainer.show();
         this.$workingSetListViewHeader.show();
         this._checkForDuplicatesInWorkingTree();
     }
     this._adjustForScrollbars();
     this._fireSelectionChanged();
     this.updateOptionsButton();
 };
Exemplo n.º 4
0
 WorkingSetView.prototype.updateOptionsButton = function () {
     var visible = (MainViewManager.getActivePaneId() === this.paneId);
     this.$el.find(".working-set-option-btn").toggle(visible);
 };