|
|
@ -1,7 +1,6 @@ |
|
|
|
'use strict' |
|
|
|
'use strict' |
|
|
|
|
|
|
|
|
|
|
|
const EventEmitter = require('events') |
|
|
|
const EventEmitter = require('events') |
|
|
|
var EventManager = require('../../lib/events') |
|
|
|
|
|
|
|
var globalRegistry = require('../../global/registry') |
|
|
|
var globalRegistry = require('../../global/registry') |
|
|
|
var CompilerImport = require('../compiler/compiler-imports') |
|
|
|
var CompilerImport = require('../compiler/compiler-imports') |
|
|
|
|
|
|
|
|
|
|
@ -13,7 +12,6 @@ var CompilerImport = require('../compiler/compiler-imports') |
|
|
|
class FileManager { |
|
|
|
class FileManager { |
|
|
|
constructor (localRegistry) { |
|
|
|
constructor (localRegistry) { |
|
|
|
this.openedFiles = {} // list all opened files
|
|
|
|
this.openedFiles = {} // list all opened files
|
|
|
|
this.event = new EventManager() |
|
|
|
|
|
|
|
this.events = new EventEmitter() |
|
|
|
this.events = new EventEmitter() |
|
|
|
this._components = {} |
|
|
|
this._components = {} |
|
|
|
this._components.compilerImport = new CompilerImport() |
|
|
|
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('errored', (event) => { this.removeTabsOf(self._deps.localhostExplorer) }) |
|
|
|
self._deps.localhostExplorer.event.register('closed', (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 () { |
|
|
|
profile () { |
|
|
@ -84,7 +79,7 @@ class FileManager { |
|
|
|
this.switchFile(newFocus) |
|
|
|
this.switchFile(newFocus) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.event.trigger('fileRenamed', [oldName, newName]) |
|
|
|
this.events.emit('fileRenamed', oldName, newName) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentFileProvider () { |
|
|
|
currentFileProvider () { |
|
|
@ -107,7 +102,7 @@ class FileManager { |
|
|
|
this._deps.editor.displayEmptyReadOnlySession() |
|
|
|
this._deps.editor.displayEmptyReadOnlySession() |
|
|
|
this._deps.config.set('currentFile', '') |
|
|
|
this._deps.config.set('currentFile', '') |
|
|
|
} |
|
|
|
} |
|
|
|
this.event.trigger('fileClosed', [name]) |
|
|
|
this.events.emit('fileClosed', name) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentPath () { |
|
|
|
currentPath () { |
|
|
@ -167,7 +162,7 @@ class FileManager { |
|
|
|
} |
|
|
|
} |
|
|
|
self._deps.editor.discard(path) |
|
|
|
self._deps.editor.discard(path) |
|
|
|
delete this.openedFiles[path] |
|
|
|
delete this.openedFiles[path] |
|
|
|
this.event.trigger('fileRemoved', [path]) |
|
|
|
this.events.emit('fileRemoved', path) |
|
|
|
this.switchFile() |
|
|
|
this.switchFile() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -182,7 +177,7 @@ class FileManager { |
|
|
|
if (fileList.length) { |
|
|
|
if (fileList.length) { |
|
|
|
_switchFile(browserProvider.type + '/' + fileList[0]) |
|
|
|
_switchFile(browserProvider.type + '/' + fileList[0]) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
self.event.trigger('currentFileChanged', []) |
|
|
|
self.events.emit('currentFileChanged') |
|
|
|
self._deps.editor.displayEmptyReadOnlySession() |
|
|
|
self._deps.editor.displayEmptyReadOnlySession() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -200,7 +195,7 @@ class FileManager { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
self._deps.editor.open(file, content) |
|
|
|
self._deps.editor.open(file, content) |
|
|
|
} |
|
|
|
} |
|
|
|
self.event.trigger('currentFileChanged', [file, self.fileProviderOf(file)]) |
|
|
|
self.events.emit('currentFileChanged', file) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|