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

Commit bcca940

Browse files
donokudashana
authored andcommitted
Enable delete button based on selected branch state
Not perfect yet
1 parent 48df3bb commit bcca940

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,16 @@ private void OnCreateGUI()
436436
// Create button
437437
if (mode == BranchesMode.Default)
438438
{
439+
// If the current branch is selected, then do not enable the Delete button
440+
GUI.enabled = activeBranchNode != selectedNode;
439441
if (GUILayout.Button("Delete", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
440442
{
441-
EditorUtility.DisplayDialog("Delete Branch?", "Are you sure you want to delete the branch: BRANCHNAME", "Delete", "Cancel");
443+
var selectedBranchName = selectedNode.Name;
444+
var dialogTitle = "Delete Branch: " + selectedBranchName;
445+
var dialogMessage = "Are you sure you want to delete the branch: " + selectedBranchName + "?";
446+
EditorUtility.DisplayDialog("Delete Branch?", dialogMessage, "Delete", "Cancel");
442447
}
448+
GUI.enabled = true;
443449
GUILayout.FlexibleSpace();
444450
if (GUILayout.Button(CreateBranchButton, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
445451
{

0 commit comments

Comments
 (0)