mirror of
https://github.com/atom/atom.git
synced 2026-02-14 16:45:14 -05:00
Pass a name string to RootView.activatePackage & deactivatePackage
Previously we were relying on the package module itself to have a `name` field. But now that we're using `atom.loadPackage` to load up packages, we can infer the name of the module from the name of the package directory.
This commit is contained in:
@@ -18,7 +18,7 @@ class AtomPackage extends Package
|
||||
@loadMetadata()
|
||||
@loadKeymaps()
|
||||
@loadStylesheets()
|
||||
rootView.activatePackage(@module) if @module
|
||||
rootView.activatePackage(@name, @module) if @module
|
||||
catch e
|
||||
console.error "Failed to load package named '#{@name}'", e.stack
|
||||
|
||||
|
||||
@@ -112,18 +112,17 @@ class RootView extends View
|
||||
when 'PaneColumn' then PaneColumn.deserialize(viewState, this)
|
||||
when 'Editor' then Editor.deserialize(viewState, this)
|
||||
|
||||
activatePackage: (packageModule) ->
|
||||
throw new Error("Trying to activate a package module with no name attribute") unless packageModule.name?
|
||||
@packageModules[packageModule.name] = packageModule
|
||||
packageModule.activate(this, @packageStates[packageModule.name])
|
||||
activatePackage: (name, packageModule) ->
|
||||
@packageModules[name] = packageModule
|
||||
packageModule.activate(this, @packageStates[name])
|
||||
|
||||
deactivatePackage: (packageModule) ->
|
||||
packageModule.deactivate?()
|
||||
delete @packageModules[packageModule.name]
|
||||
deactivatePackage: (name) ->
|
||||
@packageModules[name].deactivate?()
|
||||
delete @packageModules[name]
|
||||
|
||||
deactivate: ->
|
||||
atom.setRootViewStateForPath(@project.getPath(), @serialize())
|
||||
@deactivatePackage(packageModule) for name, packageModule of @packageModules
|
||||
@deactivatePackage(name) for name of @packageModules
|
||||
@remove()
|
||||
|
||||
open: (path, options = {}) ->
|
||||
|
||||
Reference in New Issue
Block a user