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()
77
77
{
78
78
}
79
79
80
- public override void OnRepositoryChanged ( IRepository oldRepository )
81
- {
82
- base . OnRepositoryChanged ( oldRepository ) ;
83
- DetachHandlers ( oldRepository ) ;
84
- AttachHandlers ( Repository ) ;
85
- }
86
-
87
80
private void AttachHandlers ( IRepository repository )
88
81
{
89
82
if ( repository == null )
90
83
return ;
91
-
92
84
repository . OnLocalBranchListChanged += RunUpdateBranchesOnMainThread ;
93
85
repository . OnCurrentBranchChanged += HandleRepositoryBranchChangeEvent ;
94
86
repository . OnCurrentRemoteChanged += HandleRepositoryBranchChangeEvent ;
Original file line number Diff line number Diff line change @@ -38,16 +38,28 @@ public override void OnEnable()
38
38
return ;
39
39
40
40
OnStatusUpdate ( Repository . CurrentStatus ) ;
41
- Repository . OnStatusChanged += RunStatusUpdateOnMainThread ;
41
+ AttachHandlers ( Repository ) ;
42
42
Repository . Refresh ( ) ;
43
43
}
44
44
45
45
public override void OnDisable ( )
46
46
{
47
47
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 )
49
61
return ;
50
- Repository . OnStatusChanged -= RunStatusUpdateOnMainThread ;
62
+ oldRepository . OnStatusChanged -= RunStatusUpdateOnMainThread ;
51
63
}
52
64
53
65
private void RunStatusUpdateOnMainThread ( GitStatus status )
Original file line number Diff line number Diff line change @@ -81,14 +81,6 @@ public override void OnDataUpdate()
81
81
MaybeUpdateData ( ) ;
82
82
}
83
83
84
- public override void OnRepositoryChanged ( IRepository oldRepository )
85
- {
86
- base . OnRepositoryChanged ( oldRepository ) ;
87
-
88
- DetachHandlers ( oldRepository ) ;
89
- AttachHandlers ( Repository ) ;
90
- }
91
-
92
84
public override void OnSelectionChange ( )
93
85
{
94
86
Original file line number Diff line number Diff line change @@ -77,20 +77,6 @@ public override void OnDataUpdate()
77
77
MaybeUpdateData ( ) ;
78
78
}
79
79
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
-
94
80
public override void Refresh ( )
95
81
{
96
82
base . Refresh ( ) ;
@@ -106,7 +92,6 @@ private void AttachHandlers(IRepository repository)
106
92
{
107
93
if ( repository == null )
108
94
return ;
109
-
110
95
repository . OnCurrentRemoteChanged += Repository_OnActiveRemoteChanged ;
111
96
repository . OnLocksChanged += RunLocksUpdateOnMainThread ;
112
97
}
@@ -115,7 +100,6 @@ private void DetachHandlers(IRepository repository)
115
100
{
116
101
if ( repository == null )
117
102
return ;
118
-
119
103
repository . OnCurrentRemoteChanged -= Repository_OnActiveRemoteChanged ;
120
104
repository . OnLocksChanged -= RunLocksUpdateOnMainThread ;
121
105
}
Original file line number Diff line number Diff line change @@ -48,9 +48,6 @@ public virtual void Finish(bool result)
48
48
Parent . Finish ( result ) ;
49
49
}
50
50
51
- public virtual void OnRepositoryChanged ( IRepository oldRepository )
52
- { }
53
-
54
51
protected IView Parent { get ; private set ; }
55
52
public IApplicationManager Manager { get { return Parent . Manager ; } }
56
53
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)
126
126
}
127
127
128
128
UpdateActiveTab ( ) ;
129
-
130
- if ( ActiveView != null )
131
- ActiveView . OnRepositoryChanged ( oldRepository ) ;
132
-
133
129
UpdateLog ( ) ;
134
130
}
135
131
You can’t perform that action at this time.
0 commit comments