       else
         @getData().emit "file.requests.save", contents
 
+  preview: ->
+    publicUrlCheck = /.*\/(.*\.koding.com)\/website\/(.*)/
+    publicPath = @getData().path.replace publicUrlCheck, 'http://$1/$2'
+    return if publicPath is @getData().path
+    KD.getSingleton("appManager").open "Viewer", (appInstance)->
+      appInstance.open publicPath
+
+  compileAndRun: ->
+    manifest = KodingAppsController.getManifestFromPath @getData().path
+    @ace.notify "Compiling...", null, yes
+    @getSingleton('kodingAppsController').compileApp manifest.name, (err)=>
+      if not err
+        @ace.notify "App compiled!", "success"
+      else
+        @ace.notify "Trying to run old version..."
+      @getSingleton('kodingAppsController').runApp manifest
+      @compileAndRunButton.hideLoader()
+
   viewAppended:->
 
     super

    super

    @listenWindowResize()

    @editorHeader = new KDView
      cssClass : "editor-header header-buttons"

    @editorHeader.addSubView @headerButtonContainer = new KDView
      cssClass : "header-buttons"

    @saveButton = new KDButtonViewWithMenu
      title         : "Save"
      style         : "editor-button save-menu"
      type          : "contextmenu"
      delegate      : @
      menu          : @getSaveMenu.bind @
      callback      : =>
        @ace.requestSave()
    @saveButton.disable()

    @caretPosition = new KDCustomHTMLView
      tagName       : "div"

      menu          : @getAdvancedSettingsMenuItems.bind @
    @advancedSettings.disable()

    @findAndReplaceView = new AceFindAndReplaceView delegate: @
    @findAndReplaceView.hide()

    @setViewListeners()

