|
@@ -4,6 +4,7 @@
|
|
|
// responsibility is to draw the UI based on the state provided by the
|
|
|
// ArbitratorController.
|
|
|
|
|
|
+using System;
|
|
|
using System.Linq;
|
|
|
using UnityEngine;
|
|
|
using UnityEditor;
|
|
@@ -12,6 +13,9 @@ namespace Terra.Arbitrator.GUI
|
|
|
{
|
|
|
public class ArbitratorWindow : EditorWindow
|
|
|
{
|
|
|
+ private const string DockNextTo = "UnityEditor.GameView,UnityEditor.dll";
|
|
|
+ internal static ArbitratorWindow Instance { get; private set; }
|
|
|
+
|
|
|
private ArbitratorController _controller;
|
|
|
private string _commitMessage = "";
|
|
|
private Vector2 _scrollPosition;
|
|
@@ -21,12 +25,15 @@ namespace Terra.Arbitrator.GUI
|
|
|
[MenuItem("Version Control/Better Git")]
|
|
|
public static void ShowWindow()
|
|
|
{
|
|
|
- var window = GetWindow<ArbitratorWindow>();
|
|
|
+ var type = Type.GetType(DockNextTo);
|
|
|
+ var window = GetWindow<ArbitratorWindow>(type);
|
|
|
window.titleContent = new GUIContent("Better Git", EditorGUIUtility.IconContent("d_UnityEditor.VersionControl").image);
|
|
|
}
|
|
|
|
|
|
private void OnEnable()
|
|
|
{
|
|
|
+ Instance = this;
|
|
|
+
|
|
|
_controller = new ArbitratorController(
|
|
|
requestRepaint: Repaint,
|
|
|
displayDialog: EditorUtility.DisplayDialog,
|
|
@@ -35,7 +42,12 @@ namespace Terra.Arbitrator.GUI
|
|
|
|
|
|
_controller.OnEnable();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ private void OnDisable()
|
|
|
+ {
|
|
|
+ Instance = null;
|
|
|
+ }
|
|
|
+
|
|
|
private void InitializeStyles()
|
|
|
{
|
|
|
if (_stylesInitialized) return;
|
|
@@ -189,7 +201,7 @@ namespace Terra.Arbitrator.GUI
|
|
|
DrawChangesList();
|
|
|
DrawCommitSection();
|
|
|
}
|
|
|
- else
|
|
|
+ else if (_controller.ErrorMessage == null)
|
|
|
{
|
|
|
EditorGUILayout.HelpBox("You are up-to-date! No local changes detected.", MessageType.Info);
|
|
|
}
|