|
|
@ -38,19 +38,28 @@ export class TabProxy extends Plugin { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
fileManager.events.on('fileRemoved', (name) => { |
|
|
|
fileManager.events.on('fileRemoved', (name) => { |
|
|
|
this.removeTab(name) |
|
|
|
const workspace = this.fileManager.getCurrentWorkspace() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workspace ? this.removeTab(workspace + '/' + name) : this.removeTab(this.fileManager.mode + '/' + name) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
fileManager.events.on('fileClosed', (name) => { |
|
|
|
fileManager.events.on('fileClosed', (name) => { |
|
|
|
this.removeTab(name) |
|
|
|
const workspace = this.fileManager.getCurrentWorkspace() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workspace ? this.removeTab(workspace + '/' + name) : this.removeTab(this.fileManager.mode + '/' + name) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
fileManager.events.on('currentFileChanged', (file) => { |
|
|
|
fileManager.events.on('currentFileChanged', (file) => { |
|
|
|
if (this._handlers[file]) { |
|
|
|
const workspace = this.fileManager.getCurrentWorkspace() |
|
|
|
this._view.filetabs.activateTab(file) |
|
|
|
|
|
|
|
|
|
|
|
if (workspace) { |
|
|
|
|
|
|
|
const workspacePath = workspace + '/' + file |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this._handlers[workspacePath]) { |
|
|
|
|
|
|
|
this._view.filetabs.activateTab(workspacePath) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
this.addTab(file, '', () => { |
|
|
|
this.addTab(workspacePath, '', () => { |
|
|
|
this.fileManager.open(file) |
|
|
|
this.fileManager.open(file) |
|
|
|
this.event.emit('openFile', file) |
|
|
|
this.event.emit('openFile', file) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -58,20 +67,52 @@ export class TabProxy extends Plugin { |
|
|
|
this.fileManager.closeFile(file) |
|
|
|
this.fileManager.closeFile(file) |
|
|
|
this.event.emit('closeFile', file) |
|
|
|
this.event.emit('closeFile', file) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const path = this.fileManager.mode + '/' + file |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this._handlers[path]) { |
|
|
|
|
|
|
|
this._view.filetabs.activateTab(path) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.addTab(path, '', () => { |
|
|
|
|
|
|
|
this.fileManager.open(file) |
|
|
|
|
|
|
|
this.event.emit('openFile', file) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
this.fileManager.closeFile(file) |
|
|
|
|
|
|
|
this.event.emit('closeFile', file) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
fileManager.events.on('fileRenamed', (oldName, newName, isFolder) => { |
|
|
|
fileManager.events.on('fileRenamed', (oldName, newName, isFolder) => { |
|
|
|
|
|
|
|
const workspace = this.fileManager.getCurrentWorkspace() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (workspace) { |
|
|
|
if (isFolder) { |
|
|
|
if (isFolder) { |
|
|
|
for (const tab of this.loadedTabs) { |
|
|
|
for (const tab of this.loadedTabs) { |
|
|
|
if (tab.name.indexOf(oldName + '/') === 0) { |
|
|
|
if (tab.name.indexOf(workspace + '/' + oldName + '/') === 0) { |
|
|
|
const newTabName = newName + tab.name.slice(oldName.length, tab.name.length) |
|
|
|
const newTabName = workspace + '/' + newName + tab.name.slice(workspace + '/' + oldName.length, tab.name.length) |
|
|
|
this.renameTab(tab.name, newTabName) |
|
|
|
this.renameTab(tab.name, newTabName) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
// should change the tab title too
|
|
|
|
// should change the tab title too
|
|
|
|
this.renameTab(oldName, newName) |
|
|
|
this.renameTab(workspace + '/' + oldName, workspace + '/' + newName) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (isFolder) { |
|
|
|
|
|
|
|
for (const tab of this.loadedTabs) { |
|
|
|
|
|
|
|
if (tab.name.indexOf(this.fileManager.mode + '/' + oldName + '/') === 0) { |
|
|
|
|
|
|
|
const newTabName = this.fileManager.mode + '/' + newName + tab.name.slice(this.fileManager.mode + '/' + oldName.length, tab.name.length) |
|
|
|
|
|
|
|
this.renameTab(tab.name, newTabName) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// should change the tab title too
|
|
|
|
|
|
|
|
this.renameTab(this.fileManager.mode + '/' + oldName, workspace + '/' + newName) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
appManager.event.on('activate', ({ name, location, displayName, icon }) => { |
|
|
|
appManager.event.on('activate', ({ name, location, displayName, icon }) => { |
|
|
|