Add missing focusedWindow method

This regressed when this code was moved in here in
6d50d05336 and was somehow
still triggereable since it was reported to atom@github.com
This commit is contained in:
Kevin Sawicki 2014-03-28 15:55:04 -07:00
parent 0742909953
commit 373a7a6d04

View File

@ -9,9 +9,6 @@ _ = require 'underscore-plus'
# and maintain the state of all menu items.
module.exports =
class ApplicationMenu
version: null
menu: null
constructor: (@version) ->
@menu = Menu.buildFromTemplate @getDefaultTemplate()
Menu.setApplicationMenu @menu
@ -103,13 +100,16 @@ class ApplicationMenu
[
label: "Atom"
submenu: [
{ label: 'Reload', accelerator: 'Command+R', click: -> @focusedWindow()?.reload() }
{ label: 'Close Window', accelerator: 'Command+Shift+W', click: -> @focusedWindow()?.close() }
{ label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: -> @focusedWindow()?.toggleDevTools() }
{ label: 'Reload', accelerator: 'Command+R', click: => @focusedWindow()?.reload() }
{ label: 'Close Window', accelerator: 'Command+Shift+W', click: => @focusedWindow()?.close() }
{ label: 'Toggle Dev Tools', accelerator: 'Command+Alt+I', click: => @focusedWindow()?.toggleDevTools() }
{ label: 'Quit', accelerator: 'Command+Q', click: -> app.quit() }
]
]
focusedWindow: ->
_.find global.atomApplication.windows, (atomWindow) -> atomWindow.isFocused()
# Combines a menu template with the appropriate keystroke.
#
# * template: