private void RegisterContextActions() { _menuBranchCopyContextMenuItems = CreateCopyContextMenuItems(); _menuRemoteCopyContextMenuItems = CreateCopyContextMenuItems(); AddContextMenuItems(menuBranch, _menuBranchCopyContextMenuItems); AddContextMenuItems(menuRemote, _menuRemoteCopyContextMenuItems); _sortOrderContextMenuItem = new GitRefsSortOrderContextMenuItem(() => { _branchesTree.Refresh(); _remotesTree.Refresh(); _tagTree.Refresh(); }); _sortByContextMenuItem = new GitRefsSortByContextMenuItem(() => { _branchesTree.Refresh(); _remotesTree.Refresh(); _tagTree.Refresh(); }); _localBranchMenuItems = new LocalBranchMenuItems <LocalBranchNode>(this); AddContextMenuItems(menuBranch, _localBranchMenuItems.Select(s => s.Item), insertAfter: _menuBranchCopyContextMenuItems[1]); _remoteBranchMenuItems = new RemoteBranchMenuItems <RemoteBranchNode>(this); AddContextMenuItems(menuRemote, _remoteBranchMenuItems.Select(s => s.Item), insertAfter: toolStripSeparator1); _tagNodeMenuItems = new TagMenuItems <TagNode>(this); AddContextMenuItems(menuTag, _tagNodeMenuItems.Select(s => s.Item)); RegisterClick(mnubtnCollapseAll, () => treeMain.CollapseAll()); RegisterClick(mnubtnExpandAll, () => treeMain.ExpandAll()); RegisterClick(mnubtnMoveUp, () => ReorderTreeNode(treeMain.SelectedNode, up: true)); RegisterClick(mnubtnMoveDown, () => ReorderTreeNode(treeMain.SelectedNode, up: false)); RegisterClick <LocalBranchNode>(mnubtnFilterLocalBranchInRevisionGrid, FilterInRevisionGrid); Node.RegisterContextMenu(typeof(LocalBranchNode), menuBranch); RegisterClick <BranchPathNode>(mnubtnDeleteAllBranches, branchPath => branchPath.DeleteAll()); Node.RegisterContextMenu(typeof(BranchPathNode), menuBranchPath); RegisterClick <BranchPathNode>(mnubtnCreateBranch, branchPath => branchPath.CreateBranch()); Node.RegisterContextMenu(typeof(BranchPathNode), menuBranchPath); RegisterClick <RemoteBranchNode>(mnubtnFetchOneBranch, remoteBranch => remoteBranch.Fetch()); RegisterClick <RemoteBranchNode>(mnubtnPullFromRemoteBranch, remoteBranch => remoteBranch.FetchAndMerge()); RegisterClick <RemoteBranchNode>(mnubtnFilterRemoteBranchInRevisionGrid, FilterInRevisionGrid); RegisterClick <RemoteBranchNode>(mnubtnRemoteBranchFetchAndCheckout, remoteBranch => remoteBranch.FetchAndCheckout()); RegisterClick <RemoteBranchNode>(mnubtnFetchCreateBranch, remoteBranch => remoteBranch.FetchAndCreateBranch()); RegisterClick <RemoteBranchNode>(mnubtnFetchRebase, remoteBranch => remoteBranch.FetchAndRebase()); Node.RegisterContextMenu(typeof(RemoteBranchNode), menuRemote); RegisterClick <RemoteRepoNode>(mnubtnManageRemotes, remoteBranch => remoteBranch.PopupManageRemotesForm()); RegisterClick <RemoteRepoNode>(mnubtnFetchAllBranchesFromARemote, remote => remote.Fetch()); RegisterClick <RemoteRepoNode>(mnuBtnPruneAllBranchesFromARemote, remote => remote.Prune()); RegisterClick <RemoteRepoNode>(mnuBtnOpenRemoteUrlInBrowser, remote => remote.OpenRemoteUrlInBrowser()); RegisterClick <RemoteRepoNode>(mnubtnEnableRemote, remote => remote.Enable(fetch: false)); RegisterClick <RemoteRepoNode>(mnubtnEnableRemoteAndFetch, remote => remote.Enable(fetch: true)); RegisterClick <RemoteRepoNode>(mnubtnDisableRemote, remote => remote.Disable()); Node.RegisterContextMenu(typeof(RemoteRepoNode), menuRemoteRepoNode); Node.RegisterContextMenu(typeof(TagNode), menuTag); RegisterClick(mnuBtnManageRemotesFromRootNode, () => _remotesTree.PopupManageRemotesForm(remoteName: null)); RegisterClick(mnuBtnFetchAllRemotes, () => _remotesTree.FetchAll()); RegisterClick(mnuBtnPruneAllRemotes, () => _remotesTree.FetchPruneAll()); RegisterClick <SubmoduleNode>(mnubtnManageSubmodules, _ => _submoduleTree.ManageSubmodules(this)); RegisterClick <SubmoduleNode>(mnubtnSynchronizeSubmodules, _ => _submoduleTree.SynchronizeSubmodules(this)); RegisterClick <SubmoduleNode>(mnubtnOpenSubmodule, node => _submoduleTree.OpenSubmodule(this, node)); RegisterClick <SubmoduleNode>(mnubtnUpdateSubmodule, node => _submoduleTree.UpdateSubmodule(this, node)); Node.RegisterContextMenu(typeof(SubmoduleNode), menuSubmodule); }
public void Setup() { _onSortOrderChanged = Substitute.For <Action>(); _itemUnderTest = new GitRefsSortByContextMenuItem(_onSortOrderChanged); }