diff --git a/src/app/files/fileManager.js b/src/app/files/fileManager.js index 5fd6d4dc88..e4c9cda247 100644 --- a/src/app/files/fileManager.js +++ b/src/app/files/fileManager.js @@ -1,7 +1,6 @@ 'use strict' const EventEmitter = require('events') -var EventManager = require('../../lib/events') var globalRegistry = require('../../global/registry') var CompilerImport = require('../compiler/compiler-imports') @@ -13,7 +12,6 @@ var CompilerImport = require('../compiler/compiler-imports') class FileManager { constructor (localRegistry) { this.openedFiles = {} // list all opened files - this.event = new EventManager() this.events = new EventEmitter() this._components = {} this._components.compilerImport = new CompilerImport() @@ -43,9 +41,6 @@ class FileManager { self._deps.localhostExplorer.event.register('errored', (event) => { this.removeTabsOf(self._deps.localhostExplorer) }) self._deps.localhostExplorer.event.register('closed', (event) => { this.removeTabsOf(self._deps.localhostExplorer) }) - self.event.register('currentFileChanged', (file, provider) => { - this.events.emit('currentFileChanged', file) - }) } profile () { @@ -84,7 +79,7 @@ class FileManager { this.switchFile(newFocus) } } - this.event.trigger('fileRenamed', [oldName, newName]) + this.events.emit('fileRenamed', oldName, newName) } currentFileProvider () { @@ -107,7 +102,7 @@ class FileManager { this._deps.editor.displayEmptyReadOnlySession() this._deps.config.set('currentFile', '') } - this.event.trigger('fileClosed', [name]) + this.events.emit('fileClosed', name) } currentPath () { @@ -167,7 +162,7 @@ class FileManager { } self._deps.editor.discard(path) delete this.openedFiles[path] - this.event.trigger('fileRemoved', [path]) + this.events.emit('fileRemoved', path) this.switchFile() } @@ -182,7 +177,7 @@ class FileManager { if (fileList.length) { _switchFile(browserProvider.type + '/' + fileList[0]) } else { - self.event.trigger('currentFileChanged', []) + self.events.emit('currentFileChanged') self._deps.editor.displayEmptyReadOnlySession() } }) @@ -200,7 +195,7 @@ class FileManager { } else { self._deps.editor.open(file, content) } - self.event.trigger('currentFileChanged', [file, self.fileProviderOf(file)]) + self.events.emit('currentFileChanged', file) } }) } diff --git a/src/app/panels/editor-panel.js b/src/app/panels/editor-panel.js index 03116e0ab9..e7b27ae535 100644 --- a/src/app/panels/editor-panel.js +++ b/src/app/panels/editor-panel.js @@ -61,7 +61,7 @@ class EditorPanel { We listen here on event from the tab component to display / hide the editor and mainpanel depending on the content that should be displayed */ - self._deps.fileManager.event.register('currentFileChanged', (file) => { + self._deps.fileManager.events.on('currentFileChanged', (file) => { // we check upstream for "fileChanged" self._view.editor.style.display = 'block' self._components.contextView.show() diff --git a/src/app/panels/tab-proxy.js b/src/app/panels/tab-proxy.js index ff8d8ee733..d1729b4bf0 100644 --- a/src/app/panels/tab-proxy.js +++ b/src/app/panels/tab-proxy.js @@ -15,15 +15,15 @@ export class TabProxy { this._view = {} this._handlers = {} - fileManager.event.register('fileRemoved', (name) => { + fileManager.events.on('fileRemoved', (name) => { this.removeTab(name) }) - fileManager.event.register('fileClosed', (name) => { + fileManager.events.on('fileClosed', (name) => { this.removeTab(name) }) - fileManager.event.register('currentFileChanged', (file) => { + fileManager.events.on('currentFileChanged', (file) => { if (this._handlers[file]) { this._view.filetabs.activateTab(file) return @@ -38,7 +38,7 @@ export class TabProxy { }) }) - fileManager.event.register('fileRenamed', (oldName, newName) => { + fileManager.events.on('fileRenamed', (oldName, newName) => { this.removeTab(oldName) this.addTab(newName, () => { this.fileManager.switchFile(newName) diff --git a/src/app/plugin/pluginManager.js b/src/app/plugin/pluginManager.js index 852c0e73b0..98b865537c 100644 --- a/src/app/plugin/pluginManager.js +++ b/src/app/plugin/pluginManager.js @@ -93,7 +93,7 @@ module.exports = class PluginManager { self.plugins = {} self.origins = {} self.inFocus - fileManager.event.register('currentFileChanged', (file, provider) => { + fileManager.events.on('currentFileChanged', (file) => { self.broadcast(JSON.stringify({ action: 'notification', key: 'editor', diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 66329f7912..6705be3444 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -75,12 +75,13 @@ class CompileTab { } }) - this._deps.fileManager.event.register('currentFileChanged', (name) => { + this._deps.fileManager.events.on('currentFileChanged', (name) => { this.compilerContainer.currentFile = name }) this.compiler.event.register('compilationFinished', (success, data, source) => { if (success) { // forwarding the event to the appManager infra + console.log(source.target, source, this.data.selectedVersion, data) this.events.emit('compilationFinished', source.target, source, this.data.selectedVersion, data) // Store the contracts this.data.contractsDetails = {} diff --git a/src/app/tabs/runTab/model/dropdownlogic.js b/src/app/tabs/runTab/model/dropdownlogic.js index 57a28c61e6..e8528630ba 100644 --- a/src/app/tabs/runTab/model/dropdownlogic.js +++ b/src/app/tabs/runTab/model/dropdownlogic.js @@ -21,7 +21,7 @@ class DropdownLogic { this.listenToCompilationEvents() - fileManager.event.register('currentFileChanged', (currentFile) => { + fileManager.events.on('currentFileChanged', (currentFile) => { this.event.trigger('currentFileChanged', [currentFile]) }) } diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 2fdbfa149b..621fd3c33b 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -116,7 +116,7 @@ module.exports = class TestTab { self.data.selectedTests.push(file) }) - self._deps.fileManager.event.register('currentFileChanged', (file, provider) => { + self._deps.fileManager.events.on('currentFileChanged', (file) => { getTests(self, (error, tests) => { if (error) return tooltip(error) self.data.allTests = tests