@@ -5,6 +5,7 @@ import { CXXRTLConnection, CXXRTLDebugItem, CXXRTLDebugItemType, CXXRTLNodeDesig
55import { TimePoint } from './model/time' ;
66import { Scope } from './model/scope' ;
77import { Variable } from './model/variable' ;
8+ import { StatusItemController } from './ui/status' ;
89
910export enum CXXRTLSessionStatus {
1011 Absent = "absent" ,
@@ -13,7 +14,7 @@ export enum CXXRTLSessionStatus {
1314}
1415
1516export class CXXRTLDebugger {
16- private statusItem : vscode . StatusBarItem ;
17+ private statusItemController : StatusItemController ;
1718 private terminal : vscode . Terminal | null = null ;
1819 private connection : CXXRTLConnection | null = null ;
1920
@@ -44,37 +45,7 @@ export class CXXRTLDebugger {
4445 readonly onDidChangeLatestTime : vscode . Event < TimePoint > = this . _onDidChangeLatestTime . event ;
4546
4647 constructor ( ) {
47- this . statusItem = vscode . window . createStatusBarItem ( 'rtlDebugger' , vscode . StatusBarAlignment . Left , 10 ) ;
48- this . statusItem . tooltip = 'RTL Debugger Status' ;
49- this . statusItem . command = 'rtlDebugger.runPauseSimulation' ;
50- this . onDidChangeSessionStatus ( ( _state ) => this . updateStatusItem ( ) ) ;
51- this . onDidChangeCurrentTime ( ( _time ) => this . updateStatusItem ( ) ) ;
52- this . onDidChangeSimulationStatus ( ( _state ) => this . updateStatusItem ( ) ) ;
53- this . onDidChangeLatestTime ( ( _time ) => this . updateStatusItem ( ) ) ;
54- }
55-
56- private updateStatusItem ( ) {
57- if ( this . sessionStatus === CXXRTLSessionStatus . Absent ) {
58- this . statusItem . hide ( ) ;
59- } else {
60- this . statusItem . show ( ) ;
61- if ( this . sessionStatus === CXXRTLSessionStatus . Starting ) {
62- this . statusItem . text = `$(gear~spin) Starting...` ;
63- this . statusItem . tooltip = `RTL Debugger: Starting` ;
64- } else { // this.sessionState === CXXRTLSessionState.Running
65- if ( this . simulationStatus === CXXRTLSimulationStatus . Running ) {
66- this . statusItem . text = '$(debug-pause) ' ;
67- this . statusItem . tooltip = `RTL Debugger: Running` ;
68- } else if ( this . simulationStatus === CXXRTLSimulationStatus . Paused ) {
69- this . statusItem . text = '$(debug-continue) ' ;
70- this . statusItem . tooltip = `RTL Debugger: Paused` ;
71- } else if ( this . simulationStatus === CXXRTLSimulationStatus . Finished ) {
72- this . statusItem . text = '' ;
73- this . statusItem . tooltip = `RTL Debugger: Finished` ;
74- }
75- this . statusItem . text += `${ this . currentTime } / ${ this . latestTime } ` ;
76- }
77- }
48+ this . statusItemController = new StatusItemController ( this ) ;
7849 }
7950
8051 public dispose ( ) {
0 commit comments