public void SetSite()
        {
            // Create the package
            IVsPackage package = new SccProvider() as IVsPackage;

            Assert.IsNotNull(package, "The object does not implement IVsPackage");

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            // Need to mock a service implementing IVsRegisterScciProvider, because the scc provider will register with it
            IVsRegisterScciProvider registerScciProvider = MockRegisterScciProvider.GetBaseRegisterScciProvider();

            serviceProvider.AddService(typeof(IVsRegisterScciProvider), registerScciProvider, true);

            // Register solution events because the provider will try to subscribe to them
            MockSolution solution = new MockSolution();

            serviceProvider.AddService(typeof(SVsSolution), solution as IVsSolution, true);

            // Register TPD service because the provider will try to subscribe to TPD
            IVsTrackProjectDocuments2 tpd = MockTrackProjectDocumentsProvider.GetTrackProjectDocuments() as IVsTrackProjectDocuments2;

            serviceProvider.AddService(typeof(SVsTrackProjectDocuments), tpd, true);

            // Site the package
            Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");

            // Unsite the package
            Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK");
        }
Ejemplo n.º 2
0
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            // NOTE: this switch is already performed within the base.InitializeAsync() method.
            await Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            _CurrentSolutionRcsType = RcsType.Unknown;

            //EnvDTE.IVsExtensibility extensibility = await GetServiceAsync(typeof(EnvDTE.IVsExtensibility)) as EnvDTE.IVsExtensibility;
            //_DTE2 = (DTE2)extensibility.GetGlobalsObject(null).DTE as EnvDTE80.DTE2;
            _DTE2 = Package.GetGlobalService(typeof(DTE)) as DTE2;

            IVsSolution solution = await GetServiceAsync(typeof(SVsSolution)) as IVsSolution;

            Assumes.Present(solution);
            int  hr;
            uint pdwCookie;

            hr = solution.AdviseSolutionEvents(this, out pdwCookie);
            Marshal.ThrowExceptionForHR(hr);

            _VsShell = await GetServiceAsync(typeof(SVsShell)) as IVsShell;

            _VsRegisterScciProvider = await GetServiceAsync(typeof(IVsRegisterScciProvider)) as IVsRegisterScciProvider;

            _VsGetScciProviderInterface = await GetServiceAsync(typeof(IVsRegisterScciProvider)) as IVsGetScciProviderInterface;

            _SettingsStore = GetWritableSettingsStore();

            TaskManager.Initialize(this);
            solutionEvents         = ((Events2)_DTE2.Events).SolutionEvents;
            solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(this.SolutionEvents_Opened);
            SolutionEvents_Opened();
        }
        public int OnAfterOpenSolution([In] Object pUnkReserved, [In] int fNewSolution)
        {
            ThreadHelper.JoinableTaskFactory.Run(async delegate
            {
                await OpenTracker();
            });

            //RefreshDelay = InitialRefreshDelay;

            //automatic switch the scc provider
            if (!Active && !GitSccOptions.Current.DisableAutoLoad)
            {
                ThreadHelper.JoinableTaskFactory.Run(async delegate
                {
                    await OpenTracker();
                });

                if (RepositoryManager.Instance.GetRepositories().Count > 0)
                {
                    ThreadHelper.ThrowIfNotOnUIThread();
                    IVsRegisterScciProvider rscp =
                        (IVsRegisterScciProvider)_sccProvider.GetService(typeof(IVsRegisterScciProvider));
                    rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);
                }
            }
            return(VSConstants.S_OK);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Called when the package is loaded, performs package initialization tasks such as registering the source control provider
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            // Proffer the source control service implemented by the provider
            sccService = new SccProviderService(this);
            ((IServiceContainer)this).AddService(typeof(SccProviderService), sccService, true);

            // Add our command handlers for menu (commands must exist in the .vsct file)
            MsVsShell.OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as MsVsShell.OleMenuCommandService;
            if (mcs != null)
            {
                CommandID   cmd     = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommand);
                MenuCommand menuCmd = new MenuCommand(new EventHandler(OnSccCommand), cmd);
                mcs.AddCommand(menuCmd);

                // ToolWindow Command
                cmd     = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdViewToolWindow);
                menuCmd = new MenuCommand(new EventHandler(ViewToolWindow), cmd);
                mcs.AddCommand(menuCmd);

                // ToolWindow's ToolBar Command
                cmd     = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdToolWindowToolbarCommand);
                menuCmd = new MenuCommand(new EventHandler(ToolWindowToolbarCommand), cmd);
                mcs.AddCommand(menuCmd);
            }

            // Register the provider with the source control manager
            // If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled
            IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)GetService(typeof(IVsRegisterScciProvider));

            rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);
        }
        public void TestSccComand()
        {
            // Create the package
            BasicSccProvider package = new BasicSccProvider();
            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            // Need to mock a service implementing IVsRegisterScciProvider, because the scc provider will register with it
            IVsRegisterScciProvider registerScciProvider = MockRegisterScciProvider.GetBaseRegisterScciProvider();

            serviceProvider.AddService(typeof(IVsRegisterScciProvider), registerScciProvider, true);

            // Site the package
            Assert.AreEqual(0, ((IVsPackage)package).SetSite(serviceProvider), "SetSite did not return S_OK");

            // Test the scc command by toggleing it twice
            MethodInfo method = typeof(BasicSccProvider).GetMethod("OnSccCommand", BindingFlags.NonPublic | BindingFlags.Instance);

            TestSccCommand commandWell = new TestSccCommand();
            CommandID      cmdID       = new CommandID(new System.Guid(), 0);
            MenuCommand    command     = new MenuCommand(new EventHandler(commandWell.OnSccCommand), cmdID);
            object         result      = method.Invoke(package, new object[] { command, null });

            Assert.AreEqual(true, command.Checked, "OnSccCommand did not execute correctly");

            result = method.Invoke(package, new object[] { command, null });
            Assert.AreEqual(false, command.Checked, "OnSccCommand did not execute correctly");
        }
        /// <summary>
        /// Return a IVsRegisterScciProvider without any special implementation
        /// </summary>
        /// <returns></returns>
        internal static IVsRegisterScciProvider GetBaseRegisterScciProvider()
        {
            if (registerScciProviderFactory == null)
            {
                registerScciProviderFactory = new GenericMockFactory("RegisterScciProvider", new Type[] { typeof(IVsRegisterScciProvider) });
            }
            IVsRegisterScciProvider registerProvider = (IVsRegisterScciProvider)registerScciProviderFactory.GetInstance();

            return(registerProvider);
        }
