public int OnAfterOpenProject([InAttribute] IVsHierarchy pHierarchy, [InAttribute] int fAdded) { Trace.WriteLine("OnAfterOpenProject"); //if (fAdded == 1) { IVsSccProject2 project = pHierarchy as IVsSccProject2; IList <string> fileList = SccProvider.GetProjectFiles(project); _sccStatusTracker.AddFileToProjectCache(fileList, project); if (fileList.Count > 0) { string[] files = new string[fileList.Count]; fileList.CopyTo(files, 0); // add only files wich are not ignored if (Configuration.Global._autoAddFiles) { _sccStatusTracker.AddWorkItem(new HGLib.TrackFilesAddedNotIgnored(files)); } else { _sccStatusTracker.AddWorkItem(new HGLib.UpdateFileStatusCommand(files)); } } } _sccProvider._LastSeenProjectDir = SccProjectData.ProjectDirectory(pHierarchy); _sccStatusTracker.UpdateProject(pHierarchy as IVsSccProject2); return(VSConstants.S_OK); }
public int OnBeforeCloseProject([InAttribute] IVsHierarchy pHierarchy, [InAttribute] int fRemoved) { if (_sccStatusTracker.FileProjectMapCacheCount() > 0) { IVsSccProject2 project = pHierarchy as IVsSccProject2; IList <string> fileList = SccProvider.GetProjectFiles(project); _sccStatusTracker.RemoveFileFromProjectCache(fileList); } return(VSConstants.S_OK); }
protected override void Dispose(bool disposing) { Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering Dispose() of: {0}", this.ToString())); _OnIdleEvent.OnIdleEvent -= new OnIdleEvent(sccService.UpdateDirtyNodesGlyphs); _OnIdleEvent.UnRegisterForIdleTimeCallbacks(); _SccProvider = null; sccService.Dispose(); base.Dispose(disposing); }
public HGPendingChangesToolWindow() : base(null) { // set the window title this.Caption = Resources.ResourceManager.GetString("HGPendingChangesToolWindowCaption"); // set the CommandID for the window ToolBar //this.ToolBar = new CommandID(GuidList.guidSccProviderCmdSet, CommandId.imnuToolWindowToolbarMenu); // set the icon for the frame this.BitmapResourceID = CommandId.ibmpToolWindowsImages; // bitmap strip resource ID this.BitmapIndex = CommandId.iconSccProviderToolWindow; // index in the bitmap strip control = new HGPendingChangesToolWindowControl(); // update pending list SccProviderService service = (SccProviderService)SccProvider.GetServiceEx(typeof(SccProviderService)); if (service != null) { UpdatePendingList(service.StatusTracker); } }
// remember the latest OnQueryRemoveDirectories remove list //string[] _RemoveDirectoriesQueue = null; #region SccProvider Service initialization/unitialization public SccProviderService(SccProvider sccProvider) { Debug.Assert(null != sccProvider); _sccProvider = sccProvider; // Subscribe to solution events IVsSolution sol = (IVsSolution)_sccProvider.GetService(typeof(SVsSolution)); sol.AdviseSolutionEvents(this, out _vsSolutionEventsCookie); Debug.Assert(VSConstants.VSCOOKIE_NIL != _vsSolutionEventsCookie); // Subscribe to project documents IVsTrackProjectDocuments2 tpdService = (IVsTrackProjectDocuments2)_sccProvider.GetService(typeof(SVsTrackProjectDocuments)); tpdService.AdviseTrackProjectDocumentsEvents(this, out _tpdTrackProjectDocumentsCookie); Debug.Assert(VSConstants.VSCOOKIE_NIL != _tpdTrackProjectDocumentsCookie); // Subscribe to status events _sccStatusTracker.HGStatusChanged += new HGLib.HGStatusChangedEvent(SetNodesGlyphsDirty); IVsSolutionBuildManager buildManagerService = _sccProvider.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager; buildManagerService.AdviseUpdateSolutionEvents(this, out _dwBuildManagerCooky); }
//-------------------------------------------------------------------------------- // IVsSccManagerTooltip specific functions //-------------------------------------------------------------------------------- #region IVsSccManagerTooltip interface functions /// <summary> /// Called by solution explorer to provide tooltips for items. Returns a text describing the source control status of the item. /// </summary> public int GetGlyphTipText([InAttribute] IVsHierarchy phierHierarchy, [InAttribute] uint itemidNode, out string pbstrTooltipText) { // Initialize output parameters pbstrTooltipText = ""; IList <string> files = SccProvider.GetNodeFiles(phierHierarchy, itemidNode); if (files.Count == 0) { return(VSConstants.S_OK); } // Return the glyph text based on the first file of node (the master file) HGLib.HGFileStatus status = _sccStatusTracker.GetFileStatus(files[0]); switch (status) { // my states case HGLib.HGFileStatus.scsClean: pbstrTooltipText = "Clean"; break; case HGLib.HGFileStatus.scsModified: pbstrTooltipText = "Modified"; break; case HGLib.HGFileStatus.scsAdded: pbstrTooltipText = "Added"; break; case HGLib.HGFileStatus.scsRenamed: pbstrTooltipText = "Renamed"; break; case HGLib.HGFileStatus.scsRemoved: pbstrTooltipText = "Removed"; break; case HGLib.HGFileStatus.scsCopied: pbstrTooltipText = "Copied"; break; case HGLib.HGFileStatus.scsIgnored: pbstrTooltipText = "Ignored"; break; case HGLib.HGFileStatus.scsUncontrolled: pbstrTooltipText = "Uncontrolled"; break; default: pbstrTooltipText = string.Empty; break; } if (pbstrTooltipText != string.Empty) { string root = HGLib.HG.FindRootDirectory(files[0]); //string branchName = HGLib.HG.GetCurrentBranchName(root); string branchName = _sccStatusTracker.GetCurrentBranchOf(root); pbstrTooltipText += " [" + branchName + "]"; } return(VSConstants.S_OK); }
public SccProvider() { _SccProvider = this; Trace.WriteLine(String.Format(CultureInfo.CurrentUICulture, "Entering constructor for: {0}", this.ToString())); }