Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit b00cf5e

Browse files
Adding constants for string fields
1 parent 8af82db commit b00cf5e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class BranchesView : Subview
1414
private const string ConfirmSwitchTitle = "Confirm branch switch";
1515
private const string ConfirmSwitchMessage = "Switch branch to {0}?";
1616
private const string ConfirmSwitchOK = "Switch";
17-
private const string ConfirmSwitchCancel = "Cancel";
17+
private const string ConfirmSwitchCancel = CancelButtonLabel;
1818
private const string NewBranchCancelButton = "x";
1919
private const string NewBranchConfirmButton = "Create";
2020
private const string FavoritesSetting = "Favorites";
@@ -23,6 +23,10 @@ class BranchesView : Subview
2323
private const string LocalTitle = "Local branches";
2424
private const string RemoteTitle = "Remote branches";
2525
private const string CreateBranchButton = "New Branch";
26+
private const string DeleteBranchMessageFormatString = "Are you sure you want to delete the branch: {0}?";
27+
private const string DeleteBranchTitle = "Delete Branch?";
28+
private const string DeleteBranchButton = "Delete";
29+
private const string CancelButtonLabel = "Cancel";
2630

2731
private bool showLocalBranches = true;
2832
private bool showRemoteBranches = true;
@@ -460,12 +464,11 @@ private void OnButtonBarGUI()
460464
var disableDelete = activeBranchNode == selectedNode;
461465
EditorGUI.BeginDisabledGroup(disableDelete);
462466
{
463-
if (GUILayout.Button("Delete", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
467+
if (GUILayout.Button(DeleteBranchButton, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
464468
{
465469
var selectedBranchName = selectedNode.Name;
466-
var dialogTitle = "Delete Branch: " + selectedBranchName;
467-
var dialogMessage = "Are you sure you want to delete the branch: " + selectedBranchName + "?";
468-
if (EditorUtility.DisplayDialog("Delete Branch?", dialogMessage, "Delete", "Cancel"))
470+
var dialogMessage = string.Format(DeleteBranchMessageFormatString, selectedBranchName);
471+
if (EditorUtility.DisplayDialog(DeleteBranchTitle, dialogMessage, DeleteBranchButton, CancelButtonLabel))
469472
{
470473
GitClient.DeleteBranch(selectedBranchName, true).Start();
471474
}

0 commit comments

Comments
 (0)