 
     @appControllers = {}
     @frontApp       = null
+    @on 'AppManagerWantsToShowAnApp', @bound "setFrontApp"
+
+    # temp fix, until router logic is complete
+    @on 'AppManagerWantsToShowAnApp', @bound "setMissingRoute"
+
     @defaultApps    =
       text  : "Ace"
       video : "Viewer"
       image : "Viewer"
       sound : "Viewer"
-    @on 'AppManagerWantsToShowAnApp', @bound "setFrontApp"
-
-    # temp fix, until router logic is complete
-    @on 'AppManagerWantsToShowAnApp', @bound "setMissingRoute"
 
   # temp fix, until router logic is complete
   setMissingRoute:(appController, appView, appOptions)->

      callback?()


  openFile:(file)->

    type = FSItem.getFileType file.getExtension()

    switch type
      when 'code','text','unknown'
        log "open with a text editor"
        @open @defaultApps.text, (appController)-> appController.openFile file
      when 'image'
        log "open with an image processing app"
      when 'video'
        log "open with a video app"
      when 'sound'

          options.requestedFromAppManager = yes
          @open name, options, callback
        return
      else if appOptions?.thirdParty and not options.requestedFromAppsController and not @appControllers[appOptions.name]
        kodingAppsController.runApp (KD.getAppOptions name), callback
        return

