|
| 1 | +'use babel' |
| 2 | +import { CompositeDisposable, Disposable } from 'atom'; |
| 3 | + |
| 4 | +export default { |
| 5 | + // TODO Fix all of these dynamic requires and circular dependencies |
| 6 | + notifications: require('./ui/notifications'), |
| 7 | + selector: require('./ui/selector'), |
| 8 | + views: require('./ui/views'), |
| 9 | + progress: require('./ui/progress'), |
| 10 | + layout: require('./ui/layout'), |
| 11 | + docpane: require('./ui/docs'), |
| 12 | + focusutils: require('./ui/focusutils'), |
| 13 | + cellhighlighter: require('./ui/cellhighlighter'), |
| 14 | + |
| 15 | + activate(client) { |
| 16 | + this.client = client; |
| 17 | + this.subs = new CompositeDisposable; |
| 18 | + |
| 19 | + this.notifications.activate(); |
| 20 | + this.subs.add(atom.config.observe('julia-client.uiOptions.highlightCells', val => { |
| 21 | + if (val) { |
| 22 | + this.cellhighlighter.activate(); |
| 23 | + } else { |
| 24 | + this.cellhighlighter.deactivate(); |
| 25 | + } |
| 26 | + }) |
| 27 | + ); |
| 28 | + this.subs.add(new Disposable(() => { |
| 29 | + this.cellhighlighter.deactivate(); |
| 30 | + }) |
| 31 | + ); |
| 32 | + |
| 33 | + this.subs.add(this.client.onAttached(() => { |
| 34 | + this.notifications.show("Client Connected"); |
| 35 | + }) |
| 36 | + ); |
| 37 | + this.subs.add(this.client.onDetached(() => { |
| 38 | + // TODO do we need this optional chaining check? |
| 39 | + this.ink && this.ink.Result && this.ink.Result.invalidateAll() |
| 40 | + }) |
| 41 | + ); |
| 42 | + }, |
| 43 | + |
| 44 | + deactivate() { |
| 45 | + this.subs.dispose(); |
| 46 | + }, |
| 47 | + |
| 48 | + consumeInk(ink) { |
| 49 | + this.ink = ink; |
| 50 | + this.views.ink = this.ink; |
| 51 | + this.selector.activate(this.ink); |
| 52 | + this.docpane.activate(this.ink); |
| 53 | + this.progress.activate(this.ink); |
| 54 | + this.focusutils.activate(this.ink); |
| 55 | + this.subs.add(new Disposable(() => { |
| 56 | + this.docpane.deactivate(); |
| 57 | + this.progress.deactivate(); |
| 58 | + this.focusutils.deactivate(); |
| 59 | + })); |
| 60 | + } |
| 61 | +}; |
0 commit comments