mirror of
https://github.com/atom/atom.git
synced 2026-02-13 16:14:59 -05:00
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
const {Disposable, CompositeDisposable} = require('atom')
|
|
const DeprecationCopView = require('./deprecation-cop-view')
|
|
const DeprecationCopStatusBarView = require('./deprecation-cop-status-bar-view')
|
|
const ViewURI = 'atom://deprecation-cop'
|
|
|
|
class DeprecationCopPackage {
|
|
activate () {
|
|
this.disposables = new CompositeDisposable()
|
|
this.disposables.add(atom.workspace.addOpener((uri) => {
|
|
if (uri === ViewURI) {
|
|
return this.deserializeDeprecationCopView({uri})
|
|
}
|
|
}))
|
|
this.disposables.add(atom.commands.add('atom-workspace', 'deprecation-cop:view', () => {
|
|
atom.workspace.open(ViewURI)
|
|
}))
|
|
}
|
|
|
|
deactivate () {
|
|
this.disposables.dispose()
|
|
const pane = atom.workspace.paneForURI(ViewURI)
|
|
if (pane) {
|
|
pane.destroyItem(pane.itemForURI(ViewURI))
|
|
}
|
|
}
|
|
|
|
deserializeDeprecationCopView (state) {
|
|
return new DeprecationCopView(state)
|
|
}
|
|
|
|
consumeStatusBar (statusBar) {
|
|
const statusBarView = new DeprecationCopStatusBarView()
|
|
const statusBarTile = statusBar.addRightTile({item: statusBarView, priority: 150})
|
|
this.disposables.add(new Disposable(() => { statusBarView.destroy() }))
|
|
this.disposables.add(new Disposable(() => { statusBarTile.destroy() }))
|
|
}
|
|
}
|
|
|
|
module.exports = new DeprecationCopPackage()
|