mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-30 14:46:34 +00:00
Updated MonitorWidget to use new monitor proxy
This commit is contained in:
parent
7889f40834
commit
ce2f1c227a
@ -152,7 +152,7 @@ import {
|
|||||||
OutputChannelRegistryMainImpl as TheiaOutputChannelRegistryMainImpl,
|
OutputChannelRegistryMainImpl as TheiaOutputChannelRegistryMainImpl,
|
||||||
OutputChannelRegistryMainImpl,
|
OutputChannelRegistryMainImpl,
|
||||||
} from './theia/plugin-ext/output-channel-registry-main';
|
} from './theia/plugin-ext/output-channel-registry-main';
|
||||||
import { ExecutableService, ExecutableServicePath } from '../common/protocol';
|
import { ExecutableService, ExecutableServicePath, MonitorManagerProxy, MonitorManagerProxyClient, MonitorManagerProxyPath } from '../common/protocol';
|
||||||
import { MonacoTextModelService as TheiaMonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service';
|
import { MonacoTextModelService as TheiaMonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service';
|
||||||
import { MonacoTextModelService } from './theia/monaco/monaco-text-model-service';
|
import { MonacoTextModelService } from './theia/monaco/monaco-text-model-service';
|
||||||
import { ResponseServiceImpl } from './response-service-impl';
|
import { ResponseServiceImpl } from './response-service-impl';
|
||||||
@ -267,7 +267,7 @@ import {
|
|||||||
IDEUpdaterDialogWidget,
|
IDEUpdaterDialogWidget,
|
||||||
} from './dialogs/ide-updater/ide-updater-dialog';
|
} from './dialogs/ide-updater/ide-updater-dialog';
|
||||||
import { ElectronIpcConnectionProvider } from '@theia/core/lib/electron-browser/messaging/electron-ipc-connection-provider';
|
import { ElectronIpcConnectionProvider } from '@theia/core/lib/electron-browser/messaging/electron-ipc-connection-provider';
|
||||||
import { MonitorManagerProxyClient } from '../common/monitor-manager-proxy';
|
import { MonitorModel } from './monitor-model';
|
||||||
import { MonitorManagerProxyClientImpl } from './monitor-manager-proxy-client-impl';
|
import { MonitorManagerProxyClientImpl } from './monitor-manager-proxy-client-impl';
|
||||||
|
|
||||||
const ElementQueries = require('css-element-queries/src/ElementQueries');
|
const ElementQueries = require('css-element-queries/src/ElementQueries');
|
||||||
@ -402,13 +402,23 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|||||||
|
|
||||||
// Serial monitor
|
// Serial monitor
|
||||||
bind(MonitorWidget).toSelf();
|
bind(MonitorWidget).toSelf();
|
||||||
|
bind(MonitorModel).toSelf().inSingletonScope();
|
||||||
bindViewContribution(bind, MonitorViewContribution);
|
bindViewContribution(bind, MonitorViewContribution);
|
||||||
bind(TabBarToolbarContribution).toService(MonitorViewContribution);
|
bind(TabBarToolbarContribution).toService(MonitorViewContribution);
|
||||||
bind(WidgetFactory).toDynamicValue((context) => ({
|
bind(WidgetFactory).toDynamicValue((context) => ({
|
||||||
id: MonitorWidget.ID,
|
id: MonitorWidget.ID,
|
||||||
createWidget: () => context.container.get(MonitorWidget),
|
createWidget: () => {
|
||||||
|
return new MonitorWidget(
|
||||||
|
context.container.get<MonitorModel>(MonitorModel),
|
||||||
|
context.container.get<MonitorManagerProxyClient>(MonitorManagerProxyClient),
|
||||||
|
context.container.get<BoardsServiceProvider>(BoardsServiceProvider),
|
||||||
|
);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
bind(MonitorManagerProxy).toDynamicValue((context) =>
|
||||||
|
WebSocketConnectionProvider.createProxy(context.container, MonitorManagerProxyPath)
|
||||||
|
).inSingletonScope();
|
||||||
|
|
||||||
// Monitor manager proxy client to receive and delegate pluggable monitors
|
// Monitor manager proxy client to receive and delegate pluggable monitors
|
||||||
// notifications from the backend
|
// notifications from the backend
|
||||||
|
@ -28,15 +28,6 @@ export class MonitorWidget extends ReactWidget {
|
|||||||
);
|
);
|
||||||
static readonly ID = 'serial-monitor';
|
static readonly ID = 'serial-monitor';
|
||||||
|
|
||||||
@inject(MonitorModel)
|
|
||||||
protected readonly monitorModel: MonitorModel;
|
|
||||||
|
|
||||||
@inject(MonitorManagerProxyClient)
|
|
||||||
protected readonly monitorManagerProxy: MonitorManagerProxyClient;
|
|
||||||
|
|
||||||
@inject(BoardsServiceProvider)
|
|
||||||
protected readonly boardsServiceProvider: BoardsServiceProvider;
|
|
||||||
|
|
||||||
protected widgetHeight: number;
|
protected widgetHeight: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,7 +41,16 @@ export class MonitorWidget extends ReactWidget {
|
|||||||
protected closing = false;
|
protected closing = false;
|
||||||
protected readonly clearOutputEmitter = new Emitter<void>();
|
protected readonly clearOutputEmitter = new Emitter<void>();
|
||||||
|
|
||||||
constructor() {
|
constructor(
|
||||||
|
@inject(MonitorModel)
|
||||||
|
protected readonly monitorModel: MonitorModel,
|
||||||
|
|
||||||
|
@inject(MonitorManagerProxyClient)
|
||||||
|
protected readonly monitorManagerProxy: MonitorManagerProxyClient,
|
||||||
|
|
||||||
|
@inject(BoardsServiceProvider)
|
||||||
|
protected readonly boardsServiceProvider: BoardsServiceProvider
|
||||||
|
) {
|
||||||
super();
|
super();
|
||||||
this.id = MonitorWidget.ID;
|
this.id = MonitorWidget.ID;
|
||||||
this.title.label = MonitorWidget.LABEL;
|
this.title.label = MonitorWidget.LABEL;
|
||||||
@ -62,6 +62,13 @@ export class MonitorWidget extends ReactWidget {
|
|||||||
Disposable.create(() => this.monitorManagerProxy.disconnect())
|
Disposable.create(() => this.monitorManagerProxy.disconnect())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Start monitor right away if there is already a board/port combination selected
|
||||||
|
const { selectedBoard, selectedPort } =
|
||||||
|
this.boardsServiceProvider.boardsConfig;
|
||||||
|
if (selectedBoard && selectedBoard.fqbn && selectedPort) {
|
||||||
|
this.monitorManagerProxy.startMonitor(selectedBoard, selectedPort);
|
||||||
|
}
|
||||||
|
|
||||||
this.toDispose.push(
|
this.toDispose.push(
|
||||||
this.boardsServiceProvider.onBoardsConfigChanged(
|
this.boardsServiceProvider.onBoardsConfigChanged(
|
||||||
async ({ selectedBoard, selectedPort }) => {
|
async ({ selectedBoard, selectedPort }) => {
|
||||||
@ -70,6 +77,7 @@ export class MonitorWidget extends ReactWidget {
|
|||||||
selectedBoard,
|
selectedBoard,
|
||||||
selectedPort
|
selectedPort
|
||||||
);
|
);
|
||||||
|
this.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user