Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}));
}
} else if (location === 'view/item/context') {
for (const menu of allMenus[location]) {
const inline = menu.group && /^inline/.test(menu.group) || false;
const menuPath = inline ? VIEW_ITEM_INLINE_MNUE : VIEW_ITEM_CONTEXT_MENU;
toDispose.push(this.registerTreeMenuAction(menuPath, menu));
}
} else if (location === 'scm/title') {
for (const action of allMenus[location]) {
toDispose.push(this.registerScmTitleAction(location, action));
}
} else if (location === 'scm/resourceGroup/context') {
for (const menu of allMenus[location]) {
const inline = menu.group && /^inline/.test(menu.group) || false;
const menuPath = inline ? ScmWidget.RESOURCE_GROUP_INLINE_MENU : ScmWidget.RESOURCE_GROUP_CONTEXT_MENU;
toDispose.push(this.registerScmMenuAction(menuPath, menu));
}
} else if (location === 'scm/resourceState/context') {
for (const menu of allMenus[location]) {
const inline = menu.group && /^inline/.test(menu.group) || false;
const menuPath = inline ? ScmWidget.RESOURCE_INLINE_MENU : ScmWidget.RESOURCE_CONTEXT_MENU;
toDispose.push(this.registerScmMenuAction(menuPath, menu));
}
} else if (location === 'debug/callstack/context') {
for (const menu of allMenus[location]) {
for (const menuPath of [DebugStackFramesWidget.CONTEXT_MENU, DebugThreadsWidget.CONTEXT_MENU]) {
toDispose.push(this.registerMenuAction(menuPath, menu, command => ({
execute: (...args) => this.commands.executeCommand(command, args[0]),
isEnabled: (...args) => this.commands.isEnabled(command, args[0]),
isVisible: (...args) => this.commands.isVisible(command, args[0])
})));
toDispose.push(this.registerTreeMenuAction(menuPath, menu));
}
} else if (location === 'scm/title') {
for (const action of allMenus[location]) {
toDispose.push(this.registerScmTitleAction(location, action));
}
} else if (location === 'scm/resourceGroup/context') {
for (const menu of allMenus[location]) {
const inline = menu.group && /^inline/.test(menu.group) || false;
const menuPath = inline ? ScmWidget.RESOURCE_GROUP_INLINE_MENU : ScmWidget.RESOURCE_GROUP_CONTEXT_MENU;
toDispose.push(this.registerScmMenuAction(menuPath, menu));
}
} else if (location === 'scm/resourceState/context') {
for (const menu of allMenus[location]) {
const inline = menu.group && /^inline/.test(menu.group) || false;
const menuPath = inline ? ScmWidget.RESOURCE_INLINE_MENU : ScmWidget.RESOURCE_CONTEXT_MENU;
toDispose.push(this.registerScmMenuAction(menuPath, menu));
}
} else if (location === 'debug/callstack/context') {
for (const menu of allMenus[location]) {
for (const menuPath of [DebugStackFramesWidget.CONTEXT_MENU, DebugThreadsWidget.CONTEXT_MENU]) {
toDispose.push(this.registerMenuAction(menuPath, menu, command => ({
execute: (...args) => this.commands.executeCommand(command, args[0]),
isEnabled: (...args) => this.commands.isEnabled(command, args[0]),
isVisible: (...args) => this.commands.isVisible(command, args[0])
})));
}
}
} else if (allMenus.hasOwnProperty(location)) {
const menuPaths = MenusContributionPointHandler.parseMenuPaths(location);
if (!menuPaths.length) {
this.logger.warn(`Plugin contributes items to a menu with invalid identifier: ${location}`);
const registerResourceGroupAction = (group: string, action: MenuAction) => {
menus.registerMenuAction(ScmWidget.RESOURCE_GROUP_INLINE_MENU, action);
menus.registerMenuAction([...ScmWidget.RESOURCE_GROUP_CONTEXT_MENU, group], action);
};
const registerResourceAction = (group: string, action: MenuAction) => {
menus.registerMenuAction(ScmWidget.RESOURCE_INLINE_MENU, action);
menus.registerMenuAction([...ScmWidget.RESOURCE_CONTEXT_MENU, group], action);
};
const registerResourceGroupAction = (group: string, action: MenuAction) => {
menus.registerMenuAction(ScmWidget.RESOURCE_GROUP_INLINE_MENU, action);
menus.registerMenuAction([...ScmWidget.RESOURCE_GROUP_CONTEXT_MENU, group], action);
};
const registerResourceAction = (group: string, action: MenuAction) => {
menus.registerMenuAction(ScmWidget.RESOURCE_INLINE_MENU, action);
menus.registerMenuAction([...ScmWidget.RESOURCE_CONTEXT_MENU, group], action);
};
protected doShowMoreToolButtons(event: React.MouseEvent): void {
const el = (event.target as HTMLElement).parentElement;
if (el) {
this.contextMenuRenderer.render(ScmWidget.ContextMenu.PATH, {
x: el.getBoundingClientRect().left,
y: el.getBoundingClientRect().top + el.offsetHeight
});
}
}