@@ -8,12 +8,10 @@ import * as React from '@theia/core/shared/react';
8
8
import {
9
9
BoardsService ,
10
10
LibraryService ,
11
- Sketch ,
12
11
SketchesService ,
13
12
} from '../common/protocol' ;
14
13
15
14
import {
16
- DisposableCollection ,
17
15
MAIN_MENU_BAR ,
18
16
MenuContribution ,
19
17
MenuModelRegistry ,
@@ -24,12 +22,10 @@ import {
24
22
FrontendApplicationContribution ,
25
23
LocalStorageService ,
26
24
OnWillStopAction ,
27
- SaveableWidget ,
28
25
} from '@theia/core/lib/browser' ;
29
26
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution' ;
30
27
import { ColorRegistry } from '@theia/core/lib/browser/color-registry' ;
31
28
import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution' ;
32
- import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state' ;
33
29
import {
34
30
TabBarToolbarContribution ,
35
31
TabBarToolbarRegistry ,
@@ -40,11 +36,7 @@ import {
40
36
CommandRegistry ,
41
37
} from '@theia/core/lib/common/command' ;
42
38
import { MessageService } from '@theia/core/lib/common/message-service' ;
43
- import URI from '@theia/core/lib/common/uri' ;
44
39
import { EditorCommands , EditorMainMenu } from '@theia/editor/lib/browser' ;
45
- import { FileChangeType } from '@theia/filesystem/lib/browser' ;
46
- import { FileService } from '@theia/filesystem/lib/browser/file-service' ;
47
- import { FileSystemFrontendContribution } from '@theia/filesystem/lib/browser/filesystem-frontend-contribution' ;
48
40
import { MonacoMenus } from '@theia/monaco/lib/browser/monaco-menu' ;
49
41
import { FileNavigatorCommands } from '@theia/navigator/lib/browser/navigator-contribution' ;
50
42
import { TerminalMenus } from '@theia/terminal/lib/browser/terminal-frontend-contribution' ;
@@ -55,7 +47,6 @@ import {
55
47
import { ArduinoPreferences } from './arduino-preferences' ;
56
48
import { BoardsServiceProvider } from './boards/boards-service-provider' ;
57
49
import { BoardsToolBarItem } from './boards/boards-toolbar-item' ;
58
- import { OpenSketchFiles } from './contributions/open-sketch-files' ;
59
50
import { SaveAsSketch } from './contributions/save-as-sketch' ;
60
51
import { ArduinoMenus } from './menu/arduino-menus' ;
61
52
import { MonitorViewContribution } from './serial/monitor/monitor-view-contribution' ;
@@ -84,9 +75,6 @@ export class ArduinoFrontendContribution
84
75
@inject ( BoardsServiceProvider )
85
76
private readonly boardsServiceProvider : BoardsServiceProvider ;
86
77
87
- @inject ( FileService )
88
- private readonly fileService : FileService ;
89
-
90
78
@inject ( SketchesService )
91
79
private readonly sketchService : SketchesService ;
92
80
@@ -99,17 +87,9 @@ export class ArduinoFrontendContribution
99
87
@inject ( SketchesServiceClientImpl )
100
88
private readonly sketchServiceClient : SketchesServiceClientImpl ;
101
89
102
- @inject ( FrontendApplicationStateService )
103
- private readonly appStateService : FrontendApplicationStateService ;
104
-
105
90
@inject ( LocalStorageService )
106
91
private readonly localStorageService : LocalStorageService ;
107
92
108
- @inject ( FileSystemFrontendContribution )
109
- private readonly fileSystemFrontendContribution : FileSystemFrontendContribution ;
110
-
111
- protected toDisposeOnStop = new DisposableCollection ( ) ;
112
-
113
93
@postConstruct ( )
114
94
protected async init ( ) : Promise < void > {
115
95
const isFirstStartup = ! ( await this . localStorageService . getData (
@@ -142,39 +122,6 @@ export class ArduinoFrontendContribution
142
122
)
143
123
) ;
144
124
}
145
- this . appStateService . reachedState ( 'ready' ) . then ( async ( ) => {
146
- const sketch = await this . sketchServiceClient . currentSketch ( ) ;
147
- if (
148
- CurrentSketch . isValid ( sketch ) &&
149
- ! ( await this . sketchService . isTemp ( sketch ) )
150
- ) {
151
- this . toDisposeOnStop . push ( this . fileService . watch ( new URI ( sketch . uri ) ) ) ;
152
- this . toDisposeOnStop . push (
153
- this . fileService . onDidFilesChange ( async ( event ) => {
154
- for ( const { type, resource } of event . changes ) {
155
- if (
156
- type === FileChangeType . ADDED &&
157
- resource . parent . toString ( ) === sketch . uri
158
- ) {
159
- const reloadedSketch = await this . sketchService . loadSketch (
160
- sketch . uri
161
- ) ;
162
- if ( Sketch . isInSketch ( resource , reloadedSketch ) ) {
163
- this . commandRegistry . executeCommand (
164
- OpenSketchFiles . Commands . ENSURE_OPENED . id ,
165
- resource . toString ( ) ,
166
- true ,
167
- {
168
- mode : 'open' ,
169
- }
170
- ) ;
171
- }
172
- }
173
- }
174
- } )
175
- ) ;
176
- }
177
- } ) ;
178
125
}
179
126
180
127
async onStart ( app : FrontendApplication ) : Promise < void > {
@@ -203,23 +150,6 @@ export class ArduinoFrontendContribution
203
150
204
151
// Removes the _Settings_ (cog) icon from the left sidebar
205
152
app . shell . leftPanelHandler . removeBottomMenu ( 'settings-menu' ) ;
206
-
207
- this . fileSystemFrontendContribution . onDidChangeEditorFile (
208
- ( { type, editor } ) => {
209
- if ( type === FileChangeType . DELETED ) {
210
- const editorWidget = editor ;
211
- if ( SaveableWidget . is ( editorWidget ) ) {
212
- editorWidget . closeWithoutSaving ( ) ;
213
- } else {
214
- editorWidget . close ( ) ;
215
- }
216
- }
217
- }
218
- ) ;
219
- }
220
-
221
- onStop ( ) : void {
222
- this . toDisposeOnStop . dispose ( ) ;
223
153
}
224
154
225
155
registerToolbarItems ( registry : TabBarToolbarRegistry ) : void {
0 commit comments