Ejemplo n.º 7
0
        public void RegisterAsPrimarySccProvider()
        {
            IVsRegisterScciProvider rscp = GetService <IVsRegisterScciProvider>();

            if (rscp == null)
            {
                return;
            }

            VSErr.ThrowOnFailure(rscp.RegisterSourceControlProvider(ProviderGuid));
        }
 public int OnAfterOpenSolution([InAttribute] Object pUnkReserved, [InAttribute] int fNewSolution)
 {
     //automatic switch the scc provider
     if (!Active && !GitSccOptions.Current.DisableAutoLoad)
     {
         OpenTracker();
         if (trackers.Count > 0)
         {
             IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)_sccProvider.GetService(typeof(IVsRegisterScciProvider));
             rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);
         }
     }
     Refresh();
     return(VSConstants.S_OK);
 }
        public void UseToolWindow()
        {
            // Create the package
            SccProvider package = new SccProvider();
            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            // Need to mock a service implementing IVsRegisterScciProvider, because the scc provider will register with it
            IVsRegisterScciProvider registerScciProvider = MockRegisterScciProvider.GetBaseRegisterScciProvider();

            serviceProvider.AddService(typeof(IVsRegisterScciProvider), registerScciProvider, true);

            // Add site support to create and enumerate tool windows
            BaseMock uiShell = MockUiShellProvider.GetWindowEnumerator0();

            serviceProvider.AddService(typeof(SVsUIShell), uiShell, false);

            // Register solution events because the provider will try to subscribe to them
            MockSolution solution = new MockSolution();

            serviceProvider.AddService(typeof(SVsSolution), solution as IVsSolution, true);

            // Register TPD service because the provider will try to subscribe to TPD
            IVsTrackProjectDocuments2 tpd = MockTrackProjectDocumentsProvider.GetTrackProjectDocuments() as IVsTrackProjectDocuments2;

            serviceProvider.AddService(typeof(SVsTrackProjectDocuments), tpd, true);

            // Site the package
            Assert.AreEqual(0, ((IVsPackage)package).SetSite(serviceProvider), "SetSite did not return S_OK");

            // Test that toolwindow can be created
            MethodInfo method = typeof(SccProvider).GetMethod("Exec_icmdViewToolWindow", BindingFlags.NonPublic | BindingFlags.Instance);
            object     result = method.Invoke(package, new object[] { null, null });

            // Test that toolwindow toolbar's command can be executed
            method = typeof(SccProvider).GetMethod("Exec_icmdToolWindowToolbarCommand", BindingFlags.NonPublic | BindingFlags.Instance);
            result = method.Invoke(package, new object[] { null, null });

            // Toggle the toolwindow color back
            method = typeof(SccProvider).GetMethod("Exec_icmdToolWindowToolbarCommand", BindingFlags.NonPublic | BindingFlags.Instance);
            result = method.Invoke(package, new object[] { null, null });

            // Get the window and test the dispose function
            SccProviderToolWindow window = (SccProviderToolWindow)package.FindToolWindow(typeof(SccProviderToolWindow), 0, true);

            method = typeof(SccProviderToolWindow).GetMethod("Dispose", BindingFlags.NonPublic | BindingFlags.Instance);
            result = method.Invoke(window, new object[] { true });
        }
