@@ -20,32 +20,24 @@ export class ApplicationShell extends TheiaApplicationShell {
20
20
@inject ( SketchesServiceClientImpl )
21
21
protected readonly sketchesServiceClient : SketchesServiceClientImpl ;
22
22
23
- protected sketch ?: Sketch ;
24
-
25
- async addWidget ( widget : Widget , options : Readonly < TheiaApplicationShell . WidgetOptions > = { } ) : Promise < void > {
26
- // Get the current sketch before adding a widget. This wil trigger an update.
27
- this . sketch = await this . sketchesServiceClient . currentSketch ( ) ;
28
- super . addWidget ( widget , options ) ;
29
- }
30
-
31
- async setLayoutData ( layoutData : TheiaApplicationShell . LayoutData ) : Promise < void > {
32
- // I could not find other ways to get sketch in async fashion for sync `track`.
33
- this . sketch = await this . sketchesServiceClient . currentSketch ( ) ;
34
- super . setLayoutData ( layoutData ) ;
35
- }
36
-
37
23
protected track ( widget : Widget ) : void {
38
- if ( ! this . editorMode . proMode && this . sketch && widget instanceof EditorWidget ) {
39
- if ( Sketch . isInSketch ( widget . editor . uri , this . sketch ) ) {
40
- widget . title . closable = false ;
41
- }
42
- }
43
24
super . track ( widget ) ;
25
+ if ( ! this . editorMode . proMode && widget instanceof EditorWidget ) {
26
+ // Make the editor un-closeable asynchronously.
27
+ this . sketchesServiceClient . currentSketch ( ) . then ( sketch => {
28
+ if ( sketch ) {
29
+ if ( Sketch . isInSketch ( widget . editor . uri , sketch ) ) {
30
+ widget . title . closable = false ;
31
+ }
32
+ }
33
+ } ) ;
34
+ }
44
35
}
45
36
46
37
async saveAll ( ) : Promise < void > {
47
38
await super . saveAll ( ) ;
48
- await this . commandService . executeCommand ( SaveAsSketch . Commands . SAVE_AS_SKETCH . id , { execOnlyIfTemp : true , openAfterMove : true } ) ;
39
+ const options = { execOnlyIfTemp : true , openAfterMove : true } ;
40
+ await this . commandService . executeCommand ( SaveAsSketch . Commands . SAVE_AS_SKETCH . id , options ) ;
49
41
}
50
42
51
43
}
0 commit comments