       val  = snapshot.val()
       return unless val
 
-      {tabs} = snapshot.val()
+      if val.ActiveTabIndex?
+        @tabView.showPaneByIndex val.ActiveTabIndex
+        return @workspaceRef.child("ActiveTabIndex").remove()
+
+      {tabs} = val
       return unless tabs
 
       for key, data of tabs


    pane.addSubView editor
    @tabView.addPane pane

    pane.on "KDTabPaneDestroy", =>
      @workspaceRef.once "value", (snapshot) =>

    @tabView = new ApplicationTabView
      delegate           : @
      tabHandleContainer : @tabHandleContainer

    @tabView.on "PaneAdded", (pane) =>
      {tabHandle} = pane
      tabHandle.on "click", =>
        newIndex = @tabView.getPaneIndex @tabView.getActivePane()
        return  if newIndex is @activeTabIndex

        @workspaceRef.child("ActiveTabIndex").set newIndex
        @activeTabIndex = newIndex

  createEditorInstance: (file, content, sessionKey) ->
    if file
