@@ -5,10 +5,9 @@ import {
5
5
postConstruct ,
6
6
} from '@theia/core/shared/inversify' ;
7
7
import * as React from '@theia/core/shared/react' ;
8
- import { SketchesService , Sketch } from '../common/protocol' ;
8
+ import { SketchesService } from '../common/protocol' ;
9
9
10
10
import {
11
- DisposableCollection ,
12
11
MAIN_MENU_BAR ,
13
12
MenuContribution ,
14
13
MenuModelRegistry ,
@@ -17,14 +16,11 @@ import {
17
16
Dialog ,
18
17
FrontendApplication ,
19
18
FrontendApplicationContribution ,
20
- LocalStorageService ,
21
19
OnWillStopAction ,
22
- SaveableWidget ,
23
20
} from '@theia/core/lib/browser' ;
24
21
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution' ;
25
22
import { ColorRegistry } from '@theia/core/lib/browser/color-registry' ;
26
23
import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution' ;
27
- import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state' ;
28
24
import {
29
25
TabBarToolbarContribution ,
30
26
TabBarToolbarRegistry ,
@@ -35,11 +31,7 @@ import {
35
31
CommandRegistry ,
36
32
} from '@theia/core/lib/common/command' ;
37
33
import { MessageService } from '@theia/core/lib/common/message-service' ;
38
- import URI from '@theia/core/lib/common/uri' ;
39
34
import { EditorCommands , EditorMainMenu } from '@theia/editor/lib/browser' ;
40
- import { FileChangeType } from '@theia/filesystem/lib/browser' ;
41
- import { FileService } from '@theia/filesystem/lib/browser/file-service' ;
42
- import { FileSystemFrontendContribution } from '@theia/filesystem/lib/browser/filesystem-frontend-contribution' ;
43
35
import { MonacoMenus } from '@theia/monaco/lib/browser/monaco-menu' ;
44
36
import { FileNavigatorCommands } from '@theia/navigator/lib/browser/navigator-contribution' ;
45
37
import { TerminalMenus } from '@theia/terminal/lib/browser/terminal-frontend-contribution' ;
@@ -50,7 +42,6 @@ import {
50
42
import { ArduinoPreferences } from './arduino-preferences' ;
51
43
import { BoardsServiceProvider } from './boards/boards-service-provider' ;
52
44
import { BoardsToolBarItem } from './boards/boards-toolbar-item' ;
53
- import { OpenSketchFiles } from './contributions/open-sketch-files' ;
54
45
import { SaveAsSketch } from './contributions/save-as-sketch' ;
55
46
import { ArduinoMenus } from './menu/arduino-menus' ;
56
47
import { MonitorViewContribution } from './serial/monitor/monitor-view-contribution' ;
@@ -73,9 +64,6 @@ export class ArduinoFrontendContribution
73
64
@inject ( BoardsServiceProvider )
74
65
private readonly boardsServiceProvider : BoardsServiceProvider ;
75
66
76
- @inject ( FileService )
77
- private readonly fileService : FileService ;
78
-
79
67
@inject ( SketchesService )
80
68
private readonly sketchService : SketchesService ;
81
69
@@ -88,17 +76,6 @@ export class ArduinoFrontendContribution
88
76
@inject ( SketchesServiceClientImpl )
89
77
private readonly sketchServiceClient : SketchesServiceClientImpl ;
90
78
91
- @inject ( FrontendApplicationStateService )
92
- private readonly appStateService : FrontendApplicationStateService ;
93
-
94
- @inject ( LocalStorageService )
95
- private readonly localStorageService : LocalStorageService ;
96
-
97
- @inject ( FileSystemFrontendContribution )
98
- private readonly fileSystemFrontendContribution : FileSystemFrontendContribution ;
99
-
100
- protected toDisposeOnStop = new DisposableCollection ( ) ;
101
-
102
79
@postConstruct ( )
103
80
protected async init ( ) : Promise < void > {
104
81
if ( ! window . navigator . onLine ) {
@@ -110,39 +87,6 @@ export class ArduinoFrontendContribution
110
87
)
111
88
) ;
112
89
}
113
- this . appStateService . reachedState ( 'ready' ) . then ( async ( ) => {
114
- const sketch = await this . sketchServiceClient . currentSketch ( ) ;
115
- if (
116
- CurrentSketch . isValid ( sketch ) &&
117
- ! ( await this . sketchService . isTemp ( sketch ) )
118
- ) {
119
- this . toDisposeOnStop . push ( this . fileService . watch ( new URI ( sketch . uri ) ) ) ;
120
- this . toDisposeOnStop . push (
121
- this . fileService . onDidFilesChange ( async ( event ) => {
122
- for ( const { type, resource } of event . changes ) {
123
- if (
124
- type === FileChangeType . ADDED &&
125
- resource . parent . toString ( ) === sketch . uri
126
- ) {
127
- const reloadedSketch = await this . sketchService . loadSketch (
128
- sketch . uri
129
- ) ;
130
- if ( Sketch . isInSketch ( resource , reloadedSketch ) ) {
131
- this . commandRegistry . executeCommand (
132
- OpenSketchFiles . Commands . ENSURE_OPENED . id ,
133
- resource . toString ( ) ,
134
- true ,
135
- {
136
- mode : 'open' ,
137
- }
138
- ) ;
139
- }
140
- }
141
- }
142
- } )
143
- ) ;
144
- }
145
- } ) ;
146
90
}
147
91
148
92
async onStart ( app : FrontendApplication ) : Promise < void > {
@@ -171,23 +115,6 @@ export class ArduinoFrontendContribution
171
115
172
116
// Removes the _Settings_ (cog) icon from the left sidebar
173
117
app . shell . leftPanelHandler . removeBottomMenu ( 'settings-menu' ) ;
174
-
175
- this . fileSystemFrontendContribution . onDidChangeEditorFile (
176
- ( { type, editor } ) => {
177
- if ( type === FileChangeType . DELETED ) {
178
- const editorWidget = editor ;
179
- if ( SaveableWidget . is ( editorWidget ) ) {
180
- editorWidget . closeWithoutSaving ( ) ;
181
- } else {
182
- editorWidget . close ( ) ;
183
- }
184
- }
185
- }
186
- ) ;
187
- }
188
-
189
- onStop ( ) : void {
190
- this . toDisposeOnStop . dispose ( ) ;
191
118
}
192
119
193
120
registerToolbarItems ( registry : TabBarToolbarRegistry ) : void {
0 commit comments