Skip to content

Commit

Permalink
Hook the Solution Refresh command to also update the SCC status
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Feb 8, 2013
1 parent df7d648 commit 32be501
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions SccProviderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell.Interop;
using CancellationToken = System.Threading.CancellationToken;
using CommandID = System.ComponentModel.Design.CommandID;
using Constants = NGit.Constants;
using Interlocked = System.Threading.Interlocked;
using Task = System.Threading.Tasks.Task;
Expand Down Expand Up @@ -107,6 +108,10 @@ public int SetActive()
{
Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Git Source Control Provider set active"));
_active = true;

GlobalCommandHook hook = GlobalCommandHook.GetInstance(_sccProvider);
hook.HookCommand(new CommandID(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.SLNREFRESH), HandleSolutionRefresh);

MarkDirty(false);
return VSConstants.S_OK;
}
Expand All @@ -117,6 +122,10 @@ public int SetInactive()
{
Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Git Source Control Provider set inactive"));
_active = false;

GlobalCommandHook hook = GlobalCommandHook.GetInstance(_sccProvider);
hook.UnhookCommand(new CommandID(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.SLNREFRESH), HandleSolutionRefresh);

CloseTracker();
MarkDirty(false);
return VSConstants.S_OK;
Expand All @@ -129,6 +138,11 @@ public int AnyItemsUnderSourceControl(out int pfResult)
}
#endregion

private void HandleSolutionRefresh(object sender, EventArgs e)
{
Refresh();
}

#region IVsSccManager2 interface functions

public int BrowseForProject(out string pbstrDirectory, out int pfOK)
Expand Down

0 comments on commit 32be501

Please sign in to comment.