' プロジェクト ツリーにプロジェクトとフォルダを表示します。
Private Function FolderInfo(Folder As CCFolder, TabStr As String) As String
Dim StrProj As String
StrProj = vbCrLf & TabStr & "Folder " & Folder.Title & " contains: " & vbCrLf
' サブフォルダはすべて再帰的に処理します。
If Folder.SubFolders.Count <> 0 Then
Dim ChildFolder As CCFolder
For Each ChildFolder In Folder.SubFolders
StrProj = StrProj & FolderInfo(ChildFolder, TabStr & vbTab)
Next
End If
' フォルダ内のすべてのプロジェクトのタイトルを集め、レベル間隔を追加します。
Dim Projects As CCProjects
Set Projects = Folder.Projects
If Projects.Count <> 0 Then
StrProj = StrProj & vbCrLf
For Each Project In Projects
StrProj = StrProj & TabStr & Project.Title & vbCrLf
Next
Else
StrProj = StrProj & TabStr & "no projects" & vbCrLf
End If
FolderInfo = StrProj
End Function
' 最上位のオブジェクトに接続します。
Dim CC As New ClearCase.Application
' ¥projects というタグが付いたプロジェクト VOB を取得します。
Dim PVOB As CCProjectVOB
On Error Resume Next
Set PVOB = CC.ProjectVOB("¥projects")
If Err.Number <> 0 Then
MsgBox "CC.ProjectVOB returned error: " & Err.Description
Else
' Get the root folder in the project VOB
Dim Folder As CCFolder
On Error Resume Next
Set Folder = PVOB.RootFolder
If Err.Number <> 0 Then
MsgBox "PVOB.RootFolder returned error: " & Err.Description
Else
MsgBox "Projects contained in the project tree" & _
vbCrLf & FolderInfo(Folder, "")
End If
End If