Skip to content

Commit

Permalink
Revisit how activity bar items and status bar items can be hidden by …
Browse files Browse the repository at this point in the history
…the user (fix #113757)

//cc @sandy081 @sbatten
  • Loading branch information
bpasero committed Jan 6, 2021
1 parent 0cb7dad commit 448d049
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class HomeActivityActionViewItem extends MenuActivityActionViewItem {
if (contributedActions.length > 0) {
actions.push(disposables.add(new Separator()));
}
actions.push(disposables.add(new Action('hide', nls.localize('hide', "Hide"), undefined, true, async () => {
actions.push(disposables.add(new Action('hide', nls.localize('hide', "Hide Home Button"), undefined, true, async () => {
this.storageService.store(HomeActivityActionViewItem.HOME_BAR_VISIBILITY_PREFERENCE, false, StorageScope.GLOBAL, StorageTarget.USER);
})));

Expand Down Expand Up @@ -306,7 +306,7 @@ export class AccountsActivityActionViewItem extends MenuActivityActionViewItem {
menus.push(disposables.add(new Separator()));
}

menus.push(disposables.add(new Action('hide', nls.localize('hide', "Hide"), undefined, true, async () => {
menus.push(disposables.add(new Action('hide', nls.localize('hideAccounts', "Hide Accounts"), undefined, true, async () => {
this.storageService.store(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, false, StorageScope.GLOBAL, StorageTarget.USER);
})));

Expand Down
13 changes: 9 additions & 4 deletions src/vs/workbench/browser/parts/compositeBarActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,14 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
return this.compositeActivity;
}

private getActivtyName(): string {
private getActivtyName(skipKeybinding = false): string {
let name = this.compositeActivityAction.activity.name;
if (skipKeybinding) {
return name;
}

const keybinding = this.compositeActivityAction.activity.keybindingId ? this.keybindingService.lookupKeybinding(this.compositeActivityAction.activity.keybindingId) : null;
return keybinding ? nls.localize('titleKeybinding', "{0} ({1})", this.compositeActivityAction.activity.name, keybinding.getLabel()) : this.compositeActivityAction.activity.name;
return keybinding ? nls.localize('titleKeybinding', "{0} ({1})", name, keybinding.getLabel()) : name;
}

render(container: HTMLElement): void {
Expand Down Expand Up @@ -615,10 +620,10 @@ export class CompositeActionViewItem extends ActivityActionViewItem {

const isPinned = this.compositeBar.isPinned(this.activity.id);
if (isPinned) {
this.toggleCompositePinnedAction.label = nls.localize('hide', "Hide");
this.toggleCompositePinnedAction.label = nls.localize('hide', "Hide '{0}'", this.getActivtyName(true));
this.toggleCompositePinnedAction.checked = false;
} else {
this.toggleCompositePinnedAction.label = nls.localize('keep', "Keep");
this.toggleCompositePinnedAction.label = nls.localize('keep', "Keep '{0}'", this.getActivtyName(true));
}

const otherActions = this.contextMenuActionsProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
super({
id: `${viewDescriptor.id}.removeView`,
viewPaneContainerId: viewContainerModel.viewContainer.id,
title: localize('hideView', "Hide"),
title: localize('hideView', "Hide '{0}'", viewDescriptor.name),
precondition: viewDescriptor.canToggleVisibility && (!viewContainerModel.isVisible(viewDescriptor.id) || viewContainerModel.visibleViewDescriptors.length > 1) ? ContextKeyTrueExpr.INSTANCE : ContextKeyFalseExpr.INSTANCE,
menu: [{
id: MenuId.ViewTitleContext,
Expand Down

0 comments on commit 448d049

Please sign in to comment.