Skip to content

Commit

Permalink
#113757 show panel move and hide actions on view context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Jan 12, 2021
1 parent f295025 commit a04802f
Showing 1 changed file with 48 additions and 18 deletions.
66 changes: 48 additions & 18 deletions src/vs/workbench/browser/parts/panel/panelActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,30 +283,60 @@ registerAction2(class extends Action2 {
}
});

MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
command: {
id: TogglePanelAction.ID,
title: nls.localize({ key: 'miShowPanel', comment: ['&& denotes a mnemonic'] }, "Show &&Panel"),
toggled: ActivePanelContext
},
order: 5
});
MenuRegistry.appendMenuItems([
{
id: MenuId.MenubarAppearanceMenu,
item: {
group: '2_workbench_layout',
command: {
id: TogglePanelAction.ID,
title: nls.localize({ key: 'miShowPanel', comment: ['&& denotes a mnemonic'] }, "Show &&Panel"),
toggled: ActivePanelContext
},
order: 5
}
}, {
id: MenuId.ViewTitleContext,
item: {
group: '3_workbench_layout_move',
command: {
id: TogglePanelAction.ID,
title: { value: nls.localize('hidePanel', "Hide Panel"), original: 'Hide Panel' },
},
when: PanelVisibleContext,
order: 2
}
}
]);

function registerPositionPanelActionById(config: PanelActionConfig<Position>) {
const { id, label, alias, when } = config;
// register the workbench action
actionRegistry.registerWorkbenchAction(SyncActionDescriptor.create(SetPanelPositionAction, id, label), alias, CATEGORIES.View.value, when);
// register as a menu item
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '3_workbench_layout_move',
command: {
id,
title: label
},
when,
order: 5
});
MenuRegistry.appendMenuItems([{
id: MenuId.MenubarAppearanceMenu,
item: {
group: '3_workbench_layout_move',
command: {
id,
title: label
},
when,
order: 5
}
}, {
id: MenuId.ViewTitleContext,
item: {
group: '3_workbench_layout_move',
command: {
id: id,
title: label,
},
when,
order: 1
}
}]);
}

// register each position panel action
Expand Down

0 comments on commit a04802f

Please sign in to comment.