Ejemplo n.º 10
0
        //--------------------------------------------------------------------------------
        // IVsSolutionEvents and IVsSolutionEvents2 specific functions
        //--------------------------------------------------------------------------------
        #region IVsSolutionEvents interface functions

        public int OnAfterOpenSolution([InAttribute] Object pUnkReserved, [InAttribute] int fNewSolution)
        {
            Trace.WriteLine("OnAfterOpenSolution");

            // Make VisualHG the active SCC controler on Mercurial solution types
            if (!Active && Configuration.Global._autoActivatePlugin)
            {
                string root = this._sccProvider.GetRootDirectory();
                if (root.Length > 0)
                {
                    IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)this._sccProvider.GetService(typeof(IVsRegisterScciProvider));
                    rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);
                }
            }
            return(VSConstants.S_OK);
        }
Ejemplo n.º 11
0
        public Task <CodeContainer> AcquireCodeContainerAsync(IProgress <ServiceProgressData> downloadProgress, CancellationToken cancellationToken)
        {
            if (ExecuteCommand("File.Perforce.P4VS.Open_Solution_in_Perforce_Depot"))
            {
                downloadProgress.Report(new ServiceProgressData(string.Empty, string.Empty, 1, 1));
                return(null);
            }
            else
            {
                try
                {
                    IVsRegisterScciProvider registerSccProvider =
                        ServiceProvider.GlobalProvider.GetService(typeof(IVsRegisterScciProvider)) as IVsRegisterScciProvider;
                    if (registerSccProvider == null)
                    {
                        return(null);
                    }

                    // Try to activate the Scc provider
                    int hr = registerSccProvider.RegisterSourceControlProvider(GuidList.guidP4VsProvider);
                    if (ErrorHandler.Failed(hr))
                    {
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message);
                }



                if (ExecuteCommand("File.Perforce.P4VS.Open_Solution_in_Perforce_Depot"))
                {
                    downloadProgress.Report(new ServiceProgressData(string.Empty, string.Empty, 1, 1));
                    return(null);
                }
            }

            System.Windows.Forms.MessageBox.Show(Resources.StartPagePluginRegError);

            return(null);
        }
Ejemplo n.º 12
0
        protected override void Initialize()
        {
            base.Initialize();

            _CurrentSolutionRcsType = RcsType.Unknown;

            IVsExtensibility extensibility = GetService <IVsExtensibility>();

            _DTE2 = (DTE2)extensibility.GetGlobalsObject(null).DTE;

            IVsSolution solution = GetService <SVsSolution>() as IVsSolution;
            int         hr;
            uint        pdwCookie;

            hr = solution.AdviseSolutionEvents(this, out pdwCookie);
            Marshal.ThrowExceptionForHR(hr);

            _VsShell = GetService <SVsShell>() as IVsShell;
            _VsRegisterScciProvider = GetService <IVsRegisterScciProvider>();
            _SettingsStore          = GetWritableSettingsStore();
        }
Ejemplo n.º 13
0
        // IVsPersistSolutionProps::ReadSolutionProps
        public int ReadSolutionProps([In] IVsHierarchy pHierarchy, [In] string pszProjectName, [In] string pszProjectMk, [In] string pszKey, [In] int fPreLoad, [In] IPropertyBag pPropBag)
        {
            // This function gets called by the shell when a solution controlled by this provider is opened in IDE.
            // The shell encounters the _strSolutionPersistanceKey section in the solution, and based based on
            // registration info written by ProvideSolutionProps identifies this package as the section owner,
            // loads this package if necessary and calls the package to read the persisted solution options.
            logger.Debug("P4VS Startup in ReadSolutionProps");
            SolutionFileTagged = false;

            if (_strSolutionPersistanceKey.CompareTo(pszKey) == 0)
            {
                SolutionFileTagged = true;

                // We were called to read the key written by this source control provider
                // First thing to do: register the source control provider with the source control manager.
                // This allows the scc manager to switch the active source control provider if necessary,
                // and set this provider active; the provider will be later called to provide source control services
                // for this solution.
                // (This is how automatic source control provider switching on solution opening is implemented)
                IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)GetService(typeof(IVsRegisterScciProvider));
                rscp.RegisterSourceControlProvider(GuidList.guidP4VsProvider);

                // Now we can read all the data and store it in memory
                // The read data will be used when the solution has completed opening
                object pVar;
                pPropBag.Read(_strSolutionControlledProperty, out pVar, null, 0, null);
                if (pVar.ToString().CompareTo(true.ToString()) == 0)
                {
                    try
                    {
                        SccService.LoadingControlledSolutionLocation = pVar.ToString();
                    }
                    catch { }
                }
            }
            return(VSConstants.S_OK);
        }
