- Notifications
You must be signed in to change notification settings - Fork 440
/
Copy pathlibrary-widget-frontend-contribution.ts
53 lines (49 loc) · 1.57 KB
/
library-widget-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
import{nls}from'@theia/core/lib/common';
import{MenuModelRegistry}from'@theia/core/lib/common/menu';
import{injectable}from'@theia/core/shared/inversify';
import{LibraryPackage,LibrarySearch}from'../../common/protocol';
import{URI}from'../contributions/contribution';
import{ArduinoMenus}from'../menu/arduino-menus';
import{ListWidgetFrontendContribution}from'../widgets/component-list/list-widget-frontend-contribution';
import{LibraryListWidget}from'./library-list-widget';
@injectable()
exportclassLibraryListWidgetFrontendContributionextendsListWidgetFrontendContribution<
LibraryPackage,
LibrarySearch
>{
constructor(){
super({
widgetId: LibraryListWidget.WIDGET_ID,
widgetName: LibraryListWidget.WIDGET_LABEL,
defaultWidgetOptions: {
area: 'left',
rank: 3,
},
toggleCommandId: `${LibraryListWidget.WIDGET_ID}:toggle`,
toggleKeybinding: 'CtrlCmd+Shift+I',
});
}
overrideregisterMenus(menus: MenuModelRegistry): void{
if(this.toggleCommand){
menus.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP,{
commandId: this.toggleCommand.id,
label: nls.localize(
'arduino/library/manageLibraries',
'Manage Libraries...'
),
order: '3',
});
}
}
protectedcanParse(uri: URI): boolean{
try{
LibrarySearch.UriParser.parse(uri);
returntrue;
}catch{
returnfalse;
}
}
protectedparse(uri: URI): LibrarySearch|undefined{
returnLibrarySearch.UriParser.parse(uri);
}
}