     @tabView.addPane pane
     @activeTabIndex = @tabView.panes.length
 
+    workspaceRefData =
+      sessionKey : editor.sessionKey
+
+    if file
+      workspaceRefData.path = file.path
+      @openedFiles.push file.path
+
+    @workspaceRef.child("tabs").push workspaceRefData  unless sessionKey
+
     pane.on "KDTabPaneDestroy", =>
       @workspaceRef.once "value", (snapshot) =>
         {tabs} = snapshot.val()

        @workspaceRef.set { tabs }

      @openedFiles.splice @openedFiles.indexOf(file.path), 1

    workspaceRefData =
      sessionKey : editor.sessionKey

    if file
      workspaceRefData.path = file.path
      @openedFiles.push file.path

    @workspaceRef.child("tabs").push workspaceRefData  unless sessionKey

    return yes # return something instead of workspaceRef.child


        @tabView.showPaneByIndex val.ActiveTabIndex
        return @workspaceRef.child("ActiveTabIndex").remove()

      if val.tabs?
        for key, data of val.tabs
          if data.path and @openedFiles.indexOf(data.path) is -1
            file = FSHelper.createFileFromPath data.path
            @createEditorInstance file, null, data.sessionKey

    @workspaceRef.onDisconnect().remove()  if @workspace.amIHost()

  createEditorTabs: ->
    @tabHandleContainer = new ApplicationTabHandleHolder
      delegate          : @
      addPlusHandle     : no

    @tabView = new ApplicationTabView
      delegate           : @
