2014-02-12 05:23:40 -05:00
|
|
|
define [
|
|
|
|
"file-view/FileView"
|
|
|
|
], (FileView) ->
|
|
|
|
class FileViewManager
|
|
|
|
constructor: (@ide) ->
|
|
|
|
@view = new FileView()
|
|
|
|
|
|
|
|
@ide.mainAreaManager.addArea
|
|
|
|
identifier: "file"
|
|
|
|
element: @view.$el
|
|
|
|
|
|
|
|
$(window).resize () => @view.onResize()
|
|
|
|
@ide.layoutManager.on "resize", () => @view.onResize()
|
|
|
|
@view.onResize()
|
|
|
|
|
2014-03-20 12:30:37 -04:00
|
|
|
@bindToFileTreeEvents()
|
|
|
|
@enable()
|
|
|
|
|
|
|
|
bindToFileTreeEvents: () ->
|
|
|
|
@ide.fileTreeManager.on "open:file", (file) =>
|
|
|
|
if @enabled
|
|
|
|
@showFile(file)
|
|
|
|
|
2014-02-12 05:23:40 -05:00
|
|
|
showFile: (file) ->
|
2014-03-20 12:30:37 -04:00
|
|
|
@ide.mainAreaManager.change('file')
|
2014-02-12 05:23:40 -05:00
|
|
|
@view.setModel(file)
|
2014-03-20 12:30:37 -04:00
|
|
|
|
|
|
|
enable: () ->
|
|
|
|
@enabled = true
|
|
|
|
|
|
|
|
disable: () ->
|
|
|
|
@enabled = false
|