mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
parent
901ba0737a
commit
750117cf1d
|
@ -66,12 +66,14 @@ export class GlobalCompositeBar extends Disposable {
|
|||
super();
|
||||
|
||||
this.element = document.createElement('div');
|
||||
const anchorAlignment = configurationService.getValue('workbench.sideBar.location') === 'left' ? AnchorAlignment.RIGHT : AnchorAlignment.LEFT;
|
||||
const anchorAxisAlignment = AnchorAxisAlignment.HORIZONTAL;
|
||||
const contextMenuAlignmentOptions = () => ({
|
||||
anchorAlignment: configurationService.getValue('workbench.sideBar.location') === 'left' ? AnchorAlignment.RIGHT : AnchorAlignment.LEFT,
|
||||
anchorAxisAlignment: AnchorAxisAlignment.HORIZONTAL
|
||||
});
|
||||
this.globalActivityActionBar = this._register(new ActionBar(this.element, {
|
||||
actionViewItemProvider: action => {
|
||||
if (action.id === GLOBAL_ACTIVITY_ID) {
|
||||
return this.instantiationService.createInstance(GlobalActivityActionViewItem, this.contextMenuActionsProvider, { colors: this.colors, hoverOptions: this.activityHoverOptions }, anchorAlignment, anchorAxisAlignment);
|
||||
return this.instantiationService.createInstance(GlobalActivityActionViewItem, this.contextMenuActionsProvider, { colors: this.colors, hoverOptions: this.activityHoverOptions }, contextMenuAlignmentOptions);
|
||||
}
|
||||
|
||||
if (action.id === ACCOUNTS_ACTIVITY_ID) {
|
||||
|
@ -81,8 +83,7 @@ export class GlobalCompositeBar extends Disposable {
|
|||
colors: this.colors,
|
||||
hoverOptions: this.activityHoverOptions
|
||||
},
|
||||
anchorAlignment,
|
||||
anchorAxisAlignment,
|
||||
contextMenuAlignmentOptions,
|
||||
(actions: IAction[]) => {
|
||||
actions.unshift(...[
|
||||
toAction({ id: 'hideAccounts', label: localize('hideAccounts', "Hide Accounts"), run: () => this.storageService.store(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, false, StorageScope.PROFILE, StorageTarget.USER) }),
|
||||
|
@ -159,8 +160,7 @@ abstract class AbstractGlobalActivityActionViewItem extends CompoisteBarActionVi
|
|||
action: CompositeBarAction,
|
||||
options: ICompositeBarActionViewItemOptions,
|
||||
private readonly contextMenuActionsProvider: () => IAction[],
|
||||
private readonly anchorAlignment: AnchorAlignment | undefined,
|
||||
private readonly anchorAxisAlignment: AnchorAxisAlignment | undefined,
|
||||
private readonly contextMenuAlignmentOptions: () => Readonly<{ anchorAlignment: AnchorAlignment; anchorAxisAlignment: AnchorAxisAlignment }> | undefined,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IHoverService hoverService: IHoverService,
|
||||
@IMenuService private readonly menuService: IMenuService,
|
||||
|
@ -258,11 +258,12 @@ abstract class AbstractGlobalActivityActionViewItem extends CompoisteBarActionVi
|
|||
const disposables = new DisposableStore();
|
||||
const menu = disposables.add(this.menuService.createMenu(this.menuId, this.contextKeyService));
|
||||
const actions = await this.resolveMainMenuActions(menu, disposables);
|
||||
const { anchorAlignment, anchorAxisAlignment } = this.contextMenuAlignmentOptions() ?? { anchorAlignment: undefined, anchorAxisAlignment: undefined };
|
||||
|
||||
this.contextMenuService.showContextMenu({
|
||||
getAnchor: () => this.label,
|
||||
anchorAlignment: this.anchorAlignment,
|
||||
anchorAxisAlignment: this.anchorAxisAlignment,
|
||||
anchorAlignment,
|
||||
anchorAxisAlignment,
|
||||
getActions: () => actions,
|
||||
onHide: () => disposables.dispose(),
|
||||
menuActionOptions: { renderShortTitle: true },
|
||||
|
@ -290,8 +291,7 @@ export class AccountsActivityActionViewItem extends AbstractGlobalActivityAction
|
|||
constructor(
|
||||
contextMenuActionsProvider: () => IAction[],
|
||||
options: ICompositeBarActionViewItemOptions,
|
||||
anchorAlignment: AnchorAlignment | undefined,
|
||||
anchorAxisAlignment: AnchorAxisAlignment | undefined,
|
||||
contextMenuAlignmentOptions: () => Readonly<{ anchorAlignment: AnchorAlignment; anchorAxisAlignment: AnchorAxisAlignment }> | undefined,
|
||||
private readonly fillContextMenuActions: (actions: IAction[]) => void,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@ILifecycleService private readonly lifecycleService: ILifecycleService,
|
||||
|
@ -314,7 +314,7 @@ export class AccountsActivityActionViewItem extends AbstractGlobalActivityAction
|
|||
name: localize('accounts', "Accounts"),
|
||||
classNames: ThemeIcon.asClassNameArray(GlobalCompositeBar.ACCOUNTS_ICON)
|
||||
});
|
||||
super(MenuId.AccountsContext, action, options, contextMenuActionsProvider, anchorAlignment, anchorAxisAlignment, themeService, hoverService, menuService, contextMenuService, contextKeyService, configurationService, keybindingService, activityService);
|
||||
super(MenuId.AccountsContext, action, options, contextMenuActionsProvider, contextMenuAlignmentOptions, themeService, hoverService, menuService, contextMenuService, contextKeyService, configurationService, keybindingService, activityService);
|
||||
this._register(action);
|
||||
this.registerListeners();
|
||||
this.initialize();
|
||||
|
@ -536,8 +536,7 @@ export class GlobalActivityActionViewItem extends AbstractGlobalActivityActionVi
|
|||
constructor(
|
||||
contextMenuActionsProvider: () => IAction[],
|
||||
options: ICompositeBarActionViewItemOptions,
|
||||
anchorAlignment: AnchorAlignment | undefined,
|
||||
anchorAxisAlignment: AnchorAxisAlignment | undefined,
|
||||
contextMenuAlignmentOptions: () => Readonly<{ anchorAlignment: AnchorAlignment; anchorAxisAlignment: AnchorAxisAlignment }> | undefined,
|
||||
@IUserDataProfileService private readonly userDataProfileService: IUserDataProfileService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IHoverService hoverService: IHoverService,
|
||||
|
@ -555,7 +554,7 @@ export class GlobalActivityActionViewItem extends AbstractGlobalActivityActionVi
|
|||
name: localize('manage', "Manage"),
|
||||
classNames: ThemeIcon.asClassNameArray(userDataProfileService.currentProfile.icon ? ThemeIcon.fromId(userDataProfileService.currentProfile.icon) : DEFAULT_ICON)
|
||||
});
|
||||
super(MenuId.GlobalActivity, action, options, contextMenuActionsProvider, anchorAlignment, anchorAxisAlignment, themeService, hoverService, menuService, contextMenuService, contextKeyService, configurationService, keybindingService, activityService);
|
||||
super(MenuId.GlobalActivity, action, options, contextMenuActionsProvider, contextMenuAlignmentOptions, themeService, hoverService, menuService, contextMenuService, contextKeyService, configurationService, keybindingService, activityService);
|
||||
this._register(action);
|
||||
this._register(this.userDataProfileService.onDidChangeCurrentProfile(e => {
|
||||
action.compositeBarActionItem = {
|
||||
|
@ -635,7 +634,7 @@ export class SimpleAccountActivityActionViewItem extends AccountsActivityActionV
|
|||
}),
|
||||
hoverOptions,
|
||||
compact: true,
|
||||
}, undefined, undefined, actions => actions, themeService, lifecycleService, hoverService, contextMenuService, menuService, contextKeyService, authenticationService, environmentService, productService, configurationService, keybindingService, secretStorageService, logService, activityService, instantiationService);
|
||||
}, () => undefined, actions => actions, themeService, lifecycleService, hoverService, contextMenuService, menuService, contextKeyService, authenticationService, environmentService, productService, configurationService, keybindingService, secretStorageService, logService, activityService, instantiationService);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -662,6 +661,6 @@ export class SimpleGlobalActivityActionViewItem extends GlobalActivityActionView
|
|||
}),
|
||||
hoverOptions,
|
||||
compact: true,
|
||||
}, undefined, undefined, userDataProfileService, themeService, hoverService, menuService, contextMenuService, contextKeyService, configurationService, environmentService, keybindingService, instantiationService, activityService);
|
||||
}, () => undefined, userDataProfileService, themeService, hoverService, menuService, contextMenuService, contextKeyService, configurationService, environmentService, keybindingService, instantiationService, activityService);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue