C# Class Microsoft.Samples.VisualStudio.SourceControlIntegration.SccProvider.SccProviderService

Inheritance: IVsSccCurrentRepository
ファイルを表示 Open project: Microsoft/VSSDK-Extensibility-Samples Class Usage Examples

Public Methods

Method Description
AddFileToSourceControl ( string file ) : void

Adds the specified file to source control; the file must be part of a controlled project

AddProjectsToSourceControl ( Hashtable &hashUncontrolledProjects, bool addSolutionToSourceControl ) : void

Adds the specified projects and solution to source control

AnyItemsUnderSourceControl ( int &pfResult ) : int
BeginPublishWorkflowAsync ( CancellationToken cancellationToken ) : System.Threading.Tasks.Task
BeginQuerySaveBatch ( ) : int
BranchUIClickedAsync ( ISccUIClickedEventArgs args, CancellationToken cancellationToken ) : System.Threading.Tasks.Task

Handler called when the branch UI is clicked

The UI has an upward arrow visually indicating that a menu would be displayed which when clicked would lead the user to a workflow that enables the switching of branches

BrowseForProject ( string &pbstrDirectory, int &pfOK ) : int
CancelAfterBrowseForProject ( ) : int
CheckinFile ( string file ) : void

Checks in the specified file

CheckoutFile ( string file ) : void

Checkout the specified file from source control

CheckoutFileAndRefreshProjectGlyphs ( string file ) : void

Checkout the file from source control and refreshes the glyphs of the files containing the file

