@@ -31,7 +31,7 @@ namespace GitScc
31
31
[ MsVsShell . ProvideOptionPageAttribute ( typeof ( SccProviderOptions ) , "Source Control" , "Git Source Control Provider Options" , 106 , 107 , false ) ]
32
32
[ ProvideToolsOptionsPageVisibility ( "Source Control" , "Git Source Control Provider Options" , "C4128D99-0000-41D1-A6C3-704E6C1A3DE2" ) ]
33
33
// Register a sample tool window visible only when the provider is active
34
- [ MsVsShell . ProvideToolWindow ( typeof ( SccProviderToolWindow ) , Style = VsDockStyle . Linked , Orientation = ToolWindowOrientation . Bottom ) ]
34
+ [ MsVsShell . ProvideToolWindow ( typeof ( SccProviderToolWindow ) , Style = VsDockStyle . Tabbed , Orientation = ToolWindowOrientation . Bottom ) ]
35
35
[ MsVsShell . ProvideToolWindowVisibility ( typeof ( SccProviderToolWindow ) , "C4128D99-0000-41D1-A6C3-704E6C1A3DE2" ) ]
36
36
// Register the source control provider's service (implementing IVsScciProvider interface)
37
37
[ MsVsShell . ProvideService ( typeof ( SccProviderService ) , ServiceName = "Git Source Control Service" ) ]
@@ -91,6 +91,10 @@ protected override void Initialize()
91
91
menu = new MenuCommand ( new EventHandler ( Exec_icmdViewToolWindow ) , cmd ) ;
92
92
mcs . AddCommand ( menu ) ;
93
93
94
+ cmd = new CommandID ( GuidList . guidSccProviderCmdSet , CommandId . icmdSccCommandInit ) ;
95
+ menu = new MenuCommand ( new EventHandler ( OnInitCommand ) , cmd ) ;
96
+ mcs . AddCommand ( menu ) ;
97
+
94
98
}
95
99
96
100
// Register the provider with the source control manager
@@ -153,7 +157,7 @@ int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] p
153
157
cmdf |= OLECMDF . OLECMDF_ENABLED ;
154
158
}
155
159
break ;
156
-
160
+
157
161
case CommandId . icmdSccCommandUndo :
158
162
case CommandId . icmdSccCommandCompare :
159
163
if ( sccService . CanCompareSelectedFile ) cmdf |= OLECMDF . OLECMDF_ENABLED ;
@@ -163,13 +167,20 @@ int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] p
163
167
if ( sccService . IsSolutionGitControlled ) cmdf |= OLECMDF . OLECMDF_ENABLED ;
164
168
break ;
165
169
170
+ case CommandId . icmdSccCommandInit :
171
+ if ( ! sccService . IsSolutionGitControlled )
172
+ cmdf |= OLECMDF . OLECMDF_ENABLED ;
173
+ else
174
+ cmdf |= OLECMDF . OLECMDF_INVISIBLE ;
175
+ break ;
176
+
166
177
default :
167
178
cmdf |= OLECMDF . OLECMDF_ENABLED ;
168
179
break ;
169
180
}
170
181
171
182
172
- prgCmds [ 0 ] . cmdf = ( uint ) ( cmdf ) ;
183
+ prgCmds [ 0 ] . cmdf = ( uint ) ( cmdf ) ;
173
184
return VSConstants . S_OK ;
174
185
}
175
186
@@ -237,6 +248,10 @@ private void Exec_icmdViewToolWindow(object sender, EventArgs e)
237
248
}
238
249
}
239
250
251
+ private void OnInitCommand ( object sender , EventArgs e )
252
+ {
253
+ sccService . InitRepo ( ) ;
254
+ }
240
255
#endregion
241
256
242
257
// This function is called by the IVsSccProvider service implementation when the active state of the provider changes
@@ -294,7 +309,7 @@ internal void RunDetatched(string cmd, string arguments)
294
309
295
310
process . Start ( ) ;
296
311
}
297
- }
312
+ }
298
313
#endregion
299
314
300
315
}
0 commit comments