Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,23 @@ private void OnCreateGUI()
// Create button
if (mode == BranchesMode.Default)
{
// If the current branch is selected, then do not enable the Delete button
var disableDelete = activeBranchNode == selectedNode;
EditorGUI.BeginDisabledGroup(disableDelete);
{
if (GUILayout.Button("Delete", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
{
var selectedBranchName = selectedNode.Name;
var dialogTitle = "Delete Branch: " + selectedBranchName;
var dialogMessage = "Are you sure you want to delete the branch: " + selectedBranchName + "?";
if (EditorUtility.DisplayDialog("Delete Branch?", dialogMessage, "Delete", "Cancel"))
{
GitClient.DeleteBranch(selectedBranchName, true).Start();
}
}
}
EditorGUI.EndDisabledGroup();

GUILayout.FlexibleSpace();
if (GUILayout.Button(CreateBranchButton, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
{
Expand Down