Hello Bill, you can try also with the attached technote and the script from it.
Hope this helps, Dejan -----Original Message----- From: Bill Richmond [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 28, 2001 10:28 PM To: [EMAIL PROTECTED] Subject: (ROSE) RoseScript help needed - traversing packages Greetings, I know this is an easy question, but I haven't been able to track it down. I would greatly appreciate any help! I want to (using REI) work with classes that are in a certain package that is several packages deep. For example: "Logical View::Package Alpha::Package Beta::Participating Classes" Also note that there are other packages in the model named "Participating Classes" and several of the class names in this package are listed elsewhere so I can't simply search for one of these names. What I am looking for is a way to get a hold of a given class (say class1) that resides in the above mentioned package structure. Any help would be greatly appreciated. Thanks in advance, Bill _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp ************************************************************************ * Rose Forum is a public venue for ideas and discussions. * For technical support, visit http://www.rational.com/support * * Admin.Subscription Requests: [EMAIL PROTECTED] * Archive of messages: http://www.rational.com/support/usergroups/rose/rose_forum.jsp * Other Requests: [EMAIL PROTECTED] * * To unsubscribe from the list, please send email * * To: [EMAIL PROTECTED] * Subject:<BLANK> * Body: unsubscribe rose_forum * *************************************************************************
FindClass.ebs
Description: Binary data
TechnoteID 23036 -- How to find the usage of a Class on all Class diagrams ?
PRODUCT: Rose
OS: WIN
DEFECT #:
PATCH #:
REFERENCES:
CREATED: 09-Nov-2001
REVISED: 28-Nov-2001
QUESTION: How to find the usage of a Class on all Class diagrams?
ANSWER:
You can go to Edit -> Find and enter there the Class name (be aware that the
search is case sensitive).
But the problem using this function is that it will report the usage of all
Classes with the same name, so there is no way to make a difference between
classes in different Packages (or Namespaces).
For unique identification of the Class you can use the script given below. To
use it, just select in the Browser the class you wish to find on the Class
diagrams. Then run the script. It will show the Diagrams (with a fully
qualified name), on which the Class is used, in a Viewport window, and it will
write the same to a text file C:\test.dat (of course you can change this
location in the script).
'===<BEGIN SCRIPT>===================================
'****************************************************************'
'FindClass.ebs
'
'This script finds all the appearances of a class on all
'Class diagrams.
'To use it, select the desired class in the Browser and
'run the script.
'
'Written by:
'Dejan Stojanovic [EMAIL PROTECTED] (c) Rational 2001
'
'****************************************************************'
Option Explicit
Sub Main
Dim theModel As Model
Dim actDiagrams As ClassDiagramCollection
Dim theDiagram As Diagram
Dim theClassDiagram As ClassDiagram
Dim theClass As Class
Dim theSelClass As Class
Dim theClassView As ClassView
Dim theClasses As ClassCollection
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim theCategory As Category
Dim AllCats As CategoryCollection
Set theModel = RoseApp.CurrentModel
Set AllCats = theModel.GetAllCategories
Open "C:\test.dat" For Output As #1
Viewport.Open
If (roseApp.CurrentModel.GetSelectedClasses.count > 0 ) Then
Set theSelClass = roseApp.CurrentModel.GetSelectedClasses.GetAt(1)
Print #1,"Found Class " & theSelClass.getqualifiedname() & " in following
diagrams:"
Print "Found Class " & theSelClass.getqualifiedname() & " in following
diagrams:"
For k=1 To theModel.GetAllCategories.count
Set theCategory = theModel.GetAllCategories.GetAt (k)
Set actDiagrams = theCategory.ClassDiagrams
'Cycle through the diagrams
For i=1 To actDiagrams.Count
Set theDiagram = actDiagrams.GetAt (i)
If theDiagram.CanTypeCast (theClassDiagram) Then
Set theClassDiagram = theDiagram.TypeCast (theClassDiagram)
Set theClasses = theClassDiagram.GetClasses ()
'Cycle through all the classes in a Class diagram
For j=1 To theClasses.Count
Set theClass = theClasses.GetAt(j)
If (theClass.getqualifiedname() = theSelClass.getqualifiedname()) Then
Print #1, theClassDiagram.getqualifiedname()
Print theClassDiagram.getqualifiedname()
End If
Next j
End If
Next i
Next k
Else
msgbox "Please select a class and run the script again!"
End If
End Sub
'===<END SCRIPT>=====================================
For more information, contact Rational Software Technical Support.
DISCLAIMER
THE MATERIAL AND/OR SOFTWARE IS PROVIDED `AS IS�. RATIONAL AND ITS THIRD PARTY
LICENSORS DISCLAIM ALL WARRANTIES EXPRESS OR IMPLIED INCLUDING, WITHOUT
LIMITATION, THE WARRANTY OF MERCHANTABILITY, NON-INFRINGEMENT, TITLE OR FITNESS
FOR A PARTICULAR PURPOSE OR ARISING OUT OF THE COURSE OF DEALING, USAGE OR
TRADE PRACTICE, CONTENT OF THE MATERIAL OR SOFTWARE. RATIONAL MAKES NO
WARRANTIES OR REPRESENTATIONS REGARDING THE ACCURACY OR COMPLETENESS OF THE
MATERIAL AND/OR SOFTWARE PROVIDED OR THAT IT WILL MEET LICENSEE�S REQUIREMENTS
OR THAT THE MATERIAL AND/OR SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL
RATIONAL OR ITS LICENSORS BE LIABLE TO LICENSEE OR A THIRD PARTY FOR ANY
INDIRECT, DIRECT, NEGLIGENCE, SPECIAL, OR CONSEQUENTIAL DAMAGES INCLUDING LOST
PROFITS, LOST DATA AND THE LIKE ARISING OUT OF OR IN CONNECTION WITH THIS
RECEIPT OF MATERIAL AND/OR SOFTWARE EVEN IF RATIONAL HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES
