diff --git a/src/vs/workbench/browser/parts/panel/panelPart.ts b/src/vs/workbench/browser/parts/panel/panelPart.ts index 60cb3720063e8..de20f8b396f3a 100644 --- a/src/vs/workbench/browser/parts/panel/panelPart.ts +++ b/src/vs/workbench/browser/parts/panel/panelPart.ts @@ -147,5 +147,39 @@ class TogglePanelAction extends Action { } } +class FocusPanelAction extends Action { + + public static ID = 'workbench.action.focusPanel'; + public static LABEL = nls.localize('focusPanel', "Focus into Panel"); + + constructor( + id: string, + label: string, + @IPanelService private panelService: IPanelService, + @IPartService private partService: IPartService + ) { + super(id, label); + } + + public run(): TPromise<boolean> { + + // Show panel + if (this.partService.isPanelHidden()) { + this.partService.setPanelHidden(false); + } + + // Focus into active panel + else { + let panel = this.panelService.getActivePanel(); + if (panel) { + panel.focus(); + } + } + + return TPromise.as(true); + } +} + let actionRegistry = <IWorkbenchActionRegistry>Registry.as(WorkbenchExtensions.WorkbenchActions); actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(TogglePanelAction, TogglePanelAction.ID, TogglePanelAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_J }), 'View: Toggle Panel Visibility', nls.localize('view', "View")); +actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusPanelAction, FocusPanelAction.ID, FocusPanelAction.LABEL), 'View: Focus into Panel', nls.localize('view', "View")); diff --git a/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts b/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts index 401507bd2986a..905437314fb25 100644 --- a/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts +++ b/src/vs/workbench/browser/parts/sidebar/sidebarPart.ts @@ -93,7 +93,7 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi } } -export class FocusSideBarAction extends Action { +class FocusSideBarAction extends Action { public static ID = 'workbench.action.focusSideBar'; public static LABEL = nls.localize('focusSideBar', "Focus into Side Bar");