     set_cell_type: (id, cell_type='code') =>
         if cell_type != 'markdown' and cell_type != 'raw' and cell_type != 'code'
             throw Error("cell type (='#{cell_type}') must be 'markdown', 'raw', or 'code'")
-        if not @store.is_cell_editable(id)
-            @show_edit_protection_error()
-            return
+        return if @store.check_edit_protection(id, @)
         obj =
             type      : 'cell'
             id        : id

        v = @store.get_selected_cell_ids_list()
        for id in v
            cell = cells.get(id)
            try
                if cell.get('output')? or cell.get('exec_count')
                    @_set({type:'cell', id:id, output:null, exec_count:null}, false)
            catch ex
                if ex is CellWriteProtectedException
                    if v.length == 1
                        @show_edit_protection_error()
                else
                    throw ex
        @_sync()

    clear_all_outputs: =>
        @store.get('cells').forEach (cell, id) =>
            if cell.get('output')? or cell.get('exec_count')
                try
                    @_set({type:'cell', id:id, output:null, exec_count:null}, false)
                catch ex
                    if ex isnt CellWriteProtectedException
                        throw ex
            return
        @_sync()


        md_edit_ids = @store.get('md_edit_ids')
        if md_edit_ids.contains(id)
            return
        return if @store.check_edit_protection(id, @)
        @setState(md_edit_ids : md_edit_ids.add(id))

    set_md_cell_not_editing: (id) =>
