 
     lines.join '\n'
 
-   @listen 'save', ->
-    text = @removeTrailingSpace @editor.getText()
-    @editor.setText text
-    @content = text
-    @send 'saveFileContent', content: text
+   @listen 'saveTemporary', ->
+    return if not @file?
+    return if not @_editorChanged
+    @saveContent()
+    @_editorChanged = false
 
    @listen 'watchChanges', ->
-    if @_editorChanged
-     @send 'change', content: @editor.getText()
-     @_editorChanged = false
+    return if not @file?
     if @editor.getText() isnt @content
      if not @_changed
-      @send 'fileChanged', changed: true
+      @elems.saveName.textContent = "#{@file.name} *"
       @_changed = true
     else
      if @_changed
-      @send 'fileChanged', changed: false
+      @elems.saveName.textContent = "#{@file.name}"
       @_changed = false
 
 

    @content = ''
    @editor = new Editor
     openUrl: @on.openUrl
     onChanged: @on.changed

   @listen 'addResources', (data) ->
    console.log 'resources', data.length

    text = @removeTrailingSpace @editor.getText()
    @editor.setText text


   @listen 'error', (e) ->
    console.error e

   @listen 'editorChanged', ->
    @_editorChanged = true

   @listen 'openUrl', (url) ->
