' --------------------------------------------------------------- ' File: Fix Associations.ebs ' ' Description: ' Modifies RequisitePro project associations so that Path Maps are used ' ' Created 07/21/2000 by KatrinaW ' ' Entry Points: Main ' ' Created by Rational Software Corporation ' (C) Copyright Rational Software Corporation 1996 All Rights Reserved '------------------------------------------------------------------------------------------------------- Public CurrentAssociationsArray() As String Public NewAssociationsArray() As String Public lcount As Integer Public pcount As Integer Public Fix As Boolean Function AssociationsProc(controlname$, action%, suppvalue%) As Integer '---------------------------------------------- 'If user presses a button do appropriate action '---------------------------------------------- 'Print controlname$, action%, suppvalue% Select Case action% Case 2 If controlname$ = "Cancel" Then End ElseIf controlname$ = "OK" Then Fix = True End If End Select End Function Sub GetAssociations (aCat As Category, Indent As Integer, Fix As Boolean) Dim theProperties As New PropertyCollection Dim aProperty As Property Dim theCategory As Category Dim theUseCases As New UseCaseCollection Dim aUseCase As New UseCase Dim theVirtualPath As String Dim thePathMap As PathMap Dim theActualPath As String Set thePathMap = RoseApp.PathMap Set theProperties = aCat.GetAllProperties () For k% = 1 To theProperties.Count ReDim Preserve CurrentAssociationsArray$(0 To lcount + 1) ReDim Preserve NewAssociationsArray$(0 To pcount + 1) Set aProperty = theProperties.GetAt (k%) If aProperty.Name Like "ReqProProjectPath" Then If Len(aProperty.Value) > 0 Then theActualPath = aProperty.Value lcount = lcount + 1 CurrentAssociationsArray$(lcount) = String$(Indent, " ") & aCat.Name & String$(10, " ") & theActualPath theVirtualPath = RoseApp.PathMap.GetVirtualPath(theActualPath) If Len(theVirtualPath) > 0 And Not (theVirtualPath = theActualPath) Then NewAssociationsArray$(pcount) = String$(Indent, " ") & aCat.Name & " --> " & theVirtualPath pcount = pcount + 1 End If If Fix Then Set aProperty.Value = theVirtualPath End If End If End If Next k% Set theUseCases = aCat.UseCases For k% = 1 To theUseCases.Count ReDim Preserve CurrentAssociationsArray$(0 To lcount + 1) ReDim Preserve NewAssociationsArray$(0 To pcount + 1) Set aUseCase = theUseCases.GetAt (k%) Set theProperties = aUseCase.GetAllProperties() For l% = 1 To theProperties.Count Set aProperty = theProperties.GetAt(l%) Select Case aProperty.Name Case "ReqProProjectPath" If Len(aProperty.Value) > 0 Then theActualPath = aProperty.Value lcount = lcount + 1 CurrentAssociationsArray$(lcount) = String$(Indent, " ") & aUseCase.Name & String$(10, " ") & theActualPath theVirtualPath = RoseApp.PathMap.GetVirtualPath(theActualPath) If Len(theVirtualPath) > 0 And Not (theVirtualPath = theActualPath) Then NewAssociationsArray$(pcount) = String$(Indent, " ") & aUseCase.Name & " --> " & theVirtualPath pcount = pcount + 1 End If If Fix Then Set aProperty.Value = theVirtualPath End If End If End Select Next l% Next k% For i% = 1 To aCat.Categories.Count GetAssociations aCat.Categories.GetAt (i%), Indent + 4, Fix Next i% End Sub Sub AssociationsReport(myModel As Model) Dim theUseCases As UseCaseCollection Dim theProperties As PropertyCollection Dim aProperty As Property Dim Indent As Integer lcount = 0 pcount = 0 Set theProperties = myModel.GetAllProperties() For i% = 1 To theProperties.Count ReDim Preserve CurrentAssociationsArray$(0 To lcount + 1) ReDim Preserve NewAssociationsArray$(0 To pcount + 1) Set aProperty = theProperties.GetAt (i%) If aProperty.Name Like "ReqProProjectPath" Then If Len(aProperty.Value) > 0 Then theActualPath = aProperty.Value CurrentAssociationsArray$(lcount) = "The Model" & String$(10, " ") & theActualPath theVirtualPath = RoseApp.PathMap.GetVirtualPath(theActualPath) If Len(theVirtualPath) > 0 And Not (theVirtualPath = theActualPath) Then NewAssociationsArray$(pcount) = "The Model" & " --> " & theVirtualPath pcount = pcount + 1 End If If Fix Then Set aProperty.Value = theVirtualPath End If End If End If Next i% GetAssociations myModel.RootUseCaseCategory, 0, Fix End Sub Sub Main Erase NewAssociationsArray$ Erase CurrentAssociationsArray$ Fix = False AssociationsReport (RoseApp.CurrentModel) Begin Dialog AssociationsDialog 22,40,452,214,"RequisitePro Associations",.AssociationsProc OKButton 332,192,40,14 CancelButton 396,192,40,14 GroupBox 4,20,432,64,"Current Associations",.CRGroup ListBox 8,28,425,48,CurrentAssociationsArray,.CurrAssoc GroupBox 4,100,432,65,"Associations to be changed",.CRGroup2 ListBox 8,108,425,48,NewAssociationsArray,.NewAssoc Text 8,175,350,10,"Select OK to make changes or CANCEL to leave associations as they are:",.Text2,"Comic Sans MS",10,ebBold End Dialog Dim MyDialog As AssociationsDialog result% = Dialog (MyDialog) If Fix Then AssociationsReport (RoseApp.CurrentModel) MsgBox "Your changes have been made. Please remember to save your model!" End If End Sub