mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-30 18:46:00 +01:00
proper SubmenuAction.id
This commit is contained in:
@@ -504,7 +504,7 @@ export class MenuBar extends Disposable {
|
||||
|
||||
this.overflowMenu.actions = [];
|
||||
for (let idx = this.numMenusShown; idx < this.menuCache.length; idx++) {
|
||||
this.overflowMenu.actions.push(new SubmenuAction(this.menuCache[idx].label, this.menuCache[idx].actions || []));
|
||||
this.overflowMenu.actions.push(new SubmenuAction(`menubar.submenu.${this.menuCache[idx].label}`, this.menuCache[idx].label, this.menuCache[idx].actions || []));
|
||||
}
|
||||
|
||||
if (this.overflowMenu.buttonElement.nextElementSibling !== this.menuCache[this.numMenusShown].buttonElement) {
|
||||
|
||||
@@ -233,7 +233,7 @@ export class Separator extends Action {
|
||||
export type SubmenuActions = IAction[] | (() => IAction[]);
|
||||
|
||||
export class SubmenuAction extends Action {
|
||||
constructor(label: string, readonly actions: SubmenuActions, cssClass?: string) {
|
||||
super(!!cssClass ? cssClass : 'submenu', label, '', true);
|
||||
constructor(id: string, label: string, readonly actions: SubmenuActions, cssClass?: string) {
|
||||
super(id, label, cssClass, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ export class ContextMenuController implements IEditorContribution {
|
||||
if (action instanceof SubmenuItemAction) {
|
||||
const subActions = this._getMenuActions(model, action.item.submenu);
|
||||
if (subActions.length > 0) {
|
||||
result.push(new SubmenuAction(action.label, subActions));
|
||||
result.push(new SubmenuAction(action.id, action.label, subActions));
|
||||
addedItems++;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -303,7 +303,7 @@ export class SubmenuItemAction extends SubmenuAction {
|
||||
contextKeyService: IContextKeyService,
|
||||
options?: IMenuActionOptions
|
||||
) {
|
||||
super(typeof item.title === 'string' ? item.title : item.title.value, () => {
|
||||
super(`submenuitem.${item.submenu.id}`, typeof item.title === 'string' ? item.title : item.title.value, () => {
|
||||
const result: IAction[] = [];
|
||||
const menu = menuService.createMenu(item.submenu, contextKeyService);
|
||||
const groups = menu.getActions(options);
|
||||
|
||||
@@ -172,7 +172,7 @@ export class AccountsActionViewItem extends ActivityActionViewItem {
|
||||
|
||||
const actions = hasEmbedderAccountSession ? [manageExtensionsAction] : [manageExtensionsAction, signOutAction];
|
||||
|
||||
const menu = new SubmenuAction(`${accountName} (${providerDisplayName})`, actions);
|
||||
const menu = new SubmenuAction('activitybar.submenu', `${accountName} (${providerDisplayName})`, actions);
|
||||
menus.push(menu);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -598,7 +598,7 @@ export class CustomMenubarControl extends MenubarControl {
|
||||
|
||||
const submenuActions: SubmenuAction[] = [];
|
||||
updateActions(submenu, submenuActions, topLevelTitle);
|
||||
target.push(new SubmenuAction(mnemonicMenuLabel(action.label), submenuActions));
|
||||
target.push(new SubmenuAction(action.id, mnemonicMenuLabel(action.label), submenuActions));
|
||||
} else {
|
||||
action.label = mnemonicMenuLabel(this.calculateActionLabel(action));
|
||||
target.push(action);
|
||||
|
||||
@@ -77,7 +77,7 @@ export abstract class Viewlet extends PaneComposite implements IViewlet {
|
||||
}
|
||||
|
||||
return [
|
||||
new SubmenuAction(nls.localize('views', "Views"), viewSecondaryActions),
|
||||
new SubmenuAction('workbench.views', nls.localize('views', "Views"), viewSecondaryActions),
|
||||
new Separator(),
|
||||
...secondaryActions
|
||||
];
|
||||
|
||||
@@ -309,7 +309,7 @@ export class BreakpointEditorContribution implements IBreakpointEditorContributi
|
||||
));
|
||||
} else if (breakpoints.length > 1) {
|
||||
const sorted = breakpoints.slice().sort((first, second) => (first.column && second.column) ? first.column - second.column : 1);
|
||||
actions.push(new SubmenuAction(nls.localize('removeBreakpoints', "Remove Breakpoints"), sorted.map(bp => new Action(
|
||||
actions.push(new SubmenuAction('debug.removeBreakpoints', nls.localize('removeBreakpoints', "Remove Breakpoints"), sorted.map(bp => new Action(
|
||||
'removeInlineBreakpoint',
|
||||
bp.column ? nls.localize('removeInlineBreakpointOnColumn', "Remove Inline Breakpoint on Column {0}", bp.column) : nls.localize('removeLineBreakpoint', "Remove Line Breakpoint"),
|
||||
undefined,
|
||||
@@ -317,7 +317,7 @@ export class BreakpointEditorContribution implements IBreakpointEditorContributi
|
||||
() => this.debugService.removeBreakpoints(bp.getId())
|
||||
))));
|
||||
|
||||
actions.push(new SubmenuAction(nls.localize('editBreakpoints', "Edit Breakpoints"), sorted.map(bp =>
|
||||
actions.push(new SubmenuAction('debug.editBReakpoints', nls.localize('editBreakpoints', "Edit Breakpoints"), sorted.map(bp =>
|
||||
new Action('editBreakpoint',
|
||||
bp.column ? nls.localize('editInlineBreakpointOnColumn', "Edit Inline Breakpoint on Column {0}", bp.column) : nls.localize('editLineBrekapoint', "Edit Line Breakpoint"),
|
||||
undefined,
|
||||
@@ -326,7 +326,7 @@ export class BreakpointEditorContribution implements IBreakpointEditorContributi
|
||||
)
|
||||
)));
|
||||
|
||||
actions.push(new SubmenuAction(nls.localize('enableDisableBreakpoints', "Enable/Disable Breakpoints"), sorted.map(bp => new Action(
|
||||
actions.push(new SubmenuAction('debug.enableDisableBreakpoints', nls.localize('enableDisableBreakpoints', "Enable/Disable Breakpoints"), sorted.map(bp => new Action(
|
||||
bp.enabled ? 'disableColumnBreakpoint' : 'enableColumnBreakpoint',
|
||||
bp.enabled ? (bp.column ? nls.localize('disableInlineColumnBreakpoint', "Disable Inline Breakpoint on Column {0}", bp.column) : nls.localize('disableBreakpointOnLine', "Disable Line Breakpoint"))
|
||||
: (bp.column ? nls.localize('enableBreakpoints', "Enable Inline Breakpoint on Column {0}", bp.column) : nls.localize('enableBreakpointOnLine', "Enable Line Breakpoint")),
|
||||
|
||||
@@ -825,7 +825,7 @@ class EditSettingRenderer extends Disposable {
|
||||
|
||||
const anchor = { x: e.event.posx, y: e.event.posy + 10 };
|
||||
const actions = this.getSettings(editPreferenceWidget.getLine()).length === 1 ? this.getActions(editPreferenceWidget.preferences[0], this.getConfigurationsMap()[editPreferenceWidget.preferences[0].key])
|
||||
: editPreferenceWidget.preferences.map(setting => new SubmenuAction(setting.key, this.getActions(setting, this.getConfigurationsMap()[setting.key])));
|
||||
: editPreferenceWidget.preferences.map(setting => new SubmenuAction(`preferences.submenu.${setting.key}`, setting.key, this.getActions(setting, this.getConfigurationsMap()[setting.key])));
|
||||
this.contextMenuService.showContextMenu({
|
||||
getAnchor: () => anchor,
|
||||
getActions: () => actions
|
||||
|
||||
@@ -1168,7 +1168,9 @@ class ViewModel {
|
||||
|
||||
class SCMViewSubMenuAction extends SubmenuAction {
|
||||
constructor(viewModel: ViewModel) {
|
||||
super(localize('sortAction', "View & Sort"),
|
||||
super(
|
||||
'scm.viewsort',
|
||||
localize('sortAction', "View & Sort"),
|
||||
[
|
||||
...new RadioGroup([
|
||||
new SCMViewModeListAction(viewModel),
|
||||
|
||||
Reference in New Issue
Block a user