1
+ import { nls } from '@theia/core/lib/common/nls' ;
1
2
import { inject , injectable } from '@theia/core/shared/inversify' ;
3
+ import { MainMenuManager } from '../../common/main-menu-manager' ;
4
+ import type { Settings } from '../dialogs/settings/settings' ;
5
+ import { SettingsDialog } from '../dialogs/settings/settings-dialog' ;
6
+ import { ArduinoMenus } from '../menu/arduino-menus' ;
2
7
import {
3
8
Command ,
4
- MenuModelRegistry ,
5
9
CommandRegistry ,
6
- SketchContribution ,
7
10
KeybindingRegistry ,
11
+ MenuModelRegistry ,
12
+ SketchContribution ,
8
13
} from './contribution' ;
9
- import { ArduinoMenus } from '../menu/arduino-menus' ;
10
- import { Settings as Preferences } from '../dialogs/settings/settings' ;
11
- import { SettingsDialog } from '../dialogs/settings/settings-dialog' ;
12
- import { nls } from '@theia/core/lib/common' ;
13
14
14
15
@injectable ( )
15
- export class Settings extends SketchContribution {
16
+ export class OpenSettings extends SketchContribution {
16
17
@inject ( SettingsDialog )
17
- protected readonly settingsDialog : SettingsDialog ;
18
+ private readonly settingsDialog : SettingsDialog ;
19
+ @inject ( MainMenuManager )
20
+ private readonly menuManager : MainMenuManager ;
18
21
19
- protected settingsOpened = false ;
22
+ private settingsOpened = false ;
20
23
21
24
override registerCommands ( registry : CommandRegistry ) : void {
22
- registry . registerCommand ( Settings . Commands . OPEN , {
25
+ registry . registerCommand ( OpenSettings . Commands . OPEN , {
23
26
execute : async ( ) => {
24
- let settings : Preferences | undefined = undefined ;
27
+ let settings : Settings | undefined = undefined ;
25
28
try {
26
29
this . settingsOpened = true ;
30
+ this . menuManager . update ( ) ;
27
31
settings = await this . settingsDialog . open ( ) ;
28
32
} finally {
29
33
this . settingsOpened = false ;
34
+ this . menuManager . update ( ) ;
30
35
}
31
36
if ( settings ) {
32
37
await this . settingsService . update ( settings ) ;
@@ -41,7 +46,7 @@ export class Settings extends SketchContribution {
41
46
42
47
override registerMenus ( registry : MenuModelRegistry ) : void {
43
48
registry . registerMenuAction ( ArduinoMenus . FILE__PREFERENCES_GROUP , {
44
- commandId : Settings . Commands . OPEN . id ,
49
+ commandId : OpenSettings . Commands . OPEN . id ,
45
50
label :
46
51
nls . localize (
47
52
'vscode/preferences.contribution/preferences' ,
@@ -57,13 +62,13 @@ export class Settings extends SketchContribution {
57
62
58
63
override registerKeybindings ( registry : KeybindingRegistry ) : void {
59
64
registry . registerKeybinding ( {
60
- command : Settings . Commands . OPEN . id ,
65
+ command : OpenSettings . Commands . OPEN . id ,
61
66
keybinding : 'CtrlCmd+,' ,
62
67
} ) ;
63
68
}
64
69
}
65
70
66
- export namespace Settings {
71
+ export namespace OpenSettings {
67
72
export namespace Commands {
68
73
export const OPEN : Command = {
69
74
id : 'arduino-settings-open' ,
0 commit comments