|
| 1 | +'use babel' |
| 2 | +import { CompositeDisposable, Disposable } from 'atom'; |
| 3 | + |
| 4 | +// TODO use babel to export ... from ... |
| 5 | +import notifications from './ui/notifications' |
| 6 | +import * as selector from './ui/selector' |
| 7 | +import views from './ui/views' |
| 8 | +import progress from './ui/progress' |
| 9 | +import * as layout from './ui/layout' |
| 10 | +import * as docpane from './ui/docs' |
| 11 | +import * as focusutils from './ui/focusutils' |
| 12 | +import * as cellhighlighter from './ui/cellhighlighter' |
| 13 | + |
| 14 | +exports.notifications = notifications |
| 15 | +exports.selector = selector |
| 16 | +exports.views = views |
| 17 | +exports.progress = progress |
| 18 | +exports.layout = layout |
| 19 | +exports.docpane = docpane |
| 20 | +exports.focusutils = focusutils |
| 21 | +exports.cellhighlighter = cellhighlighter |
| 22 | + |
| 23 | +let client; |
| 24 | +let subs; |
| 25 | +let ink; |
| 26 | + |
| 27 | +export function activate(client_in) { |
| 28 | + client = client_in; |
| 29 | + subs = new CompositeDisposable; |
| 30 | + |
| 31 | + notifications.activate(); |
| 32 | + subs.add(atom.config.observe('julia-client.uiOptions.highlightCells', val => { |
| 33 | + if (val) { |
| 34 | + cellhighlighter.activate(); |
| 35 | + } else { |
| 36 | + cellhighlighter.deactivate(); |
| 37 | + } |
| 38 | + }) |
| 39 | + ); |
| 40 | + subs.add(new Disposable(() => { |
| 41 | + cellhighlighter.deactivate(); |
| 42 | + }) |
| 43 | + ); |
| 44 | + |
| 45 | + subs.add(client.onAttached(() => { |
| 46 | + notifications.show("Client Connected"); |
| 47 | + }) |
| 48 | + ); |
| 49 | + subs.add(client.onDetached(() => { |
| 50 | + if (ink) { |
| 51 | + ink.Result.invalidateAll() |
| 52 | + } |
| 53 | + }) |
| 54 | + ); |
| 55 | +} |
| 56 | + |
| 57 | +export function deactivate() { |
| 58 | + subs.dispose(); |
| 59 | +} |
| 60 | + |
| 61 | +export function consumeInk(ink_in) { |
| 62 | + ink = ink_in; |
| 63 | + views.ink = ink; |
| 64 | + selector.activate(ink); |
| 65 | + docpane.activate(ink); |
| 66 | + progress.activate(ink); |
| 67 | + focusutils.activate(ink); |
| 68 | + subs.add(new Disposable(() => { |
| 69 | + docpane.deactivate(); |
| 70 | + progress.deactivate(); |
| 71 | + focusutils.deactivate(); |
| 72 | + })); |
| 73 | +} |
0 commit comments