Ejemplo n.º 14
0
        protected override void Initialize()
        {
            Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // Proffer the source control service implemented by the provider
            sccService = new SccProviderService(this);
            ((IServiceContainer)this).AddService(typeof(SccProviderService), sccService, true);
            ((IServiceContainer)this).AddService(typeof(System.IServiceProvider), this, true);

            // Add our command handlers for menu (commands must exist in the .vsct file)
            InitVSCTMenuCommandHandler();

            // Register the provider with the source control manager
            // If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled
            IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)GetService(typeof(IVsRegisterScciProvider));

            rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);

            _OnIdleEvent.RegisterForIdleTimeCallbacks(GetGlobalService(typeof(SOleComponentManager)) as IOleComponentManager);
            _OnIdleEvent.OnIdleEvent += new OnIdleEvent(sccService.UpdateDirtyNodesGlyphs);

            //ShowToolWindow(VisualHGToolWindow.PendingChanges);
        }
        public void SetSite()
        {
            // Create the package
            IVsPackage package = new BasicSccProvider() as IVsPackage;

            Assert.IsNotNull(package, "The object does not implement IVsPackage");

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            // Need to mock a service implementing IVsRegisterScciProvider, because the scc provider will register with it
            IVsRegisterScciProvider registerScciProvider = MockRegisterScciProvider.GetBaseRegisterScciProvider();

            serviceProvider.AddService(typeof(IVsRegisterScciProvider), registerScciProvider, true);

            // Site the package
            Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");

            // Unsite the package
            Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK");

            // Remove the mock service
            serviceProvider.RemoveService(typeof(IVsRegisterScciProvider));
        }
