This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +15
-42
lines changed
src/UnityExtension/Assets/Editor/GitHub.Unity/UI Expand file tree Collapse file tree 6 files changed +15
-42
lines changed Original file line number Diff line number Diff line change @@ -77,18 +77,10 @@ private void MaybeUpdateData()
7777 {
7878 }
7979
80- public override void OnRepositoryChanged ( IRepository oldRepository )
81- {
82- base . OnRepositoryChanged ( oldRepository ) ;
83- DetachHandlers ( oldRepository ) ;
84- AttachHandlers ( Repository ) ;
85- }
86-
8780 private void AttachHandlers ( IRepository repository )
8881 {
8982 if ( repository == null )
9083 return ;
91-
9284 repository . OnLocalBranchListChanged += RunUpdateBranchesOnMainThread ;
9385 repository . OnCurrentBranchChanged += HandleRepositoryBranchChangeEvent ;
9486 repository . OnCurrentRemoteChanged += HandleRepositoryBranchChangeEvent ;
Original file line number Diff line number Diff line change @@ -38,16 +38,28 @@ public override void OnEnable()
3838 return ;
3939
4040 OnStatusUpdate ( Repository . CurrentStatus ) ;
41- Repository . OnStatusChanged += RunStatusUpdateOnMainThread ;
41+ AttachHandlers ( Repository ) ;
4242 Repository . Refresh ( ) ;
4343 }
4444
4545 public override void OnDisable ( )
4646 {
4747 base . OnDisable ( ) ;
48- if ( Repository == null )
48+ DetachHandlers ( Repository ) ;
49+ }
50+
51+ private void AttachHandlers ( IRepository repository )
52+ {
53+ if ( repository == null )
54+ return ;
55+ repository . OnStatusChanged += RunStatusUpdateOnMainThread ;
56+ }
57+
58+ private void DetachHandlers ( IRepository oldRepository )
59+ {
60+ if ( oldRepository == null )
4961 return ;
50- Repository . OnStatusChanged -= RunStatusUpdateOnMainThread ;
62+ oldRepository . OnStatusChanged -= RunStatusUpdateOnMainThread ;
5163 }
5264
5365 private void RunStatusUpdateOnMainThread ( GitStatus status )
Original file line number Diff line number Diff line change @@ -81,14 +81,6 @@ public override void OnDataUpdate()
8181 MaybeUpdateData ( ) ;
8282 }
8383
84- public override void OnRepositoryChanged ( IRepository oldRepository )
85- {
86- base . OnRepositoryChanged ( oldRepository ) ;
87-
88- DetachHandlers ( oldRepository ) ;
89- AttachHandlers ( Repository ) ;
90- }
91-
9284 public override void OnSelectionChange ( )
9385 {
9486
Original file line number Diff line number Diff line change @@ -77,20 +77,6 @@ public override void OnDataUpdate()
7777 MaybeUpdateData ( ) ;
7878 }
7979
80- public override void OnRepositoryChanged ( IRepository oldRepository )
81- {
82- base . OnRepositoryChanged ( oldRepository ) ;
83- gitPathView . OnRepositoryChanged ( oldRepository ) ;
84- userSettingsView . OnRepositoryChanged ( oldRepository ) ;
85-
86- DetachHandlers ( oldRepository ) ;
87- AttachHandlers ( Repository ) ;
88-
89- remoteHasChanged = true ;
90-
91- Refresh ( ) ;
92- }
93-
9480 public override void Refresh ( )
9581 {
9682 base . Refresh ( ) ;
@@ -106,7 +92,6 @@ private void AttachHandlers(IRepository repository)
10692 {
10793 if ( repository == null )
10894 return ;
109-
11095 repository . OnCurrentRemoteChanged += Repository_OnActiveRemoteChanged ;
11196 repository . OnLocksChanged += RunLocksUpdateOnMainThread ;
11297 }
@@ -115,7 +100,6 @@ private void DetachHandlers(IRepository repository)
115100 {
116101 if ( repository == null )
117102 return ;
118-
119103 repository . OnCurrentRemoteChanged -= Repository_OnActiveRemoteChanged ;
120104 repository . OnLocksChanged -= RunLocksUpdateOnMainThread ;
121105 }
Original file line number Diff line number Diff line change @@ -48,9 +48,6 @@ public virtual void Finish(bool result)
4848 Parent . Finish ( result ) ;
4949 }
5050
51- public virtual void OnRepositoryChanged ( IRepository oldRepository )
52- { }
53-
5451 protected IView Parent { get ; private set ; }
5552 public IApplicationManager Manager { get { return Parent . Manager ; } }
5653 public IRepository Repository { get { return Parent . Repository ; } }
Original file line number Diff line number Diff line change @@ -126,10 +126,6 @@ public override void OnRepositoryChanged(IRepository oldRepository)
126126 }
127127
128128 UpdateActiveTab ( ) ;
129-
130- if ( ActiveView != null )
131- ActiveView . OnRepositoryChanged ( oldRepository ) ;
132-
133129 UpdateLog ( ) ;
134130 }
135131
You can’t perform that action at this time.
0 commit comments