|
| 1 | +import { injectable, inject } from 'inversify'; |
| 2 | +import { CommandService } from '@theia/core/lib/common/command'; |
| 3 | +import { OutputCommands } from '@theia/output/lib/browser/output-commands'; |
| 4 | +import { PluginInfo } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; |
| 5 | +import { OutputChannelRegistryMainImpl as TheiaOutputChannelRegistryMainImpl } from '@theia/plugin-ext/lib/main/browser/output-channel-registry-main'; |
| 6 | + |
| 7 | +@injectable() |
| 8 | +export class OutputChannelRegistryMainImpl extends TheiaOutputChannelRegistryMainImpl { |
| 9 | + |
| 10 | + @inject(CommandService) |
| 11 | + protected readonly commandService: CommandService; |
| 12 | + |
| 13 | + $append(name: string, text: string, pluginInfo: PluginInfo): PromiseLike<void> { |
| 14 | + this.commandService.executeCommand(OutputCommands.APPEND.id, { name, text }); |
| 15 | + return Promise.resolve(); |
| 16 | + } |
| 17 | + |
| 18 | + $clear(name: string): PromiseLike<void> { |
| 19 | + this.commandService.executeCommand(OutputCommands.CLEAR.id, { name }); |
| 20 | + return Promise.resolve(); |
| 21 | + } |
| 22 | + |
| 23 | + $dispose(name: string): PromiseLike<void> { |
| 24 | + this.commandService.executeCommand(OutputCommands.DISPOSE.id, { name }); |
| 25 | + return Promise.resolve(); |
| 26 | + } |
| 27 | + |
| 28 | + async $reveal(name: string, preserveFocus: boolean): Promise<void> { |
| 29 | + const options = { preserveFocus }; |
| 30 | + this.commandService.executeCommand(OutputCommands.SHOW.id, { name, options }); |
| 31 | + } |
| 32 | + |
| 33 | + $close(name: string): PromiseLike<void> { |
| 34 | + this.commandService.executeCommand(OutputCommands.HIDE.id, { name }); |
| 35 | + return Promise.resolve(); |
| 36 | + } |
| 37 | + |
| 38 | +} |
0 commit comments