F6 and shift+F6 also focus on activity bar
This commit is contained in:
parent
9d68bd2918
commit
ef14938a46
5 changed files with 25 additions and 5 deletions
|
@ -202,8 +202,9 @@ class NavigateDownAction extends BaseNavigationAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
function findVisibleNeighbour(layoutService: IWorkbenchLayoutService, part: Parts, next: boolean): Parts {
|
function findVisibleNeighbour(layoutService: IWorkbenchLayoutService, part: Parts, next: boolean): Parts {
|
||||||
const neighbour = part === Parts.EDITOR_PART ? (next ? Parts.STATUSBAR_PART : Parts.PANEL_PART) : part === Parts.STATUSBAR_PART ? (next ? Parts.SIDEBAR_PART : Parts.EDITOR_PART) :
|
const neighbour = part === Parts.EDITOR_PART ? (next ? Parts.STATUSBAR_PART : Parts.PANEL_PART) : part === Parts.STATUSBAR_PART ? (next ? Parts.ACTIVITYBAR_PART : Parts.EDITOR_PART) :
|
||||||
part === Parts.SIDEBAR_PART ? (next ? Parts.PANEL_PART : Parts.STATUSBAR_PART) : part === Parts.PANEL_PART ? (next ? Parts.EDITOR_PART : Parts.SIDEBAR_PART) : Parts.EDITOR_PART;
|
part === Parts.ACTIVITYBAR_PART ? (next ? Parts.SIDEBAR_PART : Parts.STATUSBAR_PART) : part === Parts.SIDEBAR_PART ? (next ? Parts.PANEL_PART : Parts.ACTIVITYBAR_PART) :
|
||||||
|
part === Parts.PANEL_PART ? (next ? Parts.EDITOR_PART : Parts.SIDEBAR_PART) : Parts.EDITOR_PART;
|
||||||
if (layoutService.isVisible(neighbour) || neighbour === Parts.EDITOR_PART) {
|
if (layoutService.isVisible(neighbour) || neighbour === Parts.EDITOR_PART) {
|
||||||
return neighbour;
|
return neighbour;
|
||||||
}
|
}
|
||||||
|
@ -212,8 +213,8 @@ function findVisibleNeighbour(layoutService: IWorkbenchLayoutService, part: Part
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusNextOrPreviousPart(layoutService: IWorkbenchLayoutService, next: boolean): void {
|
function focusNextOrPreviousPart(layoutService: IWorkbenchLayoutService, next: boolean): void {
|
||||||
const currentlyFocusedPart = layoutService.hasFocus(Parts.EDITOR_PART) ? Parts.EDITOR_PART : layoutService.hasFocus(Parts.STATUSBAR_PART) ? Parts.STATUSBAR_PART :
|
const currentlyFocusedPart = layoutService.hasFocus(Parts.EDITOR_PART) ? Parts.EDITOR_PART : layoutService.hasFocus(Parts.ACTIVITYBAR_PART) ? Parts.ACTIVITYBAR_PART :
|
||||||
layoutService.hasFocus(Parts.SIDEBAR_PART) ? Parts.SIDEBAR_PART : layoutService.hasFocus(Parts.PANEL_PART) ? Parts.PANEL_PART : undefined;
|
layoutService.hasFocus(Parts.STATUSBAR_PART) ? Parts.STATUSBAR_PART : layoutService.hasFocus(Parts.SIDEBAR_PART) ? Parts.SIDEBAR_PART : layoutService.hasFocus(Parts.PANEL_PART) ? Parts.PANEL_PART : undefined;
|
||||||
let partToFocus = Parts.EDITOR_PART;
|
let partToFocus = Parts.EDITOR_PART;
|
||||||
if (currentlyFocusedPart) {
|
if (currentlyFocusedPart) {
|
||||||
partToFocus = findVisibleNeighbour(layoutService, currentlyFocusedPart, next);
|
partToFocus = findVisibleNeighbour(layoutService, currentlyFocusedPart, next);
|
||||||
|
|
|
@ -177,6 +177,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||||
private backupFileService!: IBackupFileService;
|
private backupFileService!: IBackupFileService;
|
||||||
private notificationService!: INotificationService;
|
private notificationService!: INotificationService;
|
||||||
private themeService!: IThemeService;
|
private themeService!: IThemeService;
|
||||||
|
private activityBarService!: IActivityBarService;
|
||||||
|
|
||||||
protected readonly state = {
|
protected readonly state = {
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
|
@ -260,8 +261,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||||
this.viewDescriptorService = accessor.get(IViewDescriptorService);
|
this.viewDescriptorService = accessor.get(IViewDescriptorService);
|
||||||
this.titleService = accessor.get(ITitleService);
|
this.titleService = accessor.get(ITitleService);
|
||||||
this.notificationService = accessor.get(INotificationService);
|
this.notificationService = accessor.get(INotificationService);
|
||||||
|
this.activityBarService = accessor.get(IActivityBarService);
|
||||||
accessor.get(IStatusbarService); // not used, but called to ensure instantiated
|
accessor.get(IStatusbarService); // not used, but called to ensure instantiated
|
||||||
accessor.get(IActivityBarService); // not used, but called to ensure instantiated
|
|
||||||
|
|
||||||
// Listeners
|
// Listeners
|
||||||
this.registerLayoutListeners();
|
this.registerLayoutListeners();
|
||||||
|
@ -846,6 +847,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
|
||||||
activeViewlet.focus();
|
activeViewlet.focus();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Parts.ACTIVITYBAR_PART:
|
||||||
|
this.activityBarService.focusActivityBar();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// Status Bar, Activity Bar and Title Bar simply pass focus to container
|
// Status Bar, Activity Bar and Title Bar simply pass focus to container
|
||||||
const container = this.getContainer(part);
|
const container = this.getContainer(part);
|
||||||
|
|
|
@ -168,6 +168,10 @@ export class ActivitybarPart extends Part implements IActivityBarService {
|
||||||
this.registerListeners();
|
this.registerListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focusActivityBar(): void {
|
||||||
|
this.compositeBar.focus();
|
||||||
|
}
|
||||||
|
|
||||||
private registerListeners(): void {
|
private registerListeners(): void {
|
||||||
|
|
||||||
// View Container Changes
|
// View Container Changes
|
||||||
|
|
|
@ -253,6 +253,12 @@ export class CompositeBar extends Widget implements ICompositeBar {
|
||||||
return actionBarDiv;
|
return actionBarDiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focus(): void {
|
||||||
|
if (this.compositeSwitcherBar) {
|
||||||
|
this.compositeSwitcherBar.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
layout(dimension: Dimension): void {
|
layout(dimension: Dimension): void {
|
||||||
this.dimension = dimension;
|
this.dimension = dimension;
|
||||||
if (dimension.height === 0 || dimension.width === 0) {
|
if (dimension.height === 0 || dimension.width === 0) {
|
||||||
|
|
|
@ -26,4 +26,9 @@ export interface IActivityBarService {
|
||||||
* Returns id of visible viewlets following the visual order.
|
* Returns id of visible viewlets following the visual order.
|
||||||
*/
|
*/
|
||||||
getVisibleViewContainerIds(): string[];
|
getVisibleViewContainerIds(): string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Focuses the activity bar.
|
||||||
|
*/
|
||||||
|
focusActivityBar(): void;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue