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

Commit 199482f

Browse files
donokudashana
authored andcommitted
Move everything into a BeginDisabledGroup
1 parent bcca940 commit 199482f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,15 +437,19 @@ private void OnCreateGUI()
437437
if (mode == BranchesMode.Default)
438438
{
439439
// If the current branch is selected, then do not enable the Delete button
440-
GUI.enabled = activeBranchNode != selectedNode;
441-
if (GUILayout.Button("Delete", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
440+
var disableDelete = activeBranchNode == selectedNode;
441+
EditorGUI.BeginDisabledGroup(disableDelete);
442442
{
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");
443+
if (GUILayout.Button("Delete", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
444+
{
445+
var selectedBranchName = selectedNode.Name;
446+
var dialogTitle = "Delete Branch: " + selectedBranchName;
447+
var dialogMessage = "Are you sure you want to delete the branch: " + selectedBranchName + "?";
448+
EditorUtility.DisplayDialog("Delete Branch?", dialogMessage, "Delete", "Cancel");
449+
}
447450
}
448-
GUI.enabled = true;
451+
EditorGUI.EndDisabledGroup();
452+
449453
GUILayout.FlexibleSpace();
450454
if (GUILayout.Button(CreateBranchButton, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
451455
{

0 commit comments

Comments
 (0)