|
@@ -99,21 +99,22 @@ namespace Terra.Arbitrator.GUI
|
|
|
|
|
|
if (!_controller.IsInConflictState)
|
|
|
{
|
|
|
- var pullLabel = "Pull";
|
|
|
- if (_controller.CommitsToPull > 0)
|
|
|
- {
|
|
|
- pullLabel = $"Pull ({_controller.CommitsToPull})";
|
|
|
- }
|
|
|
+ var commitsToPull = _controller.CommitsToPull;
|
|
|
+ EditorGUI.BeginDisabledGroup(commitsToPull == 0);
|
|
|
+
|
|
|
+ var pullLabel = $"Pull ({_controller.CommitsToPull})";
|
|
|
if (GUILayout.Button(new GUIContent(pullLabel), EditorStyles.toolbarButton, GUILayout.Width(80)))
|
|
|
{
|
|
|
_controller.Pull();
|
|
|
}
|
|
|
+
|
|
|
+ EditorGUI.EndDisabledGroup();
|
|
|
}
|
|
|
- var stashSelections = _controller.Changes?.Count(c => c.IsSelectedForCommit) ?? 0;
|
|
|
- EditorGUI.BeginDisabledGroup(stashSelections == 0);
|
|
|
- if (GUILayout.Button(new GUIContent("Stash", EditorGUIUtility.IconContent("d_AlphabeticalSorting").image), EditorStyles.toolbarButton, GUILayout.Width(80)))
|
|
|
+
|
|
|
+ EditorGUI.BeginDisabledGroup(!_controller.HasStash);
|
|
|
+ if (GUILayout.Button("See Stash Changes", EditorStyles.toolbarButton, GUILayout.Width(130)))
|
|
|
{
|
|
|
- _controller.StashSelectedFiles();
|
|
|
+ _controller.ShowStashedChangesWindow();
|
|
|
}
|
|
|
EditorGUI.EndDisabledGroup();
|
|
|
|
|
@@ -129,23 +130,31 @@ namespace Terra.Arbitrator.GUI
|
|
|
}
|
|
|
|
|
|
GUILayout.FlexibleSpace();
|
|
|
-
|
|
|
- var noChanges = !_controller.Changes.Any();
|
|
|
- EditorGUI.BeginDisabledGroup(noChanges);
|
|
|
-
|
|
|
- var selectedCount = _controller.Changes.Count(c => c.IsSelectedForCommit);
|
|
|
- EditorGUI.BeginDisabledGroup(selectedCount == 0);
|
|
|
|
|
|
- var originalColor = UnityEngine.GUI.backgroundColor;
|
|
|
- UnityEngine.GUI.backgroundColor = new Color(1f, 0.5f, 0.5f, 0.8f);
|
|
|
- if (GUILayout.Button(new GUIContent($"Reset Selected ({selectedCount})", EditorGUIUtility.IconContent("d_TreeEditor.Trash").image), EditorStyles.toolbarButton, GUILayout.Width(200)))
|
|
|
+ var stashSelections = _controller.Changes?.Count(c => c.IsSelectedForCommit) ?? 0;
|
|
|
+ EditorGUI.BeginDisabledGroup(stashSelections == 0);
|
|
|
+ if (GUILayout.Button(new GUIContent("Stash", EditorGUIUtility.IconContent("d_AlphabeticalSorting").image), EditorStyles.toolbarButton, GUILayout.Width(80)))
|
|
|
{
|
|
|
- EditorApplication.delayCall += _controller.ResetSelected;
|
|
|
+ _controller.StashSelectedFiles();
|
|
|
}
|
|
|
- UnityEngine.GUI.backgroundColor = originalColor;
|
|
|
-
|
|
|
- EditorGUI.EndDisabledGroup();
|
|
|
EditorGUI.EndDisabledGroup();
|
|
|
+
|
|
|
+ var noChanges = _controller.Changes != null && !_controller.Changes.Any();
|
|
|
+ if (_controller.Changes != null)
|
|
|
+ {
|
|
|
+ var selectedCount = _controller.Changes.Count(c => c.IsSelectedForCommit);
|
|
|
+ EditorGUI.BeginDisabledGroup(selectedCount == 0 || noChanges);
|
|
|
+
|
|
|
+ var originalColor = UnityEngine.GUI.backgroundColor;
|
|
|
+ UnityEngine.GUI.backgroundColor = new Color(1f, 0.5f, 0.5f, 0.8f);
|
|
|
+ if (GUILayout.Button(new GUIContent($"Reset Selected ({selectedCount})", EditorGUIUtility.IconContent("d_TreeEditor.Trash").image), EditorStyles.toolbarButton, GUILayout.Width(200)))
|
|
|
+ {
|
|
|
+ EditorApplication.delayCall += _controller.ResetSelected;
|
|
|
+ }
|
|
|
+ UnityEngine.GUI.backgroundColor = originalColor;
|
|
|
+
|
|
|
+ EditorGUI.EndDisabledGroup();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
EditorGUI.EndDisabledGroup();
|
|
@@ -183,15 +192,6 @@ namespace Terra.Arbitrator.GUI
|
|
|
EditorGUILayout.HelpBox(_controller.InfoMessage, MessageType.Info);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private void DrawStashSection()
|
|
|
- {
|
|
|
- if (!_controller.HasStash) return;
|
|
|
- if (GUILayout.Button("See Stash Changes", GUILayout.Height(30)))
|
|
|
- {
|
|
|
- _controller.ShowStashedChangesWindow();
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
private void DrawMainContent()
|
|
|
{
|
|
@@ -218,7 +218,6 @@ namespace Terra.Arbitrator.GUI
|
|
|
{
|
|
|
DrawChangesList();
|
|
|
DrawCommitSection();
|
|
|
- DrawStashSection();
|
|
|
}
|
|
|
else if (_controller.ErrorMessage == null && _controller.InfoMessage == null)
|
|
|
{
|