@@ -5,7 +5,10 @@ import {
5
5
postConstruct ,
6
6
} from '@theia/core/shared/inversify' ;
7
7
import { Emitter } from '@theia/core/lib/common/event' ;
8
- import { Disposable } from '@theia/core/lib/common/disposable' ;
8
+ import {
9
+ Disposable ,
10
+ DisposableCollection ,
11
+ } from '@theia/core/lib/common/disposable' ;
9
12
import {
10
13
ReactWidget ,
11
14
Message ,
@@ -57,19 +60,23 @@ export class MonitorWidget extends ReactWidget {
57
60
@inject ( FrontendApplicationStateService )
58
61
private readonly appStateService : FrontendApplicationStateService ;
59
62
63
+ private readonly toDisposeOnReset : DisposableCollection ;
64
+
60
65
constructor ( ) {
61
66
super ( ) ;
62
67
this . id = MonitorWidget . ID ;
63
68
this . title . label = MonitorWidget . LABEL ;
64
69
this . title . iconClass = 'monitor-tab-icon' ;
65
70
this . title . closable = true ;
66
71
this . scrollOptions = undefined ;
67
- this . toDispose . push ( this . clearOutputEmitter ) ;
72
+ this . toDisposeOnReset = new DisposableCollection ( ) ;
73
+ this . toDispose . pushAll ( [ this . clearOutputEmitter , this . toDisposeOnReset ] ) ;
68
74
}
69
75
70
76
@postConstruct ( )
71
77
protected init ( ) : void {
72
- this . toDispose . pushAll ( [
78
+ this . toDisposeOnReset . dispose ( ) ;
79
+ this . toDisposeOnReset . pushAll ( [
73
80
Disposable . create ( ( ) => this . monitorManagerProxy . disconnect ( ) ) ,
74
81
this . monitorModel . onChange ( ( ) => this . update ( ) ) ,
75
82
this . monitorManagerProxy . onMonitorSettingsDidChange ( ( event ) =>
@@ -79,6 +86,10 @@ export class MonitorWidget extends ReactWidget {
79
86
this . startMonitor ( ) ;
80
87
}
81
88
89
+ reset ( ) : void {
90
+ this . init ( ) ;
91
+ }
92
+
82
93
private updateSettings ( settings : MonitorSettings ) : void {
83
94
this . settings = {
84
95
...this . settings ,
0 commit comments