|
|
|
@ -5,22 +5,14 @@ const EventManager = require('../../lib/events') |
|
|
|
|
var globalRegistry = require('../../global/registry') |
|
|
|
|
|
|
|
|
|
const styleguide = require('../ui/styles-guide/theme-chooser') |
|
|
|
|
const PluginManager = require('../plugin/pluginManager') |
|
|
|
|
const TabbedMenu = require('../tabs/tabbed-menu') |
|
|
|
|
const CompileTab = require('../tabs/compile-tab') |
|
|
|
|
const SettingsTab = require('../tabs/settings-tab') |
|
|
|
|
const AnalysisTab = require('../tabs/analysis-tab') |
|
|
|
|
const DebuggerTab = require('../tabs/debugger-tab') |
|
|
|
|
const SupportTab = require('../tabs/support-tab') |
|
|
|
|
const PluginTab = require('../tabs/plugin-tab') |
|
|
|
|
const TestTab = require('../tabs/test-tab') |
|
|
|
|
const RunTab = require('../tabs/run-tab') |
|
|
|
|
const DraggableContent = require('../ui/draggableContent') |
|
|
|
|
|
|
|
|
|
const styles = styleguide.chooser() |
|
|
|
|
|
|
|
|
|
module.exports = class RighthandPanel { |
|
|
|
|
constructor (localRegistry) { |
|
|
|
|
constructor ({pluginManager, tabs}, localRegistry) { |
|
|
|
|
const self = this |
|
|
|
|
self._components = {} |
|
|
|
|
self._components.registry = localRegistry || globalRegistry |
|
|
|
@ -33,57 +25,25 @@ module.exports = class RighthandPanel { |
|
|
|
|
dragbar: null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self._deps = { |
|
|
|
|
fileProviders: self._components.registry.get('fileproviders').api, |
|
|
|
|
fileManager: self._components.registry.get('filemanager').api, |
|
|
|
|
compiler: self._components.registry.get('compiler').api, |
|
|
|
|
udapp: self._components.registry.get('udapp').api, |
|
|
|
|
app: self._components.registry.get('app').api, |
|
|
|
|
txlistener: self._components.registry.get('txlistener').api |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var tabbedMenu = new TabbedMenu(self._components.registry) |
|
|
|
|
|
|
|
|
|
var pluginManager = new PluginManager( |
|
|
|
|
self._deps.app, |
|
|
|
|
self._deps.compiler, |
|
|
|
|
self._deps.txlistener, |
|
|
|
|
self._deps.fileProviders, |
|
|
|
|
self._deps.fileManager, |
|
|
|
|
self._deps.udapp |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
self._components.registry.put({api: pluginManager, name: 'pluginmanager'}) |
|
|
|
|
|
|
|
|
|
var analysisTab = new AnalysisTab(self._components.registry) |
|
|
|
|
analysisTab.event.register('newStaticAnaysisWarningMessage', (msg, settings) => { self._components.compile.addWarning(msg, settings) }) |
|
|
|
|
|
|
|
|
|
self._components.debuggerTab = new DebuggerTab(self._components.registry) |
|
|
|
|
|
|
|
|
|
self._components = { |
|
|
|
|
pluginManager: pluginManager, |
|
|
|
|
tabbedMenu: tabbedMenu, |
|
|
|
|
compile: new CompileTab(self._components.registry), |
|
|
|
|
run: new RunTab(self._components.registry), |
|
|
|
|
settings: new SettingsTab(self._components.registry), |
|
|
|
|
analysis: analysisTab, |
|
|
|
|
debug: self._components.debuggerTab, |
|
|
|
|
support: new SupportTab(self._components.registry), |
|
|
|
|
test: new TestTab(self._components.registry) |
|
|
|
|
tabs |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self._components.settings.event.register('plugin-loadRequest', json => { |
|
|
|
|
self._components.tabs.settings.event.register('plugin-loadRequest', json => { |
|
|
|
|
self.loadPlugin(json) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
self.loadPlugin = function (json) { |
|
|
|
|
var modal = new DraggableContent(() => { |
|
|
|
|
self._components.pluginManager.unregister(json) |
|
|
|
|
pluginManager.unregister(json) |
|
|
|
|
}) |
|
|
|
|
var tab = new PluginTab(json) |
|
|
|
|
var content = tab.render() |
|
|
|
|
document.querySelector('body').appendChild(modal.render(json.title, json.url, content)) |
|
|
|
|
self._components.pluginManager.register(json, modal, content) |
|
|
|
|
pluginManager.register(json, modal, content) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self._view.dragbar = yo`<div id="dragbar" class=${css.dragbar}></div>` |
|
|
|
@ -96,7 +56,7 @@ module.exports = class RighthandPanel { |
|
|
|
|
</div> |
|
|
|
|
</div>` |
|
|
|
|
|
|
|
|
|
const { compile, run, settings, analysis, debug, support, test } = self._components |
|
|
|
|
const { compile, run, settings, analysis, debug, support, test } = tabs |
|
|
|
|
self._components.tabbedMenu.addTab('Compile', 'compileView', compile.render()) |
|
|
|
|
self._components.tabbedMenu.addTab('Run', 'runView', run.render()) |
|
|
|
|
self._components.tabbedMenu.addTab('Analysis', 'staticanalysisView', analysis.render()) |
|
|
|
@ -106,11 +66,7 @@ module.exports = class RighthandPanel { |
|
|
|
|
self._components.tabbedMenu.addTab('Support', 'supportView', support.render()) |
|
|
|
|
self._components.tabbedMenu.selectTabByTitle('Compile') |
|
|
|
|
} |
|
|
|
|
// showDebugger () {
|
|
|
|
|
// const self = this
|
|
|
|
|
// if (!self._components.tabbedMenu) return
|
|
|
|
|
// self._components.tabbedMenu.selectTab(self._view.el.querySelector('li.debugView'))
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
|
const self = this |
|
|
|
|
if (self._view.element) return self._view.element |
|
|
|
@ -118,7 +74,7 @@ module.exports = class RighthandPanel { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
debugger () { |
|
|
|
|
return this._components.debug.debugger() |
|
|
|
|
return this._components.tabs.debug.debugger() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
focusOn (x) { |
|
|
|
|