@@ -9,29 +9,19 @@ import { BoardsService } from '../common/protocol/boards-service';
9
9
import { ArduinoCommands } from './arduino-commands' ;
10
10
import { CoreService } from '../common/protocol/core-service' ;
11
11
import { WorkspaceServiceExt } from './workspace-service-ext' ;
12
- import { ToolOutputServiceClient } from '../common/protocol/tool-output-service' ;
13
- import { QuickPickService } from '@theia/core/lib/common/quick-pick-service' ;
14
- import { BoardsListWidgetFrontendContribution } from './boards/boards-widget-frontend-contribution' ;
15
12
import { BoardsServiceClientImpl } from './boards/boards-service-client-impl' ;
16
13
import { WorkspaceRootUriAwareCommandHandler , WorkspaceCommands } from '@theia/workspace/lib/browser/workspace-commands' ;
17
14
import { SelectionService , MenuContribution , MenuModelRegistry , MAIN_MENU_BAR , MenuPath } from '@theia/core' ;
18
15
import { ArduinoToolbar } from './toolbar/arduino-toolbar' ;
19
16
import { EditorManager , EditorMainMenu } from '@theia/editor/lib/browser' ;
20
17
import {
21
- ContextMenuRenderer ,
22
- OpenerService ,
23
- Widget ,
24
- StatusBar ,
25
- StatusBarAlignment ,
26
- QuickOpenService ,
27
- ApplicationShell ,
28
- FrontendApplicationContribution ,
29
- FrontendApplication
18
+ ContextMenuRenderer , Widget , StatusBar , StatusBarAlignment , FrontendApplicationContribution ,
19
+ FrontendApplication , KeybindingContribution , KeybindingRegistry
30
20
} from '@theia/core/lib/browser' ;
31
21
import { OpenFileDialogProps , FileDialogService } from '@theia/filesystem/lib/browser/file-dialog' ;
32
22
import { FileSystem , FileStat } from '@theia/filesystem/lib/common' ;
33
23
import { Sketch , SketchesService } from '../common/protocol/sketches-service' ;
34
- import { WindowService } from '@theia/core/lib/browser/window/window -service' ;
24
+ import { ToolOutputServiceClient } from '../common/protocol/tool-output -service' ;
35
25
import { CommonCommands , CommonMenus } from '@theia/core/lib/browser/common-frontend-contribution' ;
36
26
import { FileSystemCommands } from '@theia/filesystem/lib/browser/filesystem-frontend-contribution' ;
37
27
import { FileDownloadCommands } from '@theia/filesystem/lib/browser/download/file-download-command-contribution' ;
@@ -41,17 +31,16 @@ import { MaybePromise } from '@theia/core/lib/common/types';
41
31
import { BoardsConfigDialog } from './boards/boards-config-dialog' ;
42
32
import { BoardsToolBarItem } from './boards/boards-toolbar-item' ;
43
33
import { BoardsConfig } from './boards/boards-config' ;
44
- import { ConfigService } from '../common/protocol/config-service' ;
45
34
import { MonitorConnection } from './monitor/monitor-connection' ;
46
35
import { MonitorViewContribution } from './monitor/monitor-view-contribution' ;
47
36
import { ArduinoWorkspaceService } from './arduino-workspace-service' ;
48
37
import { FileNavigatorContribution } from '@theia/navigator/lib/browser/navigator-contribution' ;
38
+ import { OutputContribution } from '@theia/output/lib/browser/output-contribution' ;
49
39
import { OutlineViewContribution } from '@theia/outline-view/lib/browser/outline-view-contribution' ;
50
40
import { ProblemContribution } from '@theia/markers/lib/browser/problem/problem-contribution' ;
51
41
import { ScmContribution } from '@theia/scm/lib/browser/scm-contribution' ;
52
42
import { SearchInWorkspaceFrontendContribution } from '@theia/search-in-workspace/lib/browser/search-in-workspace-frontend-contribution' ;
53
43
import { FileNavigatorCommands } from '@theia/navigator/lib/browser/navigator-contribution' ;
54
- import { ArduinoShellLayoutRestorer } from './shell/arduino-shell-layout-restorer' ;
55
44
import { EditorMode } from './editor-mode' ;
56
45
57
46
export namespace ArduinoMenus {
@@ -67,7 +56,8 @@ export namespace ArduinoToolbarContextMenu {
67
56
}
68
57
69
58
@injectable ( )
70
- export class ArduinoFrontendContribution implements FrontendApplicationContribution , TabBarToolbarContribution , CommandContribution , MenuContribution {
59
+ export class ArduinoFrontendContribution implements FrontendApplicationContribution ,
60
+ TabBarToolbarContribution , CommandContribution , MenuContribution , KeybindingContribution {
71
61
72
62
@inject ( MessageService )
73
63
protected readonly messageService : MessageService ;
@@ -84,12 +74,6 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
84
74
@inject ( ToolOutputServiceClient )
85
75
protected readonly toolOutputServiceClient : ToolOutputServiceClient ;
86
76
87
- @inject ( QuickPickService )
88
- protected readonly quickPickService : QuickPickService ;
89
-
90
- @inject ( BoardsListWidgetFrontendContribution )
91
- protected readonly boardsListWidgetFrontendContribution : BoardsListWidgetFrontendContribution ;
92
-
93
77
@inject ( BoardsServiceClientImpl )
94
78
protected readonly boardsServiceClient : BoardsServiceClientImpl ;
95
79
@@ -108,12 +92,6 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
108
92
@inject ( FileSystem )
109
93
protected readonly fileSystem : FileSystem ;
110
94
111
- @inject ( OpenerService )
112
- protected readonly openerService : OpenerService ;
113
-
114
- @inject ( WindowService )
115
- protected readonly windowService : WindowService ;
116
-
117
95
@inject ( SketchesService )
118
96
protected readonly sketchService : SketchesService ;
119
97
@@ -129,27 +107,18 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
129
107
@inject ( StatusBar )
130
108
protected readonly statusBar : StatusBar ;
131
109
132
- @inject ( ArduinoShellLayoutRestorer )
133
- protected readonly layoutRestorer : ArduinoShellLayoutRestorer ;
134
-
135
- @inject ( QuickOpenService )
136
- protected readonly quickOpenService : QuickOpenService ;
137
-
138
110
@inject ( ArduinoWorkspaceService )
139
111
protected readonly workspaceService : ArduinoWorkspaceService ;
140
112
141
- @inject ( ConfigService )
142
- protected readonly configService : ConfigService ;
143
-
144
113
@inject ( MonitorConnection )
145
114
protected readonly monitorConnection : MonitorConnection ;
146
115
147
- @inject ( ApplicationShell )
148
- protected readonly shell : ApplicationShell ;
149
-
150
116
@inject ( FileNavigatorContribution )
151
117
protected readonly fileNavigatorContributions : FileNavigatorContribution ;
152
118
119
+ @inject ( OutputContribution )
120
+ protected readonly outputContribution : OutputContribution ;
121
+
153
122
@inject ( OutlineViewContribution )
154
123
protected readonly outlineContribution : OutlineViewContribution ;
155
124
@@ -195,6 +164,7 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
195
164
// Initialize all `pro-mode` widgets. This is a NOOP if in normal mode.
196
165
for ( const viewContribution of [
197
166
this . fileNavigatorContributions ,
167
+ this . outputContribution ,
198
168
this . outlineContribution ,
199
169
this . problemContribution ,
200
170
this . scmContribution ,
@@ -255,6 +225,7 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
255
225
registerCommands ( registry : CommandRegistry ) : void {
256
226
// TODO: use proper API https://github.com/eclipse-theia/theia/pull/6599
257
227
const allHandlers : { [ id : string ] : CommandHandler [ ] } = ( registry as any ) . _handlers ;
228
+
258
229
// Make sure to reveal the `Explorer` before executing `New File` and `New Folder`.
259
230
for ( const command of [ WorkspaceCommands . NEW_FILE , WorkspaceCommands . NEW_FOLDER ] ) {
260
231
const { id } = command ;
@@ -311,12 +282,15 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
311
282
if ( ! boardsConfig . selectedBoard . fqbn ) {
312
283
throw new Error ( `No core is installed for ${ boardsConfig . selectedBoard . name } . Please install the board.` ) ;
313
284
}
285
+ // Reveal the Output view asynchronously (don't await it)
286
+ this . outputContribution . openView ( { reveal : true } ) ;
314
287
await this . coreService . compile ( { uri : uri . toString ( ) , board : boardsConfig . selectedBoard } ) ;
315
288
} catch ( e ) {
316
289
await this . messageService . error ( e . toString ( ) ) ;
317
290
}
318
291
}
319
292
} ) ;
293
+
320
294
registry . registerCommand ( ArduinoCommands . UPLOAD , {
321
295
isVisible : widget => ArduinoToolbar . is ( widget ) && widget . side === 'left' ,
322
296
isEnabled : widget => true ,
@@ -345,6 +319,8 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
345
319
if ( ! selectedPort ) {
346
320
throw new Error ( 'No ports selected. Please select a port.' ) ;
347
321
}
322
+ // Reveal the Output view asynchronously (don't await it)
323
+ this . outputContribution . openView ( { reveal : true } ) ;
348
324
await this . coreService . upload ( { uri : uri . toString ( ) , board : boardsConfig . selectedBoard , port : selectedPort . address } ) ;
349
325
} catch ( e ) {
350
326
await this . messageService . error ( e . toString ( ) ) ;
@@ -355,6 +331,7 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
355
331
}
356
332
}
357
333
} ) ;
334
+
358
335
registry . registerCommand ( ArduinoCommands . SHOW_OPEN_CONTEXT_MENU , {
359
336
isVisible : widget => ArduinoToolbar . is ( widget ) && widget . side === 'left' ,
360
337
isEnabled : widget => ArduinoToolbar . is ( widget ) && widget . side === 'left' ,
@@ -372,23 +349,27 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
372
349
}
373
350
}
374
351
} ) ;
352
+
375
353
registry . registerCommand ( ArduinoCommands . OPEN_FILE_NAVIGATOR , {
376
354
isEnabled : ( ) => true ,
377
355
execute : ( ) => this . doOpenFile ( )
378
- } )
356
+ } ) ;
357
+
379
358
registry . registerCommand ( ArduinoCommands . OPEN_SKETCH , {
380
359
isEnabled : ( ) => true ,
381
360
execute : async ( sketch : Sketch ) => {
382
361
this . workspaceService . open ( new URI ( sketch . uri ) ) ;
383
362
}
384
- } )
363
+ } ) ;
364
+
385
365
registry . registerCommand ( ArduinoCommands . SAVE_SKETCH , {
386
366
isEnabled : widget => ArduinoToolbar . is ( widget ) && widget . side === 'left' ,
387
367
isVisible : widget => ArduinoToolbar . is ( widget ) && widget . side === 'left' ,
388
368
execute : async ( sketch : Sketch ) => {
389
369
registry . executeCommand ( CommonCommands . SAVE_ALL . id ) ;
390
370
}
391
- } )
371
+ } ) ;
372
+
392
373
registry . registerCommand ( ArduinoCommands . NEW_SKETCH , new WorkspaceRootUriAwareCommandHandler ( this . workspaceService , this . selectionService , {
393
374
execute : async uri => {
394
375
try {
@@ -404,6 +385,7 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
404
385
}
405
386
}
406
387
} ) ) ;
388
+
407
389
registry . registerCommand ( ArduinoCommands . OPEN_BOARDS_DIALOG , {
408
390
isEnabled : ( ) => true ,
409
391
execute : async ( ) => {
@@ -412,12 +394,13 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
412
394
this . boardsServiceClient . boardsConfig = boardsConfig ;
413
395
}
414
396
}
415
- } )
397
+ } ) ;
398
+
416
399
registry . registerCommand ( ArduinoCommands . TOGGLE_ADVANCED_MODE , {
417
400
execute : ( ) => this . editorMode . toggle ( ) ,
418
401
isVisible : widget => ArduinoToolbar . is ( widget ) && widget . side === 'right' ,
419
402
isToggled : ( ) => this . editorMode . proMode
420
- } )
403
+ } ) ;
421
404
}
422
405
423
406
registerMenus ( registry : MenuModelRegistry ) {
@@ -485,6 +468,17 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
485
468
return menuId ;
486
469
}
487
470
471
+ registerKeybindings ( keybindings : KeybindingRegistry ) : void {
472
+ keybindings . registerKeybinding ( {
473
+ command : ArduinoCommands . VERIFY . id ,
474
+ keybinding : 'ctrlcmd+alt+v'
475
+ } ) ;
476
+ keybindings . registerKeybinding ( {
477
+ command : ArduinoCommands . UPLOAD . id ,
478
+ keybinding : 'ctrlcmd+alt+u'
479
+ } ) ;
480
+ }
481
+
488
482
protected async registerSketchesInMenu ( registry : MenuModelRegistry ) : Promise < void > {
489
483
this . sketchService . getSketches ( ) . then ( sketches => {
490
484
this . wsSketchCount = sketches . length ;
0 commit comments