   attachListeners:->
 
     @fileListView.on 'removeItem', (item)=>
+      @coffeeEditor.fileName = null
       @storage.unsetKey item.data.name
       @updateFileList()
 


    @storage.getValue "lastFile", (file)=>

      if not file or not @storage.data[file]?
        file = @createNewFile()

      @coffeeEditor.openFile file
      @updateFileList file

      @fileList.on 'ItemSelectionPerformed', (..., {items})=>
        @coffeeEditor.handleSave yes
        @coffeeEditor.openFile items.first.data.name


  toggleHelpMode:->



  updateFileList:(newname)->

    @loadExamples()
    prevFile = newname ? @fileList.first?.data?.name

    @storage.filter /file\-/, (files)=>

      @fileList.replaceAllItems files

      if prevFile
        for item in @fileList.itemsOrdered
          if item.data.name is prevFile
            @fileList.selectItem item
      else
        @fileList.selectItem @fileList.itemsOrdered.last


  runJsCode:->
