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


  updateFileList:(newname)->

    prevFile = newname ? @fileList.first?.data?.name
    @storage.filter /file\-/, (files)=>
      @fileList.replaceAllItems files

      if files.length is 0
        @coffeeEditor.openFile file = @createNewFile()
        return @updateFileList file

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


  runJsCode:->


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

      @coffeeEditor.openFile file  if file?

      @fileList.on 'ItemSelectionPerformed', (..., {items})=>

        if @coffeeEditor.fileName?
          @coffeeEditor.handleSave yes

        @coffeeEditor.openFile items.first.data.name

      @updateFileList file

  toggleHelpMode:->

