- Notifications
You must be signed in to change notification settings - Fork 440
/
Copy pathquit-app.ts
54 lines (49 loc) · 1.46 KB
/
quit-app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import{inject,injectable}from'@theia/core/shared/inversify';
import{isOSX}from'@theia/core/lib/common/os';
import{
Contribution,
Command,
MenuModelRegistry,
KeybindingRegistry,
CommandRegistry,
}from'./contribution';
import{ArduinoMenus}from'../menu/arduino-menus';
import{nls}from'@theia/core/lib/common/nls';
import{AppService}from'../app-service';
@injectable()
exportclassQuitAppextendsContribution{
@inject(AppService)
privatereadonlyappService: AppService;
overrideregisterCommands(registry: CommandRegistry): void{
if(!isOSX){
registry.registerCommand(QuitApp.Commands.QUIT_APP,{
execute: ()=>this.appService.quit(),
});
}
}
overrideregisterMenus(registry: MenuModelRegistry): void{
// On macOS we will get the `Quit ${YOUR_APP_NAME}` menu item natively, no need to duplicate it.
if(!isOSX){
registry.registerMenuAction(ArduinoMenus.FILE__QUIT_GROUP,{
commandId: QuitApp.Commands.QUIT_APP.id,
label: nls.localize('vscode/bulkEditService/quit','Quit'),
order: '0',
});
}
}
overrideregisterKeybindings(registry: KeybindingRegistry): void{
if(!isOSX){
registry.registerKeybinding({
command: QuitApp.Commands.QUIT_APP.id,
keybinding: 'CtrlCmd+Q',
});
}
}
}
exportnamespaceQuitApp{
exportnamespaceCommands{
exportconstQUIT_APP: Command={
id: 'arduino-quit-app',
};
}
}