From 28851ccf4759abd33e6c0b780ed33c1e98b521b1 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 12 Sep 2017 10:48:23 -0400 Subject: [PATCH 1/6] Connecting the ListLocks task --- src/GitHub.Api/Git/RepositoryManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GitHub.Api/Git/RepositoryManager.cs b/src/GitHub.Api/Git/RepositoryManager.cs index f2d45687c..0caf78850 100644 --- a/src/GitHub.Api/Git/RepositoryManager.cs +++ b/src/GitHub.Api/Git/RepositoryManager.cs @@ -312,16 +312,16 @@ public ITask LockFile(string file) { var task = GitClient.Lock(file); HookupHandlers(task); - ListLocks(false); - return task; + + return task.Then(ListLocks(false)); } public ITask UnlockFile(string file, bool force) { var task = GitClient.Unlock(file, force); HookupHandlers(task).Schedule(taskManager); - ListLocks(false); - return task; + + return task.Then(ListLocks(false)); } private void LoadGitUser() From 0f33fe65dba0cd73206692e87a82cde0ea5c3453 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 12 Sep 2017 11:00:49 -0400 Subject: [PATCH 2/6] Missing refresh --- .../Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs index 52b29ea13..95f7e8036 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs @@ -169,6 +169,8 @@ private static void OnLocksUpdate(IEnumerable update) var g = AssetDatabase.AssetPathToGUID(assetPath); guidsLocks.Add(g); } + + EditorApplication.RepaintProjectWindow(); } private static void RunStatusUpdateOnMainThread(GitStatus update) From 5364f4f37bfa20a2198cbdfc46e54618fcfedef7 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 12 Sep 2017 11:01:11 -0400 Subject: [PATCH 3/6] Adding some logging --- .../Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs index 95f7e8036..8ceaefcb2 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs @@ -22,6 +22,8 @@ class ProjectWindowInterface : AssetPostprocessor public static void Initialize(IRepository repo) { + Logger.Trace("Initialize HasRespository:{0}", repo != null); + EditorApplication.projectWindowItemOnGUI -= OnProjectWindowItemGUI; EditorApplication.projectWindowItemOnGUI += OnProjectWindowItemGUI; initialized = true; From 9c52781d810deb9cb91190438703d1300138e121 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 12 Sep 2017 11:01:17 -0400 Subject: [PATCH 4/6] Refactoring --- .../Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs index 8ceaefcb2..30765244a 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs @@ -177,7 +177,8 @@ private static void OnLocksUpdate(IEnumerable update) private static void RunStatusUpdateOnMainThread(GitStatus update) { - EntryPoint.ApplicationManager.TaskManager.ScheduleUI(new ActionTask(EntryPoint.ApplicationManager.TaskManager.Token, _ => OnStatusUpdate(update))); + new ActionTask(EntryPoint.ApplicationManager.TaskManager.Token, _ => OnStatusUpdate(update)) + .ScheduleUI(EntryPoint.ApplicationManager.TaskManager); } private static void OnStatusUpdate(GitStatus update) From f710ae7e5beb1ea295edcf09911200a43e449ec7 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 12 Sep 2017 14:48:58 -0400 Subject: [PATCH 5/6] Fixing mispelling --- .../Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs index 30765244a..2018f1350 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs @@ -22,7 +22,7 @@ class ProjectWindowInterface : AssetPostprocessor public static void Initialize(IRepository repo) { - Logger.Trace("Initialize HasRespository:{0}", repo != null); + Logger.Trace("Initialize HasRepository:{0}", repo != null); EditorApplication.projectWindowItemOnGUI -= OnProjectWindowItemGUI; EditorApplication.projectWindowItemOnGUI += OnProjectWindowItemGUI; From d873e680e2d72fc5edce745f51a1866a5317cfc8 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 12 Sep 2017 15:02:02 -0400 Subject: [PATCH 6/6] Refactoring task calls --- .../Editor/GitHub.Unity/UI/ProjectWindowInterface.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs index 2018f1350..cef86203e 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ProjectWindowInterface.cs @@ -151,7 +151,9 @@ private static void Refresh() private static void RunLocksUpdateOnMainThread(IEnumerable update) { new ActionTask(EntryPoint.ApplicationManager.TaskManager.Token, _ => OnLocksUpdate(update)) - .ScheduleUI(EntryPoint.ApplicationManager.TaskManager); + { + Affinity = TaskAffinity.UI + }.Start(); } private static void OnLocksUpdate(IEnumerable update) @@ -178,7 +180,9 @@ private static void OnLocksUpdate(IEnumerable update) private static void RunStatusUpdateOnMainThread(GitStatus update) { new ActionTask(EntryPoint.ApplicationManager.TaskManager.Token, _ => OnStatusUpdate(update)) - .ScheduleUI(EntryPoint.ApplicationManager.TaskManager); + { + Affinity = TaskAffinity.UI + }.Start(); } private static void OnStatusUpdate(GitStatus update)