-
-
Notifications
You must be signed in to change notification settings - Fork 436
/
Copy patharduino-workspace-frontend-contribution.ts
62 lines (56 loc) · 2.49 KB
/
arduino-workspace-frontend-contribution.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
55
56
57
58
59
60
61
62
import { injectable } from 'inversify';
import { isOSX } from '@theia/core/lib/common/os';
import { environment } from '@theia/application-package/lib/environment';
import { CommonMenus } from '@theia/core/lib/browser';
import { CommandRegistry } from '@theia/core/lib/common/command';
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
import { WorkspaceCommands } from '@theia/workspace/lib/browser/workspace-commands';
import { WorkspaceFrontendContribution } from '@theia/workspace/lib/browser/workspace-frontend-contribution';
// TODO: https://github.com/eclipse-theia/theia/issues/8175
@injectable()
export class ArduinoWorkspaceFrontendContribution extends WorkspaceFrontendContribution {
registerCommands(registry: CommandRegistry): void {
super.registerCommands(registry);
registry.unregisterCommand(WorkspaceCommands.SAVE_AS);
registry.unregisterCommand(WorkspaceCommands.OPEN_FOLDER);
}
registerMenus(registry: MenuModelRegistry): void {
if (isOSX || !environment.electron.is()) {
registry.registerMenuAction(CommonMenus.FILE_OPEN, {
commandId: WorkspaceCommands.OPEN.id,
order: 'a00'
});
}
if (!isOSX && environment.electron.is()) {
registry.registerMenuAction(CommonMenus.FILE_OPEN, {
commandId: WorkspaceCommands.OPEN_FILE.id,
label: `${WorkspaceCommands.OPEN_FILE.dialogLabel}...`,
order: 'a01'
});
registry.registerMenuAction(CommonMenus.FILE_OPEN, {
commandId: WorkspaceCommands.OPEN_FOLDER.id,
label: `${WorkspaceCommands.OPEN_FOLDER.dialogLabel}...`,
order: 'a02'
});
}
registry.registerMenuAction(CommonMenus.FILE_OPEN, {
commandId: WorkspaceCommands.OPEN_WORKSPACE.id,
order: 'a10'
});
registry.registerMenuAction(CommonMenus.FILE_OPEN, {
commandId: WorkspaceCommands.OPEN_RECENT_WORKSPACE.id,
order: 'a20'
});
registry.registerMenuAction(CommonMenus.FILE_OPEN, {
commandId: WorkspaceCommands.SAVE_WORKSPACE_AS.id,
order: 'a30'
});
registry.registerMenuAction(CommonMenus.FILE_CLOSE, {
commandId: WorkspaceCommands.CLOSE.id
});
// `Save As`
// menus.registerMenuAction(CommonMenus.FILE_SAVE, {
// commandId: WorkspaceCommands.SAVE_AS.id,
// });
}
}