DeclareReloadableFile ( [ pszMkDocument, [ rgf, [ pFileInfo ) : int
DeclareUnreloadableFile ( [ pszMkDocument, [ rgf, [ pFileInfo ) : int
Dispose ( ) : void
EndQuerySaveBatch ( ) : int
GetControlledProjectsContainingFile ( string file ) : IList

Returns a list of controlled projects containing the specified file

GetFileStatus ( string filename ) : SourceControlStatus

Returns the source control status of the specified file

GetGlyphTipText ( [ phierHierarchy, [ itemidNode, string &pbstrTooltipText ) : int

Called by solution explorer to provide tooltips for items. Returns a text describing the source control status of the item.

GetSccGlyph ( [ cFiles, [ rgpszFullPaths, [ rgsiGlyphs, [ rgdwSccStatus ) : int

Provide source control icons for the specified files and returns scc status of files

GetSccGlyphFromStatus ( [ dwSccStatus, [ psiGlyph ) : int

Determines the corresponding scc status glyph to display, given a combination of scc status flags

IsInstalled ( int &pbInstalled ) : int

Returns whether the source control provider is fully installed

IsProjectControlled ( IVsHierarchy pHier ) : bool

Checks whether the specified project or solution (pHier==null) is under source control

IsProjectOffline ( IVsHierarchy pHier ) : bool

Checks whether the specified project or solution (pHier==null) is offline

IsReloadable ( [ pszMkDocument, int &pbResult ) : int
OnAfterAddDirectoriesEx ( [ cProjects, [ cDirectories, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgFlags ) : int
OnAfterAddFilesEx ( [ cProjects, [ cFiles, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgFlags ) : int

Implement this function to update the project scc glyphs when the items are added to the project. If a project doesn't call GetSccGlyphs as they should do (as solution folder do), this will update correctly the glyphs when the project is controled

OnAfterCloseSolution ( [ pUnkReserved ) : int
OnAfterLoadProject ( [ pStubHierarchy, [ pRealHierarchy ) : int
OnAfterMergeSolution ( [ pUnkReserved ) : int
OnAfterOpenProject ( [ pHierarchy, [ fAdded ) : int
OnAfterOpenSolution ( [ pUnkReserved, [ fNewSolution ) : int
OnAfterRemoveDirectories ( [ cProjects, [ cDirectories, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgFlags ) : int
OnAfterRemoveFiles ( [ cProjects, [ cFiles, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgFlags ) : int
OnAfterRenameDirectories ( [ cProjects, [ cDirs, [ rgpProjects, [ rgFirstIndices, [ rgszMkOldNames, [ rgszMkNewNames, [ rgFlags ) : int
OnAfterRenameFiles ( [ cProjects, [ cFiles, [ rgpProjects, [ rgFirstIndices, [ rgszMkOldNames, [ rgszMkNewNames, [ rgFlags ) : int

Implement OnAfterRenameFiles event to rename a file in the source control store when it gets renamed in the project Also, rename the store if the project itself is renamed

OnAfterSaveUnreloadableFile ( [ pszMkDocument, [ rgf, [ pFileInfo ) : int
OnAfterSccStatusChanged ( [ cProjects, [ cFiles, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgdwSccStatus ) : int
OnBeforeCloseProject ( [ pHierarchy, [ fRemoved ) : int
OnBeforeCloseSolution ( [ pUnkReserved ) : int
OnBeforeUnloadProject ( [ pRealHierarchy, [ pStubHierarchy ) : int
OnQueryAddDirectories ( [ pProject, [ cDirectories, [ rgpszMkDocuments, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
OnQueryAddFiles ( [ pProject, [ cFiles, [ rgpszMkDocuments, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
OnQueryCloseProject ( [ pHierarchy, [ fRemoving, [ pfCancel ) : int
OnQueryCloseSolution ( [ pUnkReserved, [ pfCancel ) : int
OnQueryRemoveDirectories ( [ pProject, [ cDirectories, [ rgpszMkDocuments, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
OnQueryRemoveFiles ( [ pProject, [ cFiles, [ rgpszMkDocuments, [ rgFlags, [ pSummaryResult, [ rgResults ) : int

Implement OnQueryRemoveFilesevent to warn the user when he's deleting controlled files. The user gets the chance to cancel the file removal.

OnQueryRenameDirectories ( [ pProject, [ cDirs, [ rgszMkOldNames, [ rgszMkNewNames, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
OnQueryRenameFiles ( [ pProject, [ cFiles, [ rgszMkOldNames, [ rgszMkNewNames, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
OnQueryUnloadProject ( [ pRealHierarchy, [ pfCancel ) : int
QueryEditFiles ( [ rgfQueryEdit, [ cFiles, [ rgpszMkDocuments, [ rgrgf, [ rgFileInfo, uint &pfEditVerdict, uint &prgfMoreInfo ) : int

Called by projects and editors before modifying a file The function allows the source control systems to take the necessary actions (checkout, flip attributes) to make the file writable in order to allow the edit to continue There are a lot of cases to deal with during QueryEdit/QuerySave. - called in commmand line mode, when UI cannot be displayed - called during builds, when save shoudn't probably be allowed - called during projects migration, when projects are not open and not registered yet with source control - checking out files may bring new versions from vss database which may be reloaded and the user may lose in-memory changes; some other files may not be reloadable - not all editors call QueryEdit when they modify the file the first time (buggy editors!), and the files may be already dirty in memory when QueryEdit is called - files on disk may be modified outside IDE and may have attributes incorrect for their scc status - checkouts may fail The sample provider won't deal with all these situations, but a real source control provider should!

QuerySaveFile ( [ pszMkDocument, [ rgf, [ pFileInfo, uint &pdwQSResult ) : int

Called by editors and projects before saving the files The function allows the source control systems to take the necessary actions (checkout, flip attributes) to make the file writable in order to allow the file saving to continue

QuerySaveFiles ( [ rgfQuerySave, [ cFiles, [ rgpszMkDocuments, [ rgrgf, [ rgFileInfo, uint &pdwQSResult ) : int

Called by editors and projects before saving the files The function allows the source control systems to take the necessary actions (checkout, flip attributes) to make the file writable in order to allow the file saving to continue

RegisterSccProject ( [ pscp2Project, [ pszSccProjectName, [ pszSccAuxPath, [ pszSccLocalPath, [ pszProvider ) : int

One of the most important methods in a source control provider, is called by projects that are under source control when they are first opened to register project settings

RepositoryUIClickedAsync ( ISccUIClickedEventArgs args, CancellationToken cancellationToken ) : System.Threading.Tasks.Task

Handler called when the repository UI is clicked

Typically the user would expect to be lead to a workflow that would allow the user to switch repositories

SccProviderService ( SccProvider sccProvider ) : System
SetActive ( ) : int
SetInactive ( ) : int
ToggleOfflineStatus ( IVsHierarchy pHier ) : void

Toggle the offline status of the specified project or solution

UnpublishedCommitsUIClickedAsync ( ISccUIClickedEventArgs args, CancellationToken cancellationToken ) : System.Threading.Tasks.Task
UnregisterSccProject ( [ pscp2Project ) : int

Called by projects registered with the source control portion of the environment before they are closed.

Private Methods

Method Description
OnAdvertisePublish ( ) : void

Raises the AdvertisePublish event

Method Details

AddFileToSourceControl() public method

Adds the specified file to source control; the file must be part of a controlled project
public AddFileToSourceControl ( string file ) : void
file string
return void

AddProjectsToSourceControl() public method

Adds the specified projects and solution to source control
public AddProjectsToSourceControl ( Hashtable &hashUncontrolledProjects, bool addSolutionToSourceControl ) : void
hashUncontrolledProjects Hashtable
addSolutionToSourceControl bool
return void

AnyItemsUnderSourceControl() public method

public AnyItemsUnderSourceControl ( int &pfResult ) : int
pfResult int
return int

BeginPublishWorkflowAsync() public method

public BeginPublishWorkflowAsync ( CancellationToken cancellationToken ) : System.Threading.Tasks.Task
cancellationToken System.Threading.CancellationToken
return System.Threading.Tasks.Task

BeginQuerySaveBatch() public method

public BeginQuerySaveBatch ( ) : int
return int

BranchUIClickedAsync() public method

Handler called when the branch UI is clicked
The UI has an upward arrow visually indicating that a menu would be displayed which when clicked would lead the user to a workflow that enables the switching of branches
public BranchUIClickedAsync ( ISccUIClickedEventArgs args, CancellationToken cancellationToken ) : System.Threading.Tasks.Task
args ISccUIClickedEventArgs
cancellationToken System.Threading.CancellationToken
return System.Threading.Tasks.Task

BrowseForProject() public method

public BrowseForProject ( string &pbstrDirectory, int &pfOK ) : int
pbstrDirectory string
pfOK int
return int

CancelAfterBrowseForProject() public method

public CancelAfterBrowseForProject ( ) : int
return int

CheckinFile() public method

Checks in the specified file
public CheckinFile ( string file ) : void
file string
return void

CheckoutFile() public method

Checkout the specified file from source control
public CheckoutFile ( string file ) : void
file string
return void

CheckoutFileAndRefreshProjectGlyphs() public method

Checkout the file from source control and refreshes the glyphs of the files containing the file
public CheckoutFileAndRefreshProjectGlyphs ( string file ) : void
file string
return void

DeclareReloadableFile() public method

public DeclareReloadableFile ( [ pszMkDocument, [ rgf, [ pFileInfo ) : int
pszMkDocument [
rgf [
pFileInfo [
return int

DeclareUnreloadableFile() public method

public DeclareUnreloadableFile ( [ pszMkDocument, [ rgf, [ pFileInfo ) : int
pszMkDocument [
rgf [
pFileInfo [
return int

Dispose() public method

public Dispose ( ) : void
return void

EndQuerySaveBatch() public method

public EndQuerySaveBatch ( ) : int
return int

GetControlledProjectsContainingFile() public method

Returns a list of controlled projects containing the specified file
public GetControlledProjectsContainingFile ( string file ) : IList
file string
return IList

GetFileStatus() public method

Returns the source control status of the specified file
public GetFileStatus ( string filename ) : SourceControlStatus
filename string
return SourceControlStatus

GetGlyphTipText() public method

Called by solution explorer to provide tooltips for items. Returns a text describing the source control status of the item.
public GetGlyphTipText ( [ phierHierarchy, [ itemidNode, string &pbstrTooltipText ) : int
phierHierarchy [
itemidNode [
pbstrTooltipText string
return int

GetSccGlyph() public method

Provide source control icons for the specified files and returns scc status of files
public GetSccGlyph ( [ cFiles, [ rgpszFullPaths, [ rgsiGlyphs, [ rgdwSccStatus ) : int
cFiles [
rgpszFullPaths [
rgsiGlyphs [
rgdwSccStatus [
return int

GetSccGlyphFromStatus() public method

Determines the corresponding scc status glyph to display, given a combination of scc status flags
public GetSccGlyphFromStatus ( [ dwSccStatus, [ psiGlyph ) : int
dwSccStatus [
psiGlyph [
return int

IsInstalled() public method

Returns whether the source control provider is fully installed
public IsInstalled ( int &pbInstalled ) : int
pbInstalled int
return int

IsProjectControlled() public method

Checks whether the specified project or solution (pHier==null) is under source control
public IsProjectControlled ( IVsHierarchy pHier ) : bool
pHier IVsHierarchy
return bool

IsProjectOffline() public method

Checks whether the specified project or solution (pHier==null) is offline
public IsProjectOffline ( IVsHierarchy pHier ) : bool
pHier IVsHierarchy
return bool

IsReloadable() public method

public IsReloadable ( [ pszMkDocument, int &pbResult ) : int
pszMkDocument [
pbResult int
return int

OnAfterAddDirectoriesEx() public method

public OnAfterAddDirectoriesEx ( [ cProjects, [ cDirectories, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgFlags ) : int
cProjects [
cDirectories [
rgpProjects [
rgFirstIndices [
rgpszMkDocuments [
rgFlags [
return int

OnAfterAddFilesEx() public method

Implement this function to update the project scc glyphs when the items are added to the project. If a project doesn't call GetSccGlyphs as they should do (as solution folder do), this will update correctly the glyphs when the project is controled
public OnAfterAddFilesEx ( [ cProjects, [ cFiles, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgFlags ) : int
cProjects [
cFiles [
rgpProjects [
rgFirstIndices [
rgpszMkDocuments [
rgFlags [
return int

OnAfterCloseSolution() public method

public OnAfterCloseSolution ( [ pUnkReserved ) : int
pUnkReserved [
return int

OnAfterLoadProject() public method

public OnAfterLoadProject ( [ pStubHierarchy, [ pRealHierarchy ) : int
pStubHierarchy [
pRealHierarchy [
return int

OnAfterMergeSolution() public method

public OnAfterMergeSolution ( [ pUnkReserved ) : int
pUnkReserved [
return int

OnAfterOpenProject() public method

public OnAfterOpenProject ( [ pHierarchy, [ fAdded ) : int
pHierarchy [
fAdded [
return int

OnAfterOpenSolution() public method

public OnAfterOpenSolution ( [ pUnkReserved, [ fNewSolution ) : int
pUnkReserved [
fNewSolution [
return int

OnAfterRemoveDirectories() public method

public OnAfterRemoveDirectories ( [ cProjects, [ cDirectories, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgFlags ) : int
cProjects [
cDirectories [
rgpProjects [
rgFirstIndices [
rgpszMkDocuments [
rgFlags [
return int

OnAfterRemoveFiles() public method

public OnAfterRemoveFiles ( [ cProjects, [ cFiles, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgFlags ) : int
cProjects [
cFiles [
rgpProjects [
rgFirstIndices [
rgpszMkDocuments [
rgFlags [
return int

OnAfterRenameDirectories() public method

public OnAfterRenameDirectories ( [ cProjects, [ cDirs, [ rgpProjects, [ rgFirstIndices, [ rgszMkOldNames, [ rgszMkNewNames, [ rgFlags ) : int
cProjects [
cDirs [
rgpProjects [
rgFirstIndices [
rgszMkOldNames [
rgszMkNewNames [
rgFlags [
return int

OnAfterRenameFiles() public method

Implement OnAfterRenameFiles event to rename a file in the source control store when it gets renamed in the project Also, rename the store if the project itself is renamed
public OnAfterRenameFiles ( [ cProjects, [ cFiles, [ rgpProjects, [ rgFirstIndices, [ rgszMkOldNames, [ rgszMkNewNames, [ rgFlags ) : int
cProjects [
cFiles [
rgpProjects [
rgFirstIndices [
rgszMkOldNames [
rgszMkNewNames [
rgFlags [
return int

OnAfterSaveUnreloadableFile() public method

public OnAfterSaveUnreloadableFile ( [ pszMkDocument, [ rgf, [ pFileInfo ) : int
pszMkDocument [
rgf [
pFileInfo [
return int

OnAfterSccStatusChanged() public method

public OnAfterSccStatusChanged ( [ cProjects, [ cFiles, [ rgpProjects, [ rgFirstIndices, [ rgpszMkDocuments, [ rgdwSccStatus ) : int
cProjects [
cFiles [
rgpProjects [
rgFirstIndices [
rgpszMkDocuments [
rgdwSccStatus [
return int

OnBeforeCloseProject() public method

public OnBeforeCloseProject ( [ pHierarchy, [ fRemoved ) : int
pHierarchy [
fRemoved [
return int

OnBeforeCloseSolution() public method

public OnBeforeCloseSolution ( [ pUnkReserved ) : int
pUnkReserved [
return int

OnBeforeUnloadProject() public method

public OnBeforeUnloadProject ( [ pRealHierarchy, [ pStubHierarchy ) : int
pRealHierarchy [
pStubHierarchy [
return int

OnQueryAddDirectories() public method

public OnQueryAddDirectories ( [ pProject, [ cDirectories, [ rgpszMkDocuments, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
pProject [
cDirectories [
rgpszMkDocuments [
rgFlags [
pSummaryResult [
rgResults [
return int

OnQueryAddFiles() public method

public OnQueryAddFiles ( [ pProject, [ cFiles, [ rgpszMkDocuments, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
pProject [
cFiles [
rgpszMkDocuments [
rgFlags [
pSummaryResult [
rgResults [
return int

OnQueryCloseProject() public method

public OnQueryCloseProject ( [ pHierarchy, [ fRemoving, [ pfCancel ) : int
pHierarchy [
fRemoving [
pfCancel [
return int

OnQueryCloseSolution() public method

public OnQueryCloseSolution ( [ pUnkReserved, [ pfCancel ) : int
pUnkReserved [
pfCancel [
return int

OnQueryRemoveDirectories() public method

public OnQueryRemoveDirectories ( [ pProject, [ cDirectories, [ rgpszMkDocuments, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
pProject [
cDirectories [
rgpszMkDocuments [
rgFlags [
pSummaryResult [
rgResults [
return int

OnQueryRemoveFiles() public method

Implement OnQueryRemoveFilesevent to warn the user when he's deleting controlled files. The user gets the chance to cancel the file removal.
public OnQueryRemoveFiles ( [ pProject, [ cFiles, [ rgpszMkDocuments, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
pProject [
cFiles [
rgpszMkDocuments [
rgFlags [
pSummaryResult [
rgResults [
return int

OnQueryRenameDirectories() public method

public OnQueryRenameDirectories ( [ pProject, [ cDirs, [ rgszMkOldNames, [ rgszMkNewNames, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
pProject [
cDirs [
rgszMkOldNames [
rgszMkNewNames [
rgFlags [
pSummaryResult [
rgResults [
return int

OnQueryRenameFiles() public method

public OnQueryRenameFiles ( [ pProject, [ cFiles, [ rgszMkOldNames, [ rgszMkNewNames, [ rgFlags, [ pSummaryResult, [ rgResults ) : int
pProject [
cFiles [
rgszMkOldNames [
rgszMkNewNames [
rgFlags [
pSummaryResult [
rgResults [
return int

OnQueryUnloadProject() public method

public OnQueryUnloadProject ( [ pRealHierarchy, [ pfCancel ) : int
pRealHierarchy [
pfCancel [
return int

QueryEditFiles() public method

Called by projects and editors before modifying a file The function allows the source control systems to take the necessary actions (checkout, flip attributes) to make the file writable in order to allow the edit to continue There are a lot of cases to deal with during QueryEdit/QuerySave. - called in commmand line mode, when UI cannot be displayed - called during builds, when save shoudn't probably be allowed - called during projects migration, when projects are not open and not registered yet with source control - checking out files may bring new versions from vss database which may be reloaded and the user may lose in-memory changes; some other files may not be reloadable - not all editors call QueryEdit when they modify the file the first time (buggy editors!), and the files may be already dirty in memory when QueryEdit is called - files on disk may be modified outside IDE and may have attributes incorrect for their scc status - checkouts may fail The sample provider won't deal with all these situations, but a real source control provider should!
public QueryEditFiles ( [ rgfQueryEdit, [ cFiles, [ rgpszMkDocuments, [ rgrgf, [ rgFileInfo, uint &pfEditVerdict, uint &prgfMoreInfo ) : int
rgfQueryEdit [
cFiles [
rgpszMkDocuments [
rgrgf [
rgFileInfo [
pfEditVerdict uint
prgfMoreInfo uint
return int

QuerySaveFile() public method

Called by editors and projects before saving the files The function allows the source control systems to take the necessary actions (checkout, flip attributes) to make the file writable in order to allow the file saving to continue
public QuerySaveFile ( [ pszMkDocument, [ rgf, [ pFileInfo, uint &pdwQSResult ) : int
pszMkDocument [
rgf [
pFileInfo [
pdwQSResult uint
return int

QuerySaveFiles() public method

Called by editors and projects before saving the files The function allows the source control systems to take the necessary actions (checkout, flip attributes) to make the file writable in order to allow the file saving to continue
public QuerySaveFiles ( [ rgfQuerySave, [ cFiles, [ rgpszMkDocuments, [ rgrgf, [ rgFileInfo, uint &pdwQSResult ) : int
rgfQuerySave [
cFiles [
rgpszMkDocuments [
rgrgf [
rgFileInfo [
pdwQSResult uint
return int

RegisterSccProject() public method

One of the most important methods in a source control provider, is called by projects that are under source control when they are first opened to register project settings
public RegisterSccProject ( [ pscp2Project, [ pszSccProjectName, [ pszSccAuxPath, [ pszSccLocalPath, [ pszProvider ) : int
pscp2Project [
pszSccProjectName [
pszSccAuxPath [
pszSccLocalPath [
pszProvider [
return int

RepositoryUIClickedAsync() public method

Handler called when the repository UI is clicked
Typically the user would expect to be lead to a workflow that would allow the user to switch repositories
public RepositoryUIClickedAsync ( ISccUIClickedEventArgs args, CancellationToken cancellationToken ) : System.Threading.Tasks.Task
args ISccUIClickedEventArgs
cancellationToken CancellationToken
return System.Threading.Tasks.Task

SccProviderService() public method

public SccProviderService ( SccProvider sccProvider ) : System
sccProvider SccProvider
return System

SetActive() public method

public SetActive ( ) : int
return int

SetInactive() public method

public SetInactive ( ) : int
return int

ToggleOfflineStatus() public method

Toggle the offline status of the specified project or solution
public ToggleOfflineStatus ( IVsHierarchy pHier ) : void
pHier IVsHierarchy
return void

UnpublishedCommitsUIClickedAsync() public method

public UnpublishedCommitsUIClickedAsync ( ISccUIClickedEventArgs args, CancellationToken cancellationToken ) : System.Threading.Tasks.Task
args ISccUIClickedEventArgs
cancellationToken CancellationToken
return System.Threading.Tasks.Task

UnregisterSccProject() public method

Called by projects registered with the source control portion of the environment before they are closed.
public UnregisterSccProject ( [ pscp2Project ) : int
pscp2Project [
return int