'This script cleans the "sc" tool properties making possible 'to put the model into new VSS project. 'Created by Zbigniew Babiej, Rational Software. Option Explicit Dim myModel As Model Sub ResetSCAddIn Dim theAddins As RoseAddInCollection Dim i As Integer Dim imax As Integer Dim AddInName As String Dim anAddIn As RoseAddIn Set theAddIns = RoseApp.AddInManager.AddIns imax = theAddIns.Count For i = 1 To imax Set anAddIn = TheAddIns.GetAt(i) AddInName = anAddIn.Name If AddInName = "Version Control" Then anAddIn.Deactivate anAddIn.Activate End If Next End Sub Sub OverrideSourceControlProperty(aUnit As ControllableUnit, aLevel As Integer, aProperty As String, aNewValue As String) Dim aValue As String Dim IsOverridden As Boolean aValue = aUnit.GetPropertyValue ("sc", aProperty) If Len(aValue) > 0 Then Print , String(aLevel * 8, " ") & "### " & aProperty & " = " & aValue Print , String(aLevel * 8, " ") & "### " & "Overidden to..." IsOverridden = aUnit.OverrideProperty("sc", aProperty, aNewValue) If IsOverridden Then aValue = aUnit.GetPropertyValue ("sc", aProperty) Print , String(aLevel * 8, " ") & "### " & aProperty & " = " & aValue Else MsgBox "Property Overriding failed !" End If End If End Sub Sub ProcessTheUnit(aUnit As ControllableUnit, aLevel As Integer) Dim theUnits As ControllableUnitCollection Dim theChildUnits As ControllableUnitCollection Dim i, imax As Integer Dim fName As String Dim IsSaved As Boolean 'Diplay the unit name Print , String(aLevel * 8, " ") & aUnit.Name If Not aUnit.IsLoaded Then MsgBox aUnit.Name + " is not loaded !" End End If ' Override the sc properties with empty string OverrideSourceControlProperty aUnit, aLevel, "SourceControlModelProperties" , "" OverrideSourceControlProperty aUnit, aLevel, "SourceControlProject" , "" OverrideSourceControlProperty aUnit, aLevel, "SourceControlSpec" , "" OverrideSourceControlProperty aUnit, aLevel, "SourceControlDeploymentUnit" , "" OverrideSourceControlProperty aUnit, aLevel, "SourceControlPath" , "$ROSEHOME" 'REI doesn't set up the Dirty flag, so SaveAs() is used If aUnit.IsControlled Then fName = aUnit.GetFileName isSaved = aUnit.SaveAs(fName) If Not IsSaved Then MsgBox "The unit: '" + aUnit.Name + "' controlled in " + aUnit.GetFileName + " could not be saved." + Chr$(13) + Chr$(10) + "Check Read-Only attributes of your *.cat files." End End If End If ' Get all unitd belonging to aUnit and process them Set theChildUnits = aUnit.GetSubUnitItems() ' Get the upper bound of the child categories collection imax = theChildUnits.Count ' Go through all child units For i = 1 To imax ProcessTheUnit theChildUnits.GetAt(i), aLevel + 1 Next i End Sub ' Main routine Sub Main Dim theCategory As Category Dim theCategories As CategoryCollection Dim i As Integer Dim imax As Integer 'Init the output Viewport.Open ViewPort.Clear 'Set up the model Set myModel = RoseApp.CurrentModel ProcessTheUnit MyModel.RootUseCaseCategory, 0 ProcessTheUnit MyModel.RootCategory, 0 ProcessTheUnit MyModel.RootSubsystem, 0 'REI doesn't set up the Dirty flag, so SaveAs() is used RoseApp.SaveAs myModel.GetFileName, False 'Reset must be done in order to get rid of check-in/out package icons ResetSCAddIn 'Looks like everything went OK ;o) MsgBox "Operation finished." End Sub