mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 17:32:41 +00:00
SCM - history item group context menu (#203712)
This commit is contained in:
parent
88f74b7713
commit
837b74c1b4
|
@ -1857,6 +1857,18 @@
|
|||
"when": "scmProvider == git"
|
||||
}
|
||||
],
|
||||
"scm/incomingChanges/context": [
|
||||
{
|
||||
"command": "git.fetchRef",
|
||||
"group": "1_modification@1",
|
||||
"when": "scmProvider == git"
|
||||
},
|
||||
{
|
||||
"command": "git.pullRef",
|
||||
"group": "1_modification@2",
|
||||
"when": "scmProvider == git"
|
||||
}
|
||||
],
|
||||
"scm/incomingChanges/allChanges/context": [
|
||||
{
|
||||
"command": "git.viewAllChanges",
|
||||
|
@ -1878,6 +1890,13 @@
|
|||
"when": "scmProvider == git"
|
||||
}
|
||||
],
|
||||
"scm/outgoingChanges/context": [
|
||||
{
|
||||
"command": "git.pushRef",
|
||||
"group": "1_modification@1",
|
||||
"when": "scmProvider == git"
|
||||
}
|
||||
],
|
||||
"scm/outgoingChanges/allChanges/context": [
|
||||
{
|
||||
"command": "git.viewAllChanges",
|
||||
|
|
|
@ -108,7 +108,9 @@ export class MenuId {
|
|||
static readonly ProblemsPanelContext = new MenuId('ProblemsPanelContext');
|
||||
static readonly SCMInputBox = new MenuId('SCMInputBox');
|
||||
static readonly SCMIncomingChanges = new MenuId('SCMIncomingChanges');
|
||||
static readonly SCMIncomingChangesContext = new MenuId('SCMIncomingChangesContext');
|
||||
static readonly SCMOutgoingChanges = new MenuId('SCMOutgoingChanges');
|
||||
static readonly SCMOutgoingChangesContext = new MenuId('SCMOutgoingChangesContext');
|
||||
static readonly SCMIncomingChangesAllChangesContext = new MenuId('SCMIncomingChangesAllChangesContext');
|
||||
static readonly SCMIncomingChangesHistoryItemContext = new MenuId('SCMIncomingChangesHistoryItemContext');
|
||||
static readonly SCMOutgoingChangesAllChangesContext = new MenuId('SCMOutgoingChangesAllChangesContext');
|
||||
|
|
|
@ -261,17 +261,29 @@ export class SCMHistoryProviderMenus implements ISCMHistoryProviderMenus, IDispo
|
|||
private _incomingHistoryItemGroupMenu: IMenu;
|
||||
get incomingHistoryItemGroupMenu(): IMenu { return this._incomingHistoryItemGroupMenu; }
|
||||
|
||||
private _incomingHistoryItemGroupContextMenu: IMenu;
|
||||
get incomingHistoryItemGroupContextMenu(): IMenu { return this._incomingHistoryItemGroupContextMenu; }
|
||||
|
||||
private _outgoingHistoryItemGroupMenu: IMenu;
|
||||
get outgoingHistoryItemGroupMenu(): IMenu { return this._outgoingHistoryItemGroupMenu; }
|
||||
|
||||
private _outgoingHistoryItemGroupContextMenu: IMenu;
|
||||
get outgoingHistoryItemGroupContextMenu(): IMenu { return this._outgoingHistoryItemGroupContextMenu; }
|
||||
|
||||
constructor(
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@IMenuService private readonly menuService: IMenuService) {
|
||||
this._incomingHistoryItemGroupMenu = this.menuService.createMenu(MenuId.SCMIncomingChanges, this.contextKeyService);
|
||||
this.disposables.add(this._incomingHistoryItemGroupMenu);
|
||||
|
||||
this._incomingHistoryItemGroupContextMenu = this.menuService.createMenu(MenuId.SCMIncomingChangesContext, this.contextKeyService);
|
||||
this.disposables.add(this._incomingHistoryItemGroupContextMenu);
|
||||
|
||||
this._outgoingHistoryItemGroupMenu = this.menuService.createMenu(MenuId.SCMOutgoingChanges, this.contextKeyService);
|
||||
this.disposables.add(this._outgoingHistoryItemGroupMenu);
|
||||
|
||||
this._outgoingHistoryItemGroupContextMenu = this.menuService.createMenu(MenuId.SCMOutgoingChangesContext, this.contextKeyService);
|
||||
this.disposables.add(this._outgoingHistoryItemGroupContextMenu);
|
||||
}
|
||||
|
||||
getHistoryItemMenu(historyItem: SCMHistoryItemTreeElement): IMenu {
|
||||
|
|
|
@ -3006,11 +3006,13 @@ export class SCMViewPane extends ViewPane {
|
|||
const element = e.element;
|
||||
let context: any = element;
|
||||
let actions: IAction[] = [];
|
||||
let actionRunner: IActionRunner = new RepositoryPaneActionRunner(() => this.getSelectedResources());
|
||||
|
||||
if (isSCMRepository(element)) {
|
||||
const menus = this.scmViewService.menus.getRepositoryMenus(element.provider);
|
||||
const menu = menus.repositoryContextMenu;
|
||||
context = element.provider;
|
||||
actionRunner = new RepositoryActionRunner(() => this.getSelectedRepositories());
|
||||
actions = collectContextMenuActions(menu);
|
||||
} else if (isSCMInput(element) || isSCMActionButton(element)) {
|
||||
// noop
|
||||
|
@ -3032,11 +3034,18 @@ export class SCMViewPane extends ViewPane {
|
|||
const menu = menus.getResourceFolderMenu(element.context);
|
||||
actions = collectContextMenuActions(menu);
|
||||
}
|
||||
} else if (isSCMHistoryItemGroupTreeElement(element)) {
|
||||
const menus = this.scmViewService.menus.getRepositoryMenus(element.repository.provider);
|
||||
const menu = element.direction === 'incoming' ?
|
||||
menus.historyProviderMenu?.incomingHistoryItemGroupContextMenu :
|
||||
menus.historyProviderMenu?.outgoingHistoryItemGroupContextMenu;
|
||||
|
||||
if (menu) {
|
||||
actionRunner = new HistoryItemGroupActionRunner();
|
||||
createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, actions);
|
||||
}
|
||||
}
|
||||
|
||||
const actionRunner = isSCMRepository(element) ?
|
||||
new RepositoryActionRunner(() => this.getSelectedRepositories()) :
|
||||
new RepositoryPaneActionRunner(() => this.getSelectedResources());
|
||||
actionRunner.onWillRun(() => this.tree.domFocus());
|
||||
|
||||
this.contextMenuService.showContextMenu({
|
||||
|
|
|
@ -11,7 +11,9 @@ import { ISCMRepository } from 'vs/workbench/contrib/scm/common/scm';
|
|||
|
||||
export interface ISCMHistoryProviderMenus {
|
||||
readonly incomingHistoryItemGroupMenu: IMenu;
|
||||
readonly incomingHistoryItemGroupContextMenu: IMenu;
|
||||
readonly outgoingHistoryItemGroupMenu: IMenu;
|
||||
readonly outgoingHistoryItemGroupContextMenu: IMenu;
|
||||
|
||||
getHistoryItemMenu(historyItem: SCMHistoryItemTreeElement): IMenu;
|
||||
}
|
||||
|
|
|
@ -162,12 +162,24 @@ const apiMenus: IAPIMenu[] = [
|
|||
description: localize('menus.incomingChanges', "The Source Control incoming changes menu"),
|
||||
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
||||
},
|
||||
{
|
||||
key: 'scm/incomingChanges/context',
|
||||
id: MenuId.SCMIncomingChangesContext,
|
||||
description: localize('menus.incomingChangesContext', "The Source Control incoming changes context menu"),
|
||||
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
||||
},
|
||||
{
|
||||
key: 'scm/outgoingChanges',
|
||||
id: MenuId.SCMOutgoingChanges,
|
||||
description: localize('menus.outgoingChanges', "The Source Control outgoing changes menu"),
|
||||
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
||||
},
|
||||
{
|
||||
key: 'scm/outgoingChanges/context',
|
||||
id: MenuId.SCMOutgoingChangesContext,
|
||||
description: localize('menus.outgoingChangesContext', "The Source Control outgoing changes context menu"),
|
||||
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
||||
},
|
||||
{
|
||||
key: 'scm/incomingChanges/allChanges/context',
|
||||
id: MenuId.SCMIncomingChangesAllChangesContext,
|
||||
|
|
|
@ -4,5 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// empty placeholder declaration for the `scm/incomingChanges`-menu contribution point
|
||||
// empty placeholder declaration for the `scm/incomingChanges/context`-menu contribution point
|
||||
// empty placeholder declaration for the `scm/outgoingChanges`-menu contribution point
|
||||
// empty placeholder declaration for the `scm/outgoingChanges/context`-menu contribution point
|
||||
// https://github.com/microsoft/vscode/issues/201997
|
||||
|
|
Loading…
Reference in a new issue