       item: @levelStatusView
       priority: 9
 
+  ## Serialization -------------------------------------------------------------
+
+  serializeWorkspace: ->
+    serializedLevelCodeEditorsById = {}
+    for levelCodeEditor in workspace.getLevelCodeEditors()
+      serializedLevelCodeEditorsById[levelCodeEditor.getId()] =
+        language: levelCodeEditor.getLanguage().getName()
+        level: levelCodeEditor.getLevel().getName()
+        serializedTerminal: undefined
+    {serializedLevelCodeEditorsById}
+
 # ------------------------------------------------------------------------------
 
 module.exports =


class WorkspaceManager

  ## Initialization and clean-up operations ------------------------------------

  setUpWorkspace: (state) ->
    # add view providers
    @viewProviders = new CompositeDisposable
    @viewProviders.add atom.views.addViewProvider Terminal, (terminal) ->
      new TerminalView(terminal)

    # create view components
    @levelStatusView = new LevelStatusView(workspace)
    @levelSelectorView = new LevelSelectorView(workspace)
    @languageConfigView = new LanguageConfigView(workspace)

  cleanUpWorkspace: ->
    # remove view providers
    @viewProviders.dispose()

    # destroy view components
    @levelStatusView.destroy()
    @levelSelectorView.destroy()
    @languageConfigView.destroy()

    # destroy status bar tiles
    @levelStatusTile.destroy()

  activate: ->
    @subscribeToAtomWorkspace()
    @subscribeToLanguageRegistry()

  deactivate: ->
    @unsubscribeFromAtomWorkspace()

  ## Atom workspace subscriptions ----------------------------------------------


{CompositeDisposable} = require('atom')

languageInstaller     = require('./language-installer').getInstance()
languageRegistry      = require('./language-registry').getInstance()
workspace             = require('./workspace').getInstance()

