diff --git a/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-sub-widgets/trace-explorer-keyboard-shortcuts/charts-cheatsheet-component.tsx b/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-sub-widgets/trace-explorer-keyboard-shortcuts/charts-cheatsheet-component.tsx index 621952af8..b607fa836 100644 --- a/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-sub-widgets/trace-explorer-keyboard-shortcuts/charts-cheatsheet-component.tsx +++ b/theia-extensions/viewer-prototype/src/browser/trace-explorer/trace-explorer-sub-widgets/trace-explorer-keyboard-shortcuts/charts-cheatsheet-component.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { inject, injectable, postConstruct } from 'inversify'; -import { Dialog, DialogProps } from '@theia/core/lib/browser/dialogs'; +import { inject, injectable } from 'inversify'; +import { DialogProps } from '@theia/core/lib/browser/dialogs'; import { ReactDialog } from '@theia/core/lib/browser/dialogs/react-dialog'; import { Message } from '@theia/core/lib/browser/widgets/widget'; import { EssentialShortcutsTable } from './essential-shortcuts-table'; @@ -14,21 +14,13 @@ export class ChartShortcutsDialogProps extends DialogProps { } @injectable() -export class ChartShortcutsDialog extends ReactDialog { +export class ChartShortcutsDialog extends ReactDialog { constructor( @inject(ChartShortcutsDialogProps) protected readonly props: ChartShortcutsDialogProps ) { - super({ - title: 'Trace Viewer Keyboard and Mouse Shortcuts', - }); - this.appendAcceptButton(Dialog.OK); - } - - @postConstruct() - protected async init(): Promise { - this.title.label = 'Trace Viewer Keyboard and Mouse Shortcuts'; - this.update(); + super(props); + this.appendAcceptButton(); } protected render(): React.ReactNode { diff --git a/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-contribution.ts b/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-contribution.ts index 3dfef982b..eb96aa964 100644 --- a/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-contribution.ts +++ b/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-contribution.ts @@ -45,7 +45,6 @@ export class TraceViewerContribution extends WidgetOpenHandler { - this.chartShortcuts.open(); + execute: async () => { + await new ChartShortcutsDialog({title: 'Trace Viewer Keyboard and Mouse Shortcuts'}).open(); } }); } diff --git a/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-frontend-module.ts b/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-frontend-module.ts index 8bf67f296..1148a0e73 100644 --- a/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-frontend-module.ts +++ b/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-frontend-module.ts @@ -20,7 +20,6 @@ import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar import { TraceViewerToolbarContribution } from './trace-viewer-toolbar-contribution'; import { LazyTspClientFactory } from 'traceviewer-base/lib/lazy-tsp-client'; import { BackendFileService, backendFileServicePath } from '../../common/backend-file-service'; -import { ChartShortcutsDialog, ChartShortcutsDialogProps } from '../trace-explorer/trace-explorer-sub-widgets/trace-explorer-keyboard-shortcuts/charts-cheatsheet-component'; import { TraceServerConnectionStatusService } from '../trace-server-status'; import { bindTraceOverviewPreferences } from '../trace-overview-binding'; @@ -30,8 +29,6 @@ export default new ContainerModule(bind => { bind(TraceServerUrlProvider).toService(TraceServerUrlProviderImpl); bind(LazyTspClientFactory).toFunction(LazyTspClientFactory); bind(TspClientProvider).toSelf().inSingletonScope(); - bind(ChartShortcutsDialog).toSelf().inSingletonScope(); - bind(ChartShortcutsDialogProps).toConstantValue({ title: 'Trace Viewer Keyboard and Mouse Shortcuts' }); bind(TheiaMessageManager).toSelf().inSingletonScope(); bind(TraceViewerToolbarContribution).toSelf().inSingletonScope(); diff --git a/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-toolbar-contribution.tsx b/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-toolbar-contribution.tsx index b561348d0..7d1cc312a 100644 --- a/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-toolbar-contribution.tsx +++ b/theia-extensions/viewer-prototype/src/browser/trace-viewer/trace-viewer-toolbar-contribution.tsx @@ -18,7 +18,6 @@ export class TraceViewerToolbarContribution implements TabBarToolbarContribution @inject(TspClientProvider) protected readonly tspClientProvider!: TspClientProvider; @inject(MenuModelRegistry) protected readonly menus: MenuModelRegistry; @inject(CommandRegistry) protected readonly commands: CommandRegistry; - @inject(ChartShortcutsDialog) protected readonly chartShortcuts: ChartShortcutsDialog; private onMarkerCategoriesFetchedSignal = () => this.doHandleMarkerCategoriesFetchedSignal(); private onMarkerSetsFetchedSignal = () => this.doHandleMarkerSetsFetchedSignal(); @@ -141,8 +140,8 @@ export class TraceViewerToolbarContribution implements TabBarToolbarContribution } return false; }, - execute: () => { - this.chartShortcuts.open(); + execute: async () => { + await new ChartShortcutsDialog({title: 'Trace Viewer Keyboard and Mouse Shortcuts'}).open(); } }); }