     version: 2
     activePanelName: @activePanelName
 
+  getPackageTitle: ({name}) ->
+    _.undasherize(_.uncamelcase(name))
+
   addPanelMenuSeparator: ->
     @panelMenu.append $$ ->
       @div class: 'panel-menu-separator'
 
-  addPanel: (name, iconName, panel) ->
-    if arguments.length is 2
-      panel = iconName
-      iconName = null
+  addCorePanel: (name, iconName, panel) ->
+    panelMenuItem = $$ ->
+      @li name: name, =>
+        @a class: "icon icon-#{iconName}", name
+    @addPanel(name, panelMenuItem, panel)
 
-    label = _.undasherize(_.uncamelcase(name))
-    panelItem = $$ ->
-      @li name: name, =>
-        if iconName
-          @a class: "icon icon-#{iconName}", label
-        else
-          @a label
+  addPackagePanel: (pack) ->
+    panel = new InstalledPackageView(pack, @packageManager)
+    title = @getPackageTitle(pack)
+    panelMenuItem = $$ ->
+      @li name: pack.name, type: 'package', =>
+        @a title
+    @addPanel(pack.name, panelMenuItem, panel)
 
-    @panelMenu.append(panelItem)
+  addPanel: (name, panelMenuItem, panel) ->
+    @panelMenu.append(panelMenuItem)
     panel.hide()
     @panelsByName[name] = panel
     @showPanel(name) if @getPanelCount() is 1 or @panelToShow is name
 
   getPanelCount: ->
     _.values(@panelsByName).length
+
+  makePanelMenuActive: (name) ->
+    @panelMenu.children('.active').removeClass('active')
+    @panelMenu.children("[name='#{name}']").addClass('active')
 
   showPanel: (name) ->
     if panel = @panelsByName?[name]

          name = metadata?.name ? packageName
          packages.push({name, metadata})

    packages.sort (pack1, pack2) ->
      title1 = _.undasherize(_.uncamelcase(pack1.name))
      title2 = _.undasherize(_.uncamelcase(pack2.name))
      title1.localeCompare(title2)

    @addPanelMenuSeparator()

    for pack in packages
      @addPanel(pack.name, new InstalledPackageView(pack, @packageManager))

    @showPanel(activePanelName) if activePanelName


      panel.show()
      for editorElement in @panelsByName[name].find(".editor")
        $(editorElement).view().redraw()
      @makePanelMenuActive(name)
      @activePanelName = name
      @panelToShow = null
    else
