From e0aedabfc38f8c9f0b455a3cf2641724ab9e4c7e Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 27 Nov 2017 13:43:26 -0500 Subject: [PATCH 1/7] Adding a right click handler to Tree.Render(...) --- .../Editor/GitHub.Unity/UI/BranchesView.cs | 16 ++++++++++++++-- .../Assets/Editor/GitHub.Unity/UI/TreeControl.cs | 16 +++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index d38ff9fd4..8276d0d2d 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -282,7 +282,9 @@ private void OnTreeGUI(Rect rect) var treeHadFocus = treeLocals.SelectedNode != null; - rect = treeLocals.Render(rect, scroll, _ => { }, node => + rect = treeLocals.Render(rect, scroll, + node =>{ }, + node => { if (EditorUtility.DisplayDialog(ConfirmSwitchTitle, String.Format(ConfirmSwitchMessage, node.Name), ConfirmSwitchOK, ConfirmSwitchCancel)) @@ -302,6 +304,10 @@ private void OnTreeGUI(Rect rect) } }).Start(); } + }, + node => + { + Debug.Log("Right Click"); }); if (treeHadFocus && treeLocals.SelectedNode == null) @@ -316,7 +322,9 @@ private void OnTreeGUI(Rect rect) rect.y += Styles.TreePadding; - rect = treeRemotes.Render(rect, scroll, _ => {}, selectedNode => + rect = treeRemotes.Render(rect, scroll, + node => { }, + selectedNode => { var indexOfFirstSlash = selectedNode.Name.IndexOf('/'); var originName = selectedNode.Name.Substring(0, indexOfFirstSlash); @@ -355,6 +363,10 @@ private void OnTreeGUI(Rect rect) .Start(); } } + }, + node => + { + Debug.Log("Right Click"); }); if (treeHadFocus && treeRemotes.SelectedNode == null) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/TreeControl.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/TreeControl.cs index aed254212..7574c258f 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/TreeControl.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/TreeControl.cs @@ -132,7 +132,7 @@ public void Load(IEnumerable data, string title) foldersKeys = Folders.Keys.Cast().ToList(); } - public Rect Render(Rect rect, Vector2 scroll, Action singleClick = null, Action doubleClick = null) + public Rect Render(Rect rect, Vector2 scroll, Action singleClick = null, Action doubleClick = null, Action rightClick = null) { Profiler.BeginSample("TreeControl"); bool visible = true; @@ -191,7 +191,7 @@ public Rect Render(Rect rect, Vector2 scroll, Action singleClick = nul { if (visible) { - RequiresRepaint = HandleInput(rect, node, i, singleClick, doubleClick); + RequiresRepaint = HandleInput(rect, node, i, singleClick, doubleClick, rightClick); } rect.y += ItemHeight + ItemSpacing; } @@ -257,7 +257,7 @@ private int ToggleNodeVisibility(int idx, TreeNode rootNode) return idx; } - private bool HandleInput(Rect rect, TreeNode currentNode, int index, Action singleClick = null, Action doubleClick = null) + private bool HandleInput(Rect rect, TreeNode currentNode, int index, Action singleClick = null, Action doubleClick = null, Action rightClick = null) { bool selectionChanged = false; var clickRect = new Rect(0f, rect.y, rect.width, rect.height); @@ -267,14 +267,20 @@ private bool HandleInput(Rect rect, TreeNode currentNode, int index, Action 1 && doubleClick != null) + if (mouseButton == 0 && clickCount > 1 && doubleClick != null) { doubleClick(currentNode); } + if (mouseButton == 1 && clickCount == 1 && rightClick != null) + { + rightClick(currentNode); + } } // Keyboard navigation if this child is the current selection From c2a4989a4cbd880024c8f438cb411ca9605ef71a Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 27 Nov 2017 14:22:15 -0500 Subject: [PATCH 2/7] Creating a context menu for local and remote branch nodes --- .../Editor/GitHub.Unity/UI/BranchesView.cs | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index 8276d0d2d..f93c0b86a 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -305,9 +305,9 @@ private void OnTreeGUI(Rect rect) }).Start(); } }, - node => - { - Debug.Log("Right Click"); + node => { + GenericMenu menu = CreateContextMenuForLocalBranchNode(node); + menu.ShowAsContext(); }); if (treeHadFocus && treeLocals.SelectedNode == null) @@ -364,9 +364,9 @@ private void OnTreeGUI(Rect rect) } } }, - node => - { - Debug.Log("Right Click"); + node => { + GenericMenu menu = CreateContextMenuForRemoteBranchNode(node); + menu.ShowAsContext(); }); if (treeHadFocus && treeRemotes.SelectedNode == null) @@ -385,6 +385,39 @@ private void OnTreeGUI(Rect rect) GUILayout.Space(rect.y - initialRect.y); } + private GenericMenu CreateContextMenuForLocalBranchNode(TreeNode node) + { + var genericMenu = new GenericMenu(); + + var deleteGuiContent = new GUIContent("Delete"); + var switchGuiContent = new GUIContent("Switch"); + + if (node.IsActive) + { + genericMenu.AddDisabledItem(deleteGuiContent); + genericMenu.AddDisabledItem(switchGuiContent); + } + else + { + genericMenu.AddItem(deleteGuiContent, false, (userData) => { + Debug.Log("Delete Branch"); + }, node); + + genericMenu.AddItem(switchGuiContent, false, (userData) => { + Debug.Log("Switch Branch"); + }, node); + } + + return genericMenu; + } + + private GenericMenu CreateContextMenuForRemoteBranchNode(TreeNode node) + { + var genericMenu = new GenericMenu(); + + return genericMenu; + } + private int CompareBranches(GitBranch a, GitBranch b) { //if (IsFavorite(a.Name)) From a22725fa51a82289642ea0916a18250880190cf1 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 27 Nov 2017 15:05:31 -0500 Subject: [PATCH 3/7] Adding right click handlers for delete/create branch functionality --- .../Editor/GitHub.Unity/UI/BranchesView.cs | 71 ++++++++++--------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index f93c0b86a..06a5b036a 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -163,12 +163,7 @@ private void OnButtonBarGUI() { if (GUILayout.Button(DeleteBranchButton, EditorStyles.miniButton, GUILayout.ExpandWidth(false))) { - var selectedBranchName = treeLocals.SelectedNode.Name; - var dialogMessage = string.Format(DeleteBranchMessageFormatString, selectedBranchName); - if (EditorUtility.DisplayDialog(DeleteBranchTitle, dialogMessage, DeleteBranchButton, CancelButtonLabel)) - { - GitClient.DeleteBranch(selectedBranchName, true).Start(); - } + DeleteLocalBranch(treeLocals.SelectedNode.Name); } } EditorGUI.EndDisabledGroup(); @@ -284,29 +279,11 @@ private void OnTreeGUI(Rect rect) rect = treeLocals.Render(rect, scroll, node =>{ }, - node => - { - if (EditorUtility.DisplayDialog(ConfirmSwitchTitle, String.Format(ConfirmSwitchMessage, node.Name), ConfirmSwitchOK, - ConfirmSwitchCancel)) - { - GitClient.SwitchBranch(node.Name) - .FinallyInUI((success, e) => - { - if (success) - { - Redraw(); - } - else - { - EditorUtility.DisplayDialog(Localization.SwitchBranchTitle, - String.Format(Localization.SwitchBranchFailedDescription, node.Name), - Localization.Ok); - } - }).Start(); - } + node => { + SwitchBranch(node.Name); }, node => { - GenericMenu menu = CreateContextMenuForLocalBranchNode(node); + var menu = CreateContextMenuForLocalBranchNode(node); menu.ShowAsContext(); }); @@ -399,18 +376,46 @@ private GenericMenu CreateContextMenuForLocalBranchNode(TreeNode node) } else { - genericMenu.AddItem(deleteGuiContent, false, (userData) => { - Debug.Log("Delete Branch"); - }, node); + genericMenu.AddItem(deleteGuiContent, false, () => { + DeleteLocalBranch(node.Name); + }); - genericMenu.AddItem(switchGuiContent, false, (userData) => { - Debug.Log("Switch Branch"); - }, node); + genericMenu.AddItem(switchGuiContent, false, () => { + SwitchBranch(node.Name); + }); } return genericMenu; } + private void SwitchBranch(string branchName) + { + if (EditorUtility.DisplayDialog(ConfirmSwitchTitle, String.Format(ConfirmSwitchMessage, branchName), ConfirmSwitchOK, + ConfirmSwitchCancel)) + { + GitClient.SwitchBranch(branchName).FinallyInUI((success, e) => { + if (success) + { + Redraw(); + } + else + { + EditorUtility.DisplayDialog(Localization.SwitchBranchTitle, + String.Format(Localization.SwitchBranchFailedDescription, branchName), Localization.Ok); + } + }).Start(); + } + } + + private void DeleteLocalBranch(string branchName) + { + var dialogMessage = string.Format(DeleteBranchMessageFormatString, branchName); + if (EditorUtility.DisplayDialog(DeleteBranchTitle, dialogMessage, DeleteBranchButton, CancelButtonLabel)) + { + GitClient.DeleteBranch(branchName, true).Start(); + } + } + private GenericMenu CreateContextMenuForRemoteBranchNode(TreeNode node) { var genericMenu = new GenericMenu(); From b112b6a72c822fd3c4fc189b009bc77aaffb7dbd Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 27 Nov 2017 15:23:13 -0500 Subject: [PATCH 4/7] Adding functionality to checkout a remote branch via right click --- .../Editor/GitHub.Unity/UI/BranchesView.cs | 81 ++++++++++--------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index 06a5b036a..9273b5f2c 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -301,45 +301,8 @@ private void OnTreeGUI(Rect rect) rect = treeRemotes.Render(rect, scroll, node => { }, - selectedNode => - { - var indexOfFirstSlash = selectedNode.Name.IndexOf('/'); - var originName = selectedNode.Name.Substring(0, indexOfFirstSlash); - var branchName = selectedNode.Name.Substring(indexOfFirstSlash + 1); - - if (Repository.LocalBranches.Any(localBranch => localBranch.Name == branchName)) - { - EditorUtility.DisplayDialog(WarningCheckoutBranchExistsTitle, - String.Format(WarningCheckoutBranchExistsMessage, branchName), - WarningCheckoutBranchExistsOK); - } - else - { - var confirmCheckout = EditorUtility.DisplayDialog(ConfirmCheckoutBranchTitle, - String.Format(ConfirmCheckoutBranchMessage, selectedNode.Name, originName), - ConfirmCheckoutBranchOK, - ConfirmCheckoutBranchCancel); - - if (confirmCheckout) - { - GitClient - .CreateBranch(branchName, selectedNode.Name) - .FinallyInUI((success, e) => - { - if (success) - { - Redraw(); - } - else - { - EditorUtility.DisplayDialog(Localization.SwitchBranchTitle, - String.Format(Localization.SwitchBranchFailedDescription, selectedNode.Name), - Localization.Ok); - } - }) - .Start(); - } - } + selectedNode => { + CheckoutRemoteBranch(selectedNode.Name); }, node => { GenericMenu menu = CreateContextMenuForRemoteBranchNode(node); @@ -362,6 +325,40 @@ private void OnTreeGUI(Rect rect) GUILayout.Space(rect.y - initialRect.y); } + private void CheckoutRemoteBranch(string selectedNodeName) + { + var indexOfFirstSlash = selectedNodeName.IndexOf('/'); + var originName = selectedNodeName.Substring(0, indexOfFirstSlash); + var branchName = selectedNodeName.Substring(indexOfFirstSlash + 1); + + if (Repository.LocalBranches.Any(localBranch => localBranch.Name == branchName)) + { + EditorUtility.DisplayDialog(WarningCheckoutBranchExistsTitle, + String.Format(WarningCheckoutBranchExistsMessage, branchName), WarningCheckoutBranchExistsOK); + } + else + { + var confirmCheckout = EditorUtility.DisplayDialog(ConfirmCheckoutBranchTitle, + String.Format(ConfirmCheckoutBranchMessage, selectedNodeName, originName), ConfirmCheckoutBranchOK, + ConfirmCheckoutBranchCancel); + + if (confirmCheckout) + { + GitClient.CreateBranch(branchName, selectedNodeName).FinallyInUI((success, e) => { + if (success) + { + Redraw(); + } + else + { + EditorUtility.DisplayDialog(Localization.SwitchBranchTitle, + String.Format(Localization.SwitchBranchFailedDescription, selectedNodeName), Localization.Ok); + } + }).Start(); + } + } + } + private GenericMenu CreateContextMenuForLocalBranchNode(TreeNode node) { var genericMenu = new GenericMenu(); @@ -420,6 +417,12 @@ private GenericMenu CreateContextMenuForRemoteBranchNode(TreeNode node) { var genericMenu = new GenericMenu(); + var checkoutGuiContent = new GUIContent("Checkout"); + + genericMenu.AddItem(checkoutGuiContent, false, () => { + CheckoutRemoteBranch(node.Name); + }); + return genericMenu; } From a5bc4b2049fc4e588ae6b8c2e44b12d3b903e663 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 27 Nov 2017 17:06:57 -0500 Subject: [PATCH 5/7] Preventing double and right click functionality on branch folders --- .../Editor/GitHub.Unity/UI/BranchesView.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index 9273b5f2c..3eb8ecf5c 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -280,9 +280,15 @@ private void OnTreeGUI(Rect rect) rect = treeLocals.Render(rect, scroll, node =>{ }, node => { + if (node.IsFolder) + return; + SwitchBranch(node.Name); }, node => { + if (node.IsFolder) + return; + var menu = CreateContextMenuForLocalBranchNode(node); menu.ShowAsContext(); }); @@ -301,11 +307,17 @@ private void OnTreeGUI(Rect rect) rect = treeRemotes.Render(rect, scroll, node => { }, - selectedNode => { - CheckoutRemoteBranch(selectedNode.Name); + node => { + if (node.IsFolder) + return; + + CheckoutRemoteBranch(node.Name); }, node => { - GenericMenu menu = CreateContextMenuForRemoteBranchNode(node); + if (node.IsFolder) + return; + + var menu = CreateContextMenuForRemoteBranchNode(node); menu.ShowAsContext(); }); From 1ac71e878c0d0102bceeec9e809c78c2d050e510 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Wed, 29 Nov 2017 11:18:31 -0500 Subject: [PATCH 6/7] Some code cleanup --- .../Editor/GitHub.Unity/UI/BranchesView.cs | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index 3c5228936..ea149e28a 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -333,11 +333,50 @@ private void OnTreeGUI(Rect rect) GUILayout.Space(rect.y - initialRect.y); } - private void CheckoutRemoteBranch(string selectedNodeName) + private GenericMenu CreateContextMenuForLocalBranchNode(TreeNode node) + { + var genericMenu = new GenericMenu(); + + var deleteGuiContent = new GUIContent("Delete"); + var switchGuiContent = new GUIContent("Switch"); + + if (node.IsActive) + { + genericMenu.AddDisabledItem(deleteGuiContent); + genericMenu.AddDisabledItem(switchGuiContent); + } + else + { + genericMenu.AddItem(deleteGuiContent, false, () => { + DeleteLocalBranch(node.Name); + }); + + genericMenu.AddItem(switchGuiContent, false, () => { + SwitchBranch(node.Name); + }); + } + + return genericMenu; + } + + private GenericMenu CreateContextMenuForRemoteBranchNode(TreeNode node) + { + var genericMenu = new GenericMenu(); + + var checkoutGuiContent = new GUIContent("Checkout"); + + genericMenu.AddItem(checkoutGuiContent, false, () => { + CheckoutRemoteBranch(node.Name); + }); + + return genericMenu; + } + + private void CheckoutRemoteBranch(string branch) { - var indexOfFirstSlash = selectedNodeName.IndexOf('/'); - var originName = selectedNodeName.Substring(0, indexOfFirstSlash); - var branchName = selectedNodeName.Substring(indexOfFirstSlash + 1); + var indexOfFirstSlash = branch.IndexOf('/'); + var originName = branch.Substring(0, indexOfFirstSlash); + var branchName = branch.Substring(indexOfFirstSlash + 1); if (Repository.LocalBranches.Any(localBranch => localBranch.Name == branchName)) { @@ -347,12 +386,12 @@ private void CheckoutRemoteBranch(string selectedNodeName) else { var confirmCheckout = EditorUtility.DisplayDialog(ConfirmCheckoutBranchTitle, - String.Format(ConfirmCheckoutBranchMessage, selectedNodeName, originName), ConfirmCheckoutBranchOK, + String.Format(ConfirmCheckoutBranchMessage, branch, originName), ConfirmCheckoutBranchOK, ConfirmCheckoutBranchCancel); if (confirmCheckout) { - GitClient.CreateBranch(branchName, selectedNodeName).FinallyInUI((success, e) => { + GitClient.CreateBranch(branchName, branch).FinallyInUI((success, e) => { if (success) { Redraw(); @@ -360,45 +399,19 @@ private void CheckoutRemoteBranch(string selectedNodeName) else { EditorUtility.DisplayDialog(Localization.SwitchBranchTitle, - String.Format(Localization.SwitchBranchFailedDescription, selectedNodeName), Localization.Ok); + String.Format(Localization.SwitchBranchFailedDescription, branch), Localization.Ok); } }).Start(); } } } - private GenericMenu CreateContextMenuForLocalBranchNode(TreeNode node) + private void SwitchBranch(string branch) { - var genericMenu = new GenericMenu(); - - var deleteGuiContent = new GUIContent("Delete"); - var switchGuiContent = new GUIContent("Switch"); - - if (node.IsActive) - { - genericMenu.AddDisabledItem(deleteGuiContent); - genericMenu.AddDisabledItem(switchGuiContent); - } - else - { - genericMenu.AddItem(deleteGuiContent, false, () => { - DeleteLocalBranch(node.Name); - }); - - genericMenu.AddItem(switchGuiContent, false, () => { - SwitchBranch(node.Name); - }); - } - - return genericMenu; - } - - private void SwitchBranch(string branchName) - { - if (EditorUtility.DisplayDialog(ConfirmSwitchTitle, String.Format(ConfirmSwitchMessage, branchName), ConfirmSwitchOK, + if (EditorUtility.DisplayDialog(ConfirmSwitchTitle, String.Format(ConfirmSwitchMessage, branch), ConfirmSwitchOK, ConfirmSwitchCancel)) { - GitClient.SwitchBranch(branchName).FinallyInUI((success, e) => { + GitClient.SwitchBranch(branch).FinallyInUI((success, e) => { if (success) { Redraw(); @@ -406,34 +419,21 @@ private void SwitchBranch(string branchName) else { EditorUtility.DisplayDialog(Localization.SwitchBranchTitle, - String.Format(Localization.SwitchBranchFailedDescription, branchName), Localization.Ok); + String.Format(Localization.SwitchBranchFailedDescription, branch), Localization.Ok); } }).Start(); } } - private void DeleteLocalBranch(string branchName) + private void DeleteLocalBranch(string branch) { - var dialogMessage = string.Format(DeleteBranchMessageFormatString, branchName); + var dialogMessage = string.Format(DeleteBranchMessageFormatString, branch); if (EditorUtility.DisplayDialog(DeleteBranchTitle, dialogMessage, DeleteBranchButton, CancelButtonLabel)) { - GitClient.DeleteBranch(branchName, true).Start(); + GitClient.DeleteBranch(branch, true).Start(); } } - private GenericMenu CreateContextMenuForRemoteBranchNode(TreeNode node) - { - var genericMenu = new GenericMenu(); - - var checkoutGuiContent = new GUIContent("Checkout"); - - genericMenu.AddItem(checkoutGuiContent, false, () => { - CheckoutRemoteBranch(node.Name); - }); - - return genericMenu; - } - private int CompareBranches(GitBranch a, GitBranch b) { if (a.Name.Equals("master")) From daa4ef65e06bcabc02600467ed819bc7a209888f Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Wed, 29 Nov 2017 11:21:25 -0500 Subject: [PATCH 7/7] Making constants out of context menu items labels --- .../Assets/Editor/GitHub.Unity/UI/BranchesView.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index ea149e28a..f365d4145 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -32,6 +32,9 @@ class BranchesView : Subview private const string DeleteBranchTitle = "Delete Branch?"; private const string DeleteBranchButton = "Delete"; private const string CancelButtonLabel = "Cancel"; + private const string DeleteBranchContextMenuLabel = "Delete"; + private const string SwitchBranchContextMenuLabel = "Switch"; + private const string CheckoutBranchContextMenuLabel = "Checkout"; [NonSerialized] private int listID = -1; [NonSerialized] private BranchesMode targetMode; @@ -337,8 +340,8 @@ private GenericMenu CreateContextMenuForLocalBranchNode(TreeNode node) { var genericMenu = new GenericMenu(); - var deleteGuiContent = new GUIContent("Delete"); - var switchGuiContent = new GUIContent("Switch"); + var deleteGuiContent = new GUIContent(DeleteBranchContextMenuLabel); + var switchGuiContent = new GUIContent(SwitchBranchContextMenuLabel); if (node.IsActive) { @@ -363,7 +366,7 @@ private GenericMenu CreateContextMenuForRemoteBranchNode(TreeNode node) { var genericMenu = new GenericMenu(); - var checkoutGuiContent = new GUIContent("Checkout"); + var checkoutGuiContent = new GUIContent(CheckoutBranchContextMenuLabel); genericMenu.AddItem(checkoutGuiContent, false, () => { CheckoutRemoteBranch(node.Name);