diff --git a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts index 94f8cbca..7cbb5930 100644 --- a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts +++ b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts @@ -124,6 +124,7 @@ import { LibraryServiceProvider } from './library/library-service-provider'; import { IncludeLibrary } from './contributions/include-library'; import { OutputChannelManager as TheiaOutputChannelManager } from '@theia/output/lib/common/output-channel'; import { OutputChannelManager } from './theia/output/output-channel'; +import { OutputChannelRegistryMainImpl as TheiaOutputChannelRegistryMainImpl, OutputChannelRegistryMainImpl } from './theia/plugin-ext/output-channel-registry-main'; const ElementQueries = require('css-element-queries/src/ElementQueries'); @@ -314,6 +315,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { rebind(TheiaOutputWidget).toService(OutputWidget); bind(OutputChannelManager).toSelf().inSingletonScope(); rebind(TheiaOutputChannelManager).toService(OutputChannelManager); + bind(OutputChannelRegistryMainImpl).toSelf().inTransientScope(); + rebind(TheiaOutputChannelRegistryMainImpl).toService(OutputChannelRegistryMainImpl); // Show a disconnected status bar, when the daemon is not available bind(ApplicationConnectionStatusContribution).toSelf().inSingletonScope(); diff --git a/arduino-ide-extension/src/browser/theia/plugin-ext/output-channel-registry-main.ts b/arduino-ide-extension/src/browser/theia/plugin-ext/output-channel-registry-main.ts new file mode 100644 index 00000000..b5a98b09 --- /dev/null +++ b/arduino-ide-extension/src/browser/theia/plugin-ext/output-channel-registry-main.ts @@ -0,0 +1,38 @@ +import { injectable, inject } from 'inversify'; +import { CommandService } from '@theia/core/lib/common/command'; +import { OutputCommands } from '@theia/output/lib/browser/output-commands'; +import { PluginInfo } from '@theia/plugin-ext/lib/common/plugin-api-rpc'; +import { OutputChannelRegistryMainImpl as TheiaOutputChannelRegistryMainImpl } from '@theia/plugin-ext/lib/main/browser/output-channel-registry-main'; + +@injectable() +export class OutputChannelRegistryMainImpl extends TheiaOutputChannelRegistryMainImpl { + + @inject(CommandService) + protected readonly commandService: CommandService; + + $append(name: string, text: string, pluginInfo: PluginInfo): PromiseLike { + this.commandService.executeCommand(OutputCommands.APPEND.id, { name, text }); + return Promise.resolve(); + } + + $clear(name: string): PromiseLike { + this.commandService.executeCommand(OutputCommands.CLEAR.id, { name }); + return Promise.resolve(); + } + + $dispose(name: string): PromiseLike { + this.commandService.executeCommand(OutputCommands.DISPOSE.id, { name }); + return Promise.resolve(); + } + + async $reveal(name: string, preserveFocus: boolean): Promise { + const options = { preserveFocus }; + this.commandService.executeCommand(OutputCommands.SHOW.id, { name, options }); + } + + $close(name: string): PromiseLike { + this.commandService.executeCommand(OutputCommands.HIDE.id, { name }); + return Promise.resolve(); + } + +}