support default action for OE node (#22455)

* support default action for OE node

* fix floating promise
This commit is contained in:
Alan Ren
2023-03-24 20:09:48 -07:00
committed by GitHub
parent 3d2a531976
commit 35cb233851
7 changed files with 147 additions and 84 deletions

View File

@@ -23,6 +23,7 @@ export interface IMenuItem {
when?: ContextKeyExpression;
group?: 'navigation' | string;
order?: number;
isDefault?: boolean; // {{SQL CARBON EDIT}} - Used by object explorer, indicating whether this is the action to be executed when a node is double clicked.
}
export interface ISubmenuItem {
@@ -366,6 +367,8 @@ export class MenuItemAction implements IAction {
readonly id: string;
isDefault: boolean = false; // {{SQL CARBON EDIT}}} - Add isDefault property to MenuItemAction.
// {{SQL CARBON EDIT}} -- remove readonly since notebook component sets these
label: string;
tooltip: string;

View File

@@ -154,6 +154,11 @@ class Menu implements IMenu {
? new MenuItemAction(item.command, item.alt, options, this._contextKeyService, this._commandService)
: new SubmenuItemAction(item, this._menuService, this._contextKeyService, options);
// {{SQL CARBON EDIT}} - Set isDefault property
if (isIMenuItem(item)) {
(<MenuItemAction>action).isDefault = item.isDefault;
}
// {{SQL CARBON EDIT}} - End
activeActions.push(action);
}
}

View File

@@ -313,6 +313,7 @@ namespace schema {
alt?: string;
when?: string;
group?: string;
isDefault?: boolean; // {{SQL CARBON EDIT}} - Used by object explorer, indicating whether this is the action to be executed when a node is double clicked.
}
export interface IUserFriendlySubmenuItem {
@@ -824,6 +825,8 @@ menusExtensionPoint.setHandler(extensions => {
}
item = { command, alt, group: undefined, order: undefined, when: undefined };
(<IMenuItem>item).isDefault = menuItem.isDefault; // {{SQL CARBON EDIT}}} Set isDefault property.
} else {
if (menu.supportsSubmenus === false) {
collector.error(localize('unsupported.submenureference', "Menu item references a submenu for a menu which doesn't have submenu support."));