@@ -8,12 +8,10 @@ import * as React from '@theia/core/shared/react';
88import {
99 BoardsService ,
1010 LibraryService ,
11- Sketch ,
1211 SketchesService ,
1312} from '../common/protocol' ;
1413
1514import {
16- DisposableCollection ,
1715 MAIN_MENU_BAR ,
1816 MenuContribution ,
1917 MenuModelRegistry ,
@@ -24,12 +22,10 @@ import {
2422 FrontendApplicationContribution ,
2523 LocalStorageService ,
2624 OnWillStopAction ,
27- SaveableWidget ,
2825} from '@theia/core/lib/browser' ;
2926import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution' ;
3027import { ColorRegistry } from '@theia/core/lib/browser/color-registry' ;
3128import { CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution' ;
32- import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state' ;
3329import {
3430 TabBarToolbarContribution ,
3531 TabBarToolbarRegistry ,
@@ -40,11 +36,7 @@ import {
4036 CommandRegistry ,
4137} from '@theia/core/lib/common/command' ;
4238import { MessageService } from '@theia/core/lib/common/message-service' ;
43- import URI from '@theia/core/lib/common/uri' ;
4439import { 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' ;
4840import { MonacoMenus } from '@theia/monaco/lib/browser/monaco-menu' ;
4941import { FileNavigatorCommands } from '@theia/navigator/lib/browser/navigator-contribution' ;
5042import { TerminalMenus } from '@theia/terminal/lib/browser/terminal-frontend-contribution' ;
@@ -55,7 +47,6 @@ import {
5547import { ArduinoPreferences } from './arduino-preferences' ;
5648import { BoardsServiceProvider } from './boards/boards-service-provider' ;
5749import { BoardsToolBarItem } from './boards/boards-toolbar-item' ;
58- import { OpenSketchFiles } from './contributions/open-sketch-files' ;
5950import { SaveAsSketch } from './contributions/save-as-sketch' ;
6051import { ArduinoMenus } from './menu/arduino-menus' ;
6152import { MonitorViewContribution } from './serial/monitor/monitor-view-contribution' ;
@@ -84,9 +75,6 @@ export class ArduinoFrontendContribution
8475 @inject ( BoardsServiceProvider )
8576 private readonly boardsServiceProvider : BoardsServiceProvider ;
8677
87- @inject ( FileService )
88- private readonly fileService : FileService ;
89-
9078 @inject ( SketchesService )
9179 private readonly sketchService : SketchesService ;
9280
@@ -99,17 +87,9 @@ export class ArduinoFrontendContribution
9987 @inject ( SketchesServiceClientImpl )
10088 private readonly sketchServiceClient : SketchesServiceClientImpl ;
10189
102- @inject ( FrontendApplicationStateService )
103- private readonly appStateService : FrontendApplicationStateService ;
104-
10590 @inject ( LocalStorageService )
10691 private readonly localStorageService : LocalStorageService ;
10792
108- @inject ( FileSystemFrontendContribution )
109- private readonly fileSystemFrontendContribution : FileSystemFrontendContribution ;
110-
111- protected toDisposeOnStop = new DisposableCollection ( ) ;
112-
11393 @postConstruct ( )
11494 protected async init ( ) : Promise < void > {
11595 const isFirstStartup = ! ( await this . localStorageService . getData (
@@ -142,39 +122,6 @@ export class ArduinoFrontendContribution
142122 )
143123 ) ;
144124 }
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- } ) ;
178125 }
179126
180127 async onStart ( app : FrontendApplication ) : Promise < void > {
@@ -203,23 +150,6 @@ export class ArduinoFrontendContribution
203150
204151 // Removes the _Settings_ (cog) icon from the left sidebar
205152 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 ( ) ;
223153 }
224154
225155 registerToolbarItems ( registry : TabBarToolbarRegistry ) : void {
0 commit comments