         @showHandleContainer()
 
 
-  # temp fix sinan 27 Nov 12
-  # not calling @removePane but @_removePane
   handleClicked:(index, event)->
     pane        = @getPaneByIndex index
     appView     = pane.getMainView()
-    appInstance = appManager.getByView appView
+    appInstance = @appManager.getByView appView
     options     = appInstance.getOptions()
-    @getSingleton('router').handleRoute "#{options.route}"
 
     if $(event.target).hasClass "close-tab"
-      pane.mainView.destroy()
+      @appManager.quit appInstance
       return no
-
-    # this is a temporary fix for third party apps
-    # until router handles everything correctly
-    if options.route is '/Develop'
-      appManager.showInstance appInstance
+    else
+      @appManager.showInstance appInstance
 
   showHandleContainer:->
     @tabHandleContainer.$().css top : -25

class MainTabView extends KDTabView

  lastOpenPaneIndex = null

  constructor:(options,data)->
    options.resizeTabHandles    = yes

    @visibleHandles             = []
    @totalSize                  = 0
    super options,data
    @router                     = @getSingleton 'router'
    @appManager                 = @getSingleton("appManager")

    @appManager.on 'AppManagerWantsToShowAnApp', (controller, view, options)=>
      if view.parent
      then @showPane view.parent
      else @createTabPane options, view

    @getSingleton("mainView").on "mainViewTransitionEnd", (e) =>
      if e.target is @getSingleton("contentPanel").domElement[0]
