     fileName = "[#{file.vmName}]#{plainPath}"
     return fileName
 
+  saveOpenedTabsContentToLocalStorage: ->
+    {aceViews} = KD.singletons.appManager.get("Ace").mainView
+    for filePath in Object.keys aceViews
+      content = aceViews[filePath].ace.getContents()
+      @saveToLocalStorage filePath, content
 
   saveEditorHistory: ->
     log "NOT IMPLEMENTED YET"

  addToOpenedFiles: (fileName)->
    vmName = FSHelper.getVMNameFromPath fileName
    index  = @openedFiles.indexOf fileName
    if index == -1 and vmName
      @openedFiles.push fileName
      @storage.setValue "openedFiles", @openedFiles

  removeFromOpenedFiles: (file)->
    fileName = "[#{file.vmName}]#{file.path}"
    log fileName
    index = @openedFiles.indexOf fileName
    unless index == -1
      @openedFiles.splice index, 1
      @storage.setValue "openedFiles", @openedFiles


  getRecentOpenedFiles: ->
    @openedFiles

  getPatchedContent: (originalContent, localContent)->
    dmp = new diff_match_patch
    diffArray = dmp.diff_main originalContent, localContent
    return no unless diffArray.length > 0
    dmp.diff_cleanupEfficiency diffArray
    patchArray = dmp.patch_make originalContent, diffArray
    dmp.patch_apply patchArray, originalContent
