Add opened files and folders to recent documents menu

This commit is contained in:
Douwe Maan 2015-11-15 20:51:07 +01:00
parent 7c9d32d8d6
commit 948aaa0652
4 changed files with 12 additions and 1 deletions

View File

@ -109,6 +109,9 @@ class ApplicationDelegate
setRepresentedFilename: (filename) ->
ipc.send("call-window-method", "setRepresentedFilename", filename)
addRecentDocument: (filename) ->
ipc.send("add-recent-document", filename)
setRepresentedDirectoryPaths: (paths) ->
loadSettings = getWindowLoadSettings()
loadSettings['initialPaths'] = paths

View File

@ -885,7 +885,9 @@ class AtomEnvironment extends Model
else
@project.addPath(pathToOpen)
unless fs.isDirectorySync(pathToOpen)
if fs.isDirectorySync(pathToOpen)
@applicationDelegate.addRecentDocument(pathToOpen)
else
@workspace?.open(pathToOpen, {initialLine, initialColumn})
return

View File

@ -281,6 +281,9 @@ class AtomApplication
ipc.on 'write-to-stderr', (event, output) ->
process.stderr.write(output)
ipc.on 'add-recent-document', (event, filename) ->
app.addRecentDocument(filename)
setupDockMenu: ->
if process.platform is 'darwin'
dockMenu = Menu.buildFromTemplate [

View File

@ -488,6 +488,9 @@ class Workspace extends Model
if initialLine >= 0 or initialColumn >= 0
item.setCursorBufferPosition?([initialLine, initialColumn])
path = item.getPath?()
@applicationDelegate.addRecentDocument(path) if path?
index = pane.getActiveItemIndex()
@emitter.emit 'did-open', {uri, pane, item, index}
item