Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Del key to RepoObjectsTree nodes #9630

Merged
merged 1 commit into from
Oct 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions GitUI/BranchTreePanel/ContextMenu/MenuItemsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ private IEnumerable<ToolStripItemWithKey> CreateDelete()
{
if (Implements<ICanDelete>())
{
yield return _menuItemFactory.CreateMenuItem<ToolStripMenuItem, TNode>(
node => ((ICanDelete)node).Delete(), Strings.Delete, GetTooltip(MenuItemKey.Delete), Properties.Images.BranchDelete)
.WithKey(MenuItemKey.Delete);
ToolStripMenuItem item = _menuItemFactory.CreateMenuItem<ToolStripMenuItem, TNode>(
node => ((ICanDelete)node).Delete(), Strings.Delete, GetTooltip(MenuItemKey.Delete), Properties.Images.BranchDelete);
item.ShortcutKeys = Keys.Delete;
yield return item.WithKey(MenuItemKey.Delete);
}
}

Expand Down
5 changes: 5 additions & 0 deletions GitUI/BranchTreePanel/RepoObjectsTree.LocalBranchNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ internal override void OnRename()
Rename();
}

internal override void OnDelete()
{
Delete();
}

public bool Checkout()
{
return UICommands.StartCheckoutBranch(ParentWindow(), branch: FullPath, remote: false);
Expand Down
5 changes: 5 additions & 0 deletions GitUI/BranchTreePanel/RepoObjectsTree.Nodes.Tags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ internal override void OnDoubleClick()
CreateBranch();
}

internal override void OnDelete()
{
Delete();
}

public bool CreateBranch()
{
return UICommands.StartCreateBranchDialog(TreeViewNode.TreeView, ObjectId);
Expand Down
4 changes: 4 additions & 0 deletions GitUI/BranchTreePanel/RepoObjectsTree.Nodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,10 @@ internal virtual void OnRename()
{
}

internal virtual void OnDelete()
{
}

public static Node GetNode(TreeNode treeNode)
{
return (Node)treeNode.Tag;
Expand Down
5 changes: 5 additions & 0 deletions GitUI/BranchTreePanel/RepoObjectsTree.RemoteBranchNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ private RemoteBranchInfo GetRemoteBranchInfo()
return new RemoteBranchInfo(remote, branch);
}

internal override void OnDelete()
{
Delete();
}

public bool CreateBranch()
{
return UICommands.StartCreateBranchDialog(TreeViewNode.TreeView, FullPath);
Expand Down
3 changes: 3 additions & 0 deletions GitUI/BranchTreePanel/RepoObjectsTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ private void OnPreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
case Keys.F3:
OnBtnSearchClicked(this, EventArgs.Empty);
break;
case Keys.Delete:
Node.OnNode<Node>(treeMain.SelectedNode, node => node.OnDelete());
break;
}
}

Expand Down