-
Notifications
You must be signed in to change notification settings - Fork 40
/
contribution.ts
33 lines (27 loc) · 1.15 KB
/
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
import { injectable, inject } from '@theia/core/shared/inversify';
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService } from '@theia/core/lib/common';
import { CommonMenus } from '@theia/core/lib/browser';
export const <%= params.extensionPrefix %>Command = {
id: '<%= params.extensionPrefix %>.command',
label: 'Say Hello'
};
@injectable()
export class <%= params.extensionPrefix %>CommandContribution implements CommandContribution {
constructor(
@inject(MessageService) private readonly messageService: MessageService,
) { }
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(<%= params.extensionPrefix %>Command, {
execute: () => this.messageService.info('Hello World!')
});
}
}
@injectable()
export class <%= params.extensionPrefix %>MenuContribution implements MenuContribution {
registerMenus(menus: MenuModelRegistry): void {
menus.registerMenuAction(CommonMenus.EDIT_FIND, {
commandId: <%= params.extensionPrefix %>Command.id,
label: <%= params.extensionPrefix %>Command.label
});
}
}