提交 e3e7cca3 编写于 作者: I isidor

activitybar: keybinding label for toggle panel

上级 16c03c2c
...@@ -149,7 +149,7 @@ export class ActivitybarPart extends Part implements IActivityService { ...@@ -149,7 +149,7 @@ export class ActivitybarPart extends Part implements IActivityService {
const allPanels = (<PanelRegistry>Registry.as(PanelExtensions.Panels)).getPanels(); const allPanels = (<PanelRegistry>Registry.as(PanelExtensions.Panels)).getPanels();
this.showPanelAction = this.instantiationService.createInstance(TogglePanelAction, TogglePanelAction.ID, TogglePanelAction.LABEL); this.showPanelAction = this.instantiationService.createInstance(TogglePanelAction, TogglePanelAction.ID, TogglePanelAction.LABEL);
this.activityActionItems[this.showPanelAction.id] = new ActivityActionItem(this.showPanelAction); this.activityActionItems[this.showPanelAction.id] = new ActivityActionItem(this.showPanelAction, TogglePanelAction.LABEL, this.getKeybindingLabel(TogglePanelAction.ID));
this.panelActions = allPanels.sort((p1, p2) => p1.order - p2.order).map(panel => this.toAction(panel)); this.panelActions = allPanels.sort((p1, p2) => p1.order - p2.order).map(panel => this.toAction(panel));
// Add both viewlet and panel actions to the switcher // Add both viewlet and panel actions to the switcher
...@@ -172,13 +172,7 @@ export class ActivitybarPart extends Part implements IActivityService { ...@@ -172,13 +172,7 @@ export class ActivitybarPart extends Part implements IActivityService {
const action = composite instanceof ViewletDescriptor ? this.instantiationService.createInstance(ViewletActivityAction, composite.id + '.activity-bar-action', composite) const action = composite instanceof ViewletDescriptor ? this.instantiationService.createInstance(ViewletActivityAction, composite.id + '.activity-bar-action', composite)
: this.instantiationService.createInstance(PanelActivityAction, composite.id + '.activity-bar-action', composite); : this.instantiationService.createInstance(PanelActivityAction, composite.id + '.activity-bar-action', composite);
let keybinding: string = null; this.activityActionItems[action.id] = new ActivityActionItem(action, composite.name, this.getKeybindingLabel(composite.id));
const keys = this.keybindingService.lookupKeybindings(composite.id).map(k => this.keybindingService.getLabelFor(k));
if (keys && keys.length) {
keybinding = keys[0];
}
this.activityActionItems[action.id] = new ActivityActionItem(action, composite.name, keybinding);
this.compositeIdToActions[composite.id] = action; this.compositeIdToActions[composite.id] = action;
// Mark active viewlet and panel action as active // Mark active viewlet and panel action as active
...@@ -189,6 +183,15 @@ export class ActivitybarPart extends Part implements IActivityService { ...@@ -189,6 +183,15 @@ export class ActivitybarPart extends Part implements IActivityService {
return action; return action;
}; };
private getKeybindingLabel(id: string): string {
const keys = this.keybindingService.lookupKeybindings(id).map(k => this.keybindingService.getLabelFor(k));
if (keys && keys.length) {
return keys[0];
}
return null;
}
public dispose(): void { public dispose(): void {
if (this.viewletSwitcherBar) { if (this.viewletSwitcherBar) {
this.viewletSwitcherBar.dispose(); this.viewletSwitcherBar.dispose();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册