Archived
1
0
This repository has been archived on 2025-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
linter-mzn/language-mzn.coffee
2015-11-19 22:56:45 +01:00

34 lines
987 B
CoffeeScript

LanguageMznView = require './language-mzn-view'
{CompositeDisposable} = require 'atom'
module.exports = LanguageMzn =
languageMznView: null
modalPanel: null
subscriptions: null
activate: (state) ->
@languageMznView = new LanguageMznView(state.languageMznViewState)
@modalPanel = atom.workspace.addModalPanel(item: @languageMznView.getElement(), visible: false)
# Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
@subscriptions = new CompositeDisposable
# Register command that toggles this view
@subscriptions.add atom.commands.add 'atom-workspace', 'language-mzn:toggle': => @toggle()
deactivate: ->
@modalPanel.destroy()
@subscriptions.dispose()
@languageMznView.destroy()
serialize: ->
languageMznViewState: @languageMznView.serialize()
toggle: ->
console.log 'LanguageMzn was toggled!'
if @modalPanel.isVisible()
@modalPanel.hide()
else
@modalPanel.show()