Ejemplo n.º 16
0
        protected override void Initialize()
        {
            try
            {
                // load the local settings
                Preferences.Initialize();
                Preferences.LocalSettings.Load(null);

                logger.Trace("Entering Initialize() of: {0}", this.ToString());
                base.Initialize();

                // Proffer the source control service implemented by the provider
                // The service provider implemented by the package
                SccService = new P4VsProviderService(this);
                ((IServiceContainer)this).AddService(typeof(P4VsProviderService), SccService, true);

                // Initilise Glyphs
                IVsHierarchy solHier = (IVsHierarchy)GetService(typeof(SVsSolution));
                Glyphs = new NodeGlyphs(SccService, solHier);

                // Add our command handlers for menu (commands must exist in the .vsct file)
                OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
                if (mcs != null)
                {
                    // View Menu commands
                    #region View Menu commands
                    // Workspaces ToolWindow Command
                    CommandID   cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewWorkspaceToolWindow);
                    MenuCommand menuCmd = new MenuCommand(new EventHandler(P4VsViewWorkspaceToolWindow), cmd);
                    mcs.AddCommand(menuCmd);

                    // History ToolWindow
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewHistoryToolWindow);
                    menuCmd = new MenuCommand(new EventHandler(P4VsViewHistoryToolWindow), cmd);
                    mcs.AddCommand(menuCmd);

                    // Jobs ToolWindow
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewJobsToolWindow);
                    menuCmd = new MenuCommand(new EventHandler(P4VsViewJobsToolWindow), cmd);
                    mcs.AddCommand(menuCmd);

                    // P4 ToolWindow
                    //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewP4ToolWindow);
                    //menuCmd = new MenuCommand(new EventHandler(P4VsViewP4ToolWindow), cmd);
                    //mcs.AddCommand(menuCmd);

                    // SubmittedChangelists ToolWindow
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewSubmittedChangelistsToolWindow);
                    menuCmd = new MenuCommand(new EventHandler(P4VsViewSubmittedChangelistsToolWindow), cmd);
                    mcs.AddCommand(menuCmd);

                    // PendingChangelists ToolWindow
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewPendingChangelistsToolWindow);
                    menuCmd = new MenuCommand(new EventHandler(P4VsViewPendingChangelistsToolWindow), cmd);
                    mcs.AddCommand(menuCmd);

                    // Labels ToolWindow
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewLabelsToolWindow);
                    menuCmd = new MenuCommand(new EventHandler(P4VsViewLabelsToolWindow), cmd);
                    mcs.AddCommand(menuCmd);

                    // Swarm ToolWindow
                    //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewSwarmToolWindow);
                    //menuCmd = new MenuCommand(new EventHandler(P4VsViewSwarmToolWindow), cmd);
                    //mcs.AddCommand(menuCmd);

                    // Streams ToolWindow
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewStreamsToolWindow);
                    menuCmd = new MenuCommand(new EventHandler(P4VsViewStreamsToolWindow), cmd);
                    mcs.AddCommand(menuCmd);

                    // Reviews ToolWindow
                    //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdViewReviewsToolWindow);
                    //menuCmd = new MenuCommand(new EventHandler(P4VsViewReviewsToolWindow), cmd);
                    //mcs.AddCommand(menuCmd);
                    #endregion

                    // Help Menu commands
                    #region Help Menu commands
                    // Help/P4VS Help
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdP4VSHelp);
                    menuCmd = new MenuCommand(new EventHandler(P4VsP4VSHelp), cmd);
                    mcs.AddCommand(menuCmd);

                    // Help/P4VS SystemInfo
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdP4VSSystemInfo);
                    menuCmd = new MenuCommand(new EventHandler(P4VsP4VSSystemInfo), cmd);
                    mcs.AddCommand(menuCmd);

                    #endregion

                    // File Menu commands
                    #region File Menu commands
                    // File/Open Solution in Perforce Depot
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdFileOpenInDepot);
                    menuCmd = new MenuCommand(new EventHandler(P4VsFileOpenInDepot), cmd);
                    mcs.AddCommand(menuCmd);

                    // File/Open Connection to a Perforce Depot
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdOpenConnection);
                    menuCmd = new MenuCommand(new EventHandler(P4VsOpenConnection), cmd);
                    mcs.AddCommand(menuCmd);

                    // File/Close Connection to the Perforce Depot
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCloseConnection);
                    menuCmd = new MenuCommand(new EventHandler(P4VsCloseConnection), cmd);
                    mcs.AddCommand(menuCmd);

                    // Workspaces ToolWindow's ToolBar Command
                    //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdToolWindowToolbarCommand);
                    //menuCmd = new MenuCommand(new EventHandler(P4VsWorkspaceToolWindowToolbarCommand), cmd);
                    //mcs.AddCommand(menuCmd);
                    #endregion

                    // Source control menu commands
                    #region File Menu commands
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdScmRefresh);
                    menuCmd = new MenuCommand(new EventHandler(P4VsScmRefresh), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdAddToSourceControl);
                    menuCmd = new MenuCommand(new EventHandler(P4VsAddToSourceControl), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckin);
                    menuCmd = new MenuCommand(new EventHandler(P4VsCheckin), cmd);
                    mcs.AddCommand(menuCmd);

                    //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckout);
                    //menuCmd = new MenuCommand(new EventHandler(P4VsCheckout), cmd);
                    //mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckout);
                    menuCmd = new OleMenuCommand(new EventHandler(P4VsCheckout), cmd);
                    //queryStatusMenuCommand.BeforeQueryStatus +=new EventHandler(OnBeforeQueryStatus);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckoutProject);
                    menuCmd = new MenuCommand(new EventHandler(P4VsCheckoutEntireProjectOrSolution), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdCheckoutSolution);
                    menuCmd = new MenuCommand(new EventHandler(P4VsCheckoutEntireProjectOrSolution), cmd);
                    mcs.AddCommand(menuCmd);

                    //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdUseSccOffline);
                    //menuCmd = new MenuCommand(new EventHandler(P4VsUseSccOffline), cmd);
                    //mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdReconcile);
                    menuCmd = new MenuCommand(new EventHandler(P4VsReconcileFiles), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdRevert);
                    menuCmd = new MenuCommand(new EventHandler(P4VsRevert), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdRevertUnchanged);
                    menuCmd = new MenuCommand(new EventHandler(P4VsRevertUnchanged), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdLock);
                    menuCmd = new MenuCommand(new EventHandler(P4VsLock), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdUnlock);
                    menuCmd = new MenuCommand(new EventHandler(P4VsUnlock), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdChangeFileType);
                    menuCmd = new MenuCommand(new EventHandler(P4VsChangeFileType), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdMoveToChangelist);
                    menuCmd = new MenuCommand(new EventHandler(P4VsMoveToChangelist), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdAddToIgnoreList);
                    menuCmd = new MenuCommand(new EventHandler(P4VsAddToIgnoreList), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdRemoveFromIgnoreList);
                    menuCmd = new MenuCommand(new EventHandler(P4VsRemoveFromIgnoreList), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdEditIgnoreList);
                    menuCmd = new MenuCommand(new EventHandler(P4VsEditIgnoreList), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdResolve);
                    menuCmd = new MenuCommand(new EventHandler(P4VsResolve), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdSync);
                    menuCmd = new MenuCommand(new EventHandler(P4VsSync), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdSyncHead);
                    menuCmd = new MenuCommand(new EventHandler(P4VsSyncHead), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdDiffVsHave);
                    menuCmd = new MenuCommand(new EventHandler(P4VsDiffVsHave), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdDiffVsAny);
                    menuCmd = new MenuCommand(new EventHandler(P4VsDiffVsAny), cmd);
                    mcs.AddCommand(menuCmd);

                    //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdAddProjectToSCC);
                    //menuCmd = new MenuCommand(new EventHandler(P4VsAddProjectToSCC), cmd);
                    //mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdShowHistory);
                    menuCmd = new MenuCommand(new EventHandler(P4VsShowHistory), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdShelve);
                    menuCmd = new MenuCommand(new EventHandler(P4VsShelve), cmd);
                    mcs.AddCommand(menuCmd);

                    //cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdScmAttributes);
                    //menuCmd = new MenuCommand(new EventHandler(P4VsScmAttributes), cmd);
                    //mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdScmMerge);
                    menuCmd = new MenuCommand(new EventHandler(P4VsScmMerge), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdScmCopy);
                    menuCmd = new MenuCommand(new EventHandler(P4VsScmCopy), cmd);
                    mcs.AddCommand(menuCmd);
                    #endregion

                    // P4V commands
                    #region P4V Menu commands
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdP4V);
                    menuCmd = new MenuCommand(new EventHandler(P4VsP4V), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdTimeLapse);
                    menuCmd = new MenuCommand(new EventHandler(P4VsTimeLapse), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdRevGraph);
                    menuCmd = new MenuCommand(new EventHandler(P4VsRevGraph), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdStreamGraph);
                    menuCmd = new MenuCommand(new EventHandler(P4VsStreamGraph), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.cmdidCancelActiveCommand);
                    menuCmd = new MenuCommand(new EventHandler(Exec_CancelActiveCommand), cmd);
                    mcs.AddCommand(menuCmd);

                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.cmdidCurrentStream);
                    menuCmd = new MenuCommand(new EventHandler(Exec_CurrentStream), cmd);
                    mcs.AddCommand(menuCmd);
                    #endregion

                    // Status Bar commands
                    #region Status Bar commands
                    // Add to Source Control/Publish
                    cmd     = new CommandID(GuidList.guidP4VsProviderCmdSet, CommandId.icmdPublish);
                    menuCmd = new MenuCommand(new EventHandler(P4VsScmPublish), cmd);
                    mcs.AddCommand(menuCmd);
                    #endregion

                    // DropDownCombo
                    //	 a DROPDOWNCOMBO does not let the user type into the combo box; they can only pick from the list.
                    //   The string value of the element selected is returned.
                    //	 For example, this type of combo could be used for the "Solution Configurations" on the "Standard" toolbar.
                    //
                    //   A DropDownCombo box requires two commands:
                    //     One command (cmdidMyCombo) is used to ask for the current value of the combo box and to
                    //     set the new value when the user makes a choice in the combo box.
                    //
                    //     The second command (cmdidMyComboGetList) is used to retrieve this list of choices for the combo box.
                    //
                    // Normally IOleCommandTarget::QueryStatus is used to determine the state of a command, e.g.
                    // enable vs. disable, shown vs. hidden, etc. The QueryStatus method does not have any way to
                    // control the statue of a combo box, e.g. what list of items should be shown and what is the
                    // current value. In order to communicate this information actually IOleCommandTarget::Exec
                    // is used with a non-NULL varOut parameter. You can think of these Exec calls as extended
                    // QueryStatus calls. There are two pieces of information needed for a combo, thus it takes
                    // two commands to retrieve this information. The main command id for the command is used to
                    // retrieve the current value and the second command is used to retrieve the full list of
                    // choices to be displayed as an array of strings.
                    cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, (int)CommandId.cmdidConnectionDropDownCombo);
                    omcConnectionComboSelChanged = new OleMenuCommand(new EventHandler(P4VsConnectionDropDownCombo), cmd);
                    omcConnectionComboSelChanged.ParametersDescription = "$"; // accept any argument string
                    mcs.AddCommand(omcConnectionComboSelChanged);

                    cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, (int)CommandId.cmdidConnectionDropDownComboGetList);
                    omcConnectionComboGetList = new OleMenuCommand(new EventHandler(P4VsConnectionDropDownComboGetList), cmd);
                    mcs.AddCommand(omcConnectionComboGetList);

                    cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, (int)CommandId.cmdidActiveChangelistDropDownCombo);
                    omcActiveChangelistComboSelChanged = new OleMenuCommand(new EventHandler(P4VsActiveChangelistDropDownCombo), cmd);
                    omcActiveChangelistComboSelChanged.ParametersDescription = "$"; // accept any argument string
                    mcs.AddCommand(omcActiveChangelistComboSelChanged);

                    cmd = new CommandID(GuidList.guidP4VsProviderCmdSet, (int)CommandId.cmdidActiveChangelistDropDownComboGetList);
                    omcActiveChangelistComboGetList = new OleMenuCommand(new EventHandler(P4VsActiveChangelistDropDownComboGetList), cmd);
                    mcs.AddCommand(omcActiveChangelistComboGetList);
                }

                // -- Set an eventlistener for shell property changes
                var shellService = GetService(typeof(SVsShell)) as IVsShell;
                if (shellService != null)
                {
                    ErrorHandler.ThrowOnFailure(shellService.AdviseShellPropertyChanges(this, out _EventSinkCookie));
                }

                // Register the provider with the source control manager
                // If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled
                IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)GetService(typeof(IVsRegisterScciProvider));
                rscp.RegisterSourceControlProvider(GuidList.guidP4VsProvider);

                instance = this;
            } catch (Exception ex)
            {
                logger.Error(ex, "Initialize failed");
                logger.Error("Error: {0}", ex.Message);
                logger.Error("Stacktrace: {0}", ex.StackTrace);
            }
        }
        /////////////////////////////////////////////////////////////////////////////
        // BasicSccProvider Package Implementation
        #region Package Members

        protected override void Initialize()
        {
            Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            projects   = new List <GitFileStatusTracker>();
            sccService = new SccProviderService(this, projects);

            ((IServiceContainer)this).AddService(typeof(SccProviderService), sccService, true);

            Blinkbox.Events.BlinkboxSccHooks.TriggerOnPackageInitialise(this, new Blinkbox.Events.OnPackageInitialiseArgs()
            {
                PackageInstance = this, SccService = this.sccService
            });

            // Add our command handlers for menu (commands must exist in the .vsct file)
            MsVsShell.OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as MsVsShell.OleMenuCommandService;
            if (mcs != null)
            {
                CommandID cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandRefresh);
                var       menu = new MenuCommand(new EventHandler(OnRefreshCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandGitBash);
                menu = new MenuCommand(new EventHandler(OnGitBashCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandGitExtension);
                menu = new MenuCommand(new EventHandler(OnGitExtensionCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandCompare);
                menu = new MenuCommand(new EventHandler(OnCompareCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandUndo);
                menu = new MenuCommand(new EventHandler(OnUndoCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandInit);
                menu = new MenuCommand(new EventHandler(OnInitCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandEditIgnore);
                menu = new MenuCommand(new EventHandler(OnEditIgnore), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandGitTortoise);
                menu = new MenuCommand(new EventHandler(OnTortoiseGitCommand), cmd);

                mcs.AddCommand(menu);
                for (int i = 0; i < GitToolCommands.GitExtCommands.Count; i++)
                {
                    cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdGitExtCommand1 + i);
                    var mc = new MenuCommand(new EventHandler(OnGitExtCommandExec), cmd);
                    mcs.AddCommand(mc);
                }

                for (int i = 0; i < GitToolCommands.GitTorCommands.Count; i++)
                {
                    cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdGitTorCommand1 + i);
                    var mc = new MenuCommand(new EventHandler(OnGitTorCommandExec), cmd);
                    mcs.AddCommand(mc);
                }

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandPendingChanges);
                menu = new MenuCommand(new EventHandler(ShowPendingChangesWindow), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandHistory);
                menu = new MenuCommand(new EventHandler(ShowHistoryWindow), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesCommitToBranch);
                menu = new MenuCommand(new EventHandler(OnSwitchBranchCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesCommit);
                menu = new MenuCommand(new EventHandler(OnCommitCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesAmend);
                menu = new MenuCommand(new EventHandler(OnAmendCommitCommand), cmd);
                mcs.AddCommand(menu);


                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandAbout);
                menu = new MenuCommand(new EventHandler(OnAbout), cmd);
                mcs.AddCommand(menu);

                Blinkbox.Events.BlinkboxSccHooks.TriggerRegisterCommands(this, new Blinkbox.Events.OnRegisterCommandsArgs()
                {
                    MenuService = mcs
                });
            }


            // Register the provider with the source control manager
            // If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled
            IVsRegisterScciProvider rscp = (IVsRegisterScciProvider)GetService(typeof(IVsRegisterScciProvider));

            rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);

            _OnIdleEvent.RegisterForIdleTimeCallbacks(GetGlobalService(typeof(SOleComponentManager)) as IOleComponentManager);
            _OnIdleEvent.OnIdleEvent += new OnIdleEvent(sccService.UpdateNodesGlyphs);
        }
        /////////////////////////////////////////////////////////////////////////////
        // BasicSccProvider Package Implementation
        #region Package Members

        protected override async Task InitializeAsync(System.Threading.CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering Initialize() of: {0}", this.ToString()));
            GitBash.GitExePath       = GitSccOptions.Current.GitBashPath;
            GitBash.UseUTF8FileNames = !GitSccOptions.Current.NotUseUTF8FileNames;
            //base.Initialize();
            await base.InitializeAsync(cancellationToken, progress);

            //projects = new List<GitFileStatusTracker>();


            this.AddService(typeof(SccProviderService), CreateGitService, true);

            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            // Add our command handlers for menu (commands must exist in the .vsct file)
            MsVsShell.OleMenuCommandService mcs = await GetServiceAsync(typeof(IMenuCommandService)) as MsVsShell.OleMenuCommandService;

            if (mcs != null)
            {
                CommandID cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandRefresh);
                var       menu = new MenuCommand(new EventHandler(OnRefreshCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandGitBash);
                menu = new MenuCommand(new EventHandler(OnGitBashCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandGitExtension);
                menu = new MenuCommand(new EventHandler(OnGitExtensionCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandCompare);
                menu = new MenuCommand(new EventHandler(OnCompareCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandUndo);
                menu = new MenuCommand(new EventHandler(OnUndoCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandInit);
                menu = new MenuCommand(new EventHandler(OnInitCommand), cmd);
                mcs.AddCommand(menu);


                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandEditIgnore);
                menu = new MenuCommand(new EventHandler(OnEditIgnore), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.cmdidGitIgnoreSubMenuCommandUpdate);
                menu = new MenuCommand(new EventHandler(OnEditUpdate), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandGitTortoise);
                menu = new MenuCommand(new EventHandler(OnTortoiseGitCommand), cmd);

                mcs.AddCommand(menu);
                for (int i = 0; i < GitToolCommands.GitExtCommands.Count; i++)
                {
                    cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdGitExtCommand1 + i);
                    var mc = new MenuCommand(new EventHandler(OnGitExtCommandExec), cmd);
                    mcs.AddCommand(mc);
                }

                for (int i = 0; i < GitToolCommands.GitTorCommands.Count; i++)
                {
                    cmd = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdGitTorCommand1 + i);
                    var mc = new MenuCommand(new EventHandler(OnGitTorCommandExec), cmd);
                    mcs.AddCommand(mc);
                }

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandPendingChanges);
                menu = new MenuCommand(new EventHandler(ShowPendingChangesWindow), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdSccCommandHistory);
                menu = new MenuCommand(new EventHandler(ShowHistoryWindow), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesCommitToBranch);
                menu = new MenuCommand(new EventHandler(OnSwitchBranchCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesCommit);
                menu = new MenuCommand(new EventHandler(OnCommitCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesAmend);
                menu = new MenuCommand(new EventHandler(OnAmendCommitCommand), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.icmdPendingChangesSettings);
                menu = new MenuCommand(new EventHandler(OnSettings), cmd);
                mcs.AddCommand(menu);

                cmd  = new CommandID(GuidList.guidSccProviderCmdSet, PackageIds.cmdIdAddProjectToSCC);
                menu = new MenuCommand(new EventHandler(OnAddProjectToSCC), cmd);
                mcs.AddCommand(menu);
            }



            ThreadHelper.ThrowIfNotOnUIThread();
            // Register the provider with the source control manager
            // If the package is to become active, this will also callback on OnActiveStateChange and the menu commands will be enabled
            IVsRegisterScciProvider rscp = await GetServiceAsync(typeof(IVsRegisterScciProvider)) as IVsRegisterScciProvider;

            rscp.RegisterSourceControlProvider(GuidList.guidSccProvider);

            _OnIdleEvent.RegisterForIdleTimeCallbacks(GetGlobalService(typeof(SOleComponentManager)) as IOleComponentManager);
            //_OnIdleEvent.OnIdleEvent += new OnIdleEvent(sccService.UpdateNodesGlyphs);
            SetupStatusMenu();
        }