mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Reloading when there are modified buffers pops up a dialog.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# This a weirdo file. We don't create a Window class, we just add stuff to
|
||||
# the DOM window.
|
||||
|
||||
Native = require 'native'
|
||||
fs = require 'fs'
|
||||
_ = require 'underscore'
|
||||
$ = require 'jquery'
|
||||
@@ -60,6 +61,20 @@ windowAdditions =
|
||||
return if $("head style[path='#{fullPath}']").length
|
||||
$('head').append "<style path='#{fullPath}'>#{content}</style>"
|
||||
|
||||
reload: ->
|
||||
console.log rootView.modifiedBuffers()
|
||||
if rootView.modifiedBuffers().length > 0
|
||||
message = "There are unsaved buffers, reload anyway?"
|
||||
detailedMessage = "You will lose all unsaved changes if you reload"
|
||||
buttons = [
|
||||
["Reload", -> Native.reload()]
|
||||
["Cancel", ->]
|
||||
]
|
||||
|
||||
Native.alert(message, detailedMessage, buttons)
|
||||
else
|
||||
Native.reload()
|
||||
|
||||
showConsole: ->
|
||||
$native.showDevTools()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user