mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
rename events: {project,editor}:load => {project,editor}:open
This commit is contained in:
@@ -8,7 +8,7 @@ EditorPane = require 'editor-pane'
|
||||
{UndoManager} = require 'ace/undomanager'
|
||||
|
||||
# Events:
|
||||
# editor:load (editor) -> Called when an editor is loaded.
|
||||
# editor:open (editor) -> Called when an editor is opened.
|
||||
module.exports =
|
||||
class Editor extends Resource
|
||||
window.resourceTypes.push this
|
||||
@@ -79,7 +79,7 @@ class Editor extends Resource
|
||||
|
||||
window.setTitle @title()
|
||||
@dirty = false
|
||||
atom.trigger 'editor:load', this
|
||||
atom.trigger 'editor:open', this
|
||||
|
||||
true
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ fs = require 'fs'
|
||||
Resource = require 'resource'
|
||||
|
||||
# Events:
|
||||
# project:load (project) -> Called when a project is loaded.
|
||||
# project:resource:load (project, resource) ->
|
||||
# Called when the project loads a resource.
|
||||
# project:open (project) -> Called when a project is opened.
|
||||
# project:resource:open (project, resource) ->
|
||||
# Called when the project opens a resource.
|
||||
# project:resource:active (project, resource) ->
|
||||
# Called when a resource becomes active (i.e. the focal point)
|
||||
# in a project.
|
||||
@@ -35,7 +35,7 @@ class Project extends Resource
|
||||
|
||||
@url = url
|
||||
@show()
|
||||
atom.trigger 'project:load', this
|
||||
atom.trigger 'project:open', this
|
||||
|
||||
true
|
||||
else if @url
|
||||
@@ -47,7 +47,7 @@ class Project extends Resource
|
||||
if (fs.isFile url) and not @childURL url
|
||||
return false
|
||||
|
||||
# Is this resource already loaded?
|
||||
# Is this resource already open?
|
||||
if @resources[url]
|
||||
@activeResource = @resources[url]
|
||||
atom.trigger 'project:resource:active', this, @activeResource
|
||||
@@ -61,13 +61,19 @@ class Project extends Resource
|
||||
|
||||
if success
|
||||
@resources[url] = @activeResource = resource
|
||||
atom.trigger 'project:resource:load', this, resource
|
||||
atom.trigger 'project:resource:open', this, resource
|
||||
atom.trigger 'project:resource:active', this, resource
|
||||
true
|
||||
|
||||
save: ->
|
||||
@activeResource?.save()
|
||||
|
||||
close: ->
|
||||
if @activeResource
|
||||
@activeResource.close()
|
||||
else
|
||||
super
|
||||
|
||||
# Determines if a passed URL is a child of @url.
|
||||
# Returns a Boolean.
|
||||
childURL: (url) ->
|
||||
|
||||
Reference in New Issue
Block a user