home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / drsude.tcl < prev    next >
Text File  |  1997-05-20  |  6KB  |  178 lines

  1. # Copyright (c) 1997 by Cayenne Software Inc.
  2. #
  3. # This software is furnished under a license and may be used only in
  4. # accordance with the terms of such license and with the inclusion of
  5. # the above copyright notice. This software or any other copies thereof
  6. # may not be provided or otherwise made available to any other person.
  7. # No title to and ownership of the software is hereby transferred.
  8. #
  9. # The information in this software is subject to change without notice
  10. # and should not be construed as a commitment by Cayenne Software Inc
  11. #
  12. #---------------------------------------------------------------------------
  13. #
  14. #       File            : @(#)drsude.tcl    /main/hindenburg/9 23 Jan 1997
  15. #       Author          : H. Broeze
  16. #       Original date   : 14 Januari 1997
  17. #       Description     : DOORS navigation to ObjectTeam
  18. #
  19. #---------------------------------------------------------------------------
  20. #
  21.  
  22.  
  23. OtkRegister::extGui
  24.  
  25. source [m4_path_name tcl libocl.tcl]
  26.  
  27. require platform.tcl
  28. require procs.tcl
  29. require messagehdl.tcl
  30.  
  31. set caller ""
  32. set args $argv
  33. regsub -all {\\} $args "" args
  34. set parentOTVersionsOfFileDict [Dictionary new]
  35. set parentOTVersionsOfSystemDict [Dictionary new]
  36. set parentOTVersionsOfPhaseDict [Dictionary new]
  37. set projSelectedItems [lindex $args 0]
  38. global projName
  39. set projName [lindex $args 1]
  40. if {[llength $args] >= 5} {
  41.     set phaseName [lindex $args 3]
  42.     $parentOTVersionsOfPhaseDict contents [lindex $args 4]
  43. }
  44. if {[llength $args] >= 7} {
  45.     set systemName [lindex $args 5] 
  46.     $parentOTVersionsOfSystemDict contents [lindex $args 6]
  47. }
  48.  
  49. if {[llength $args] == 11 || [llength $args] == 12} {
  50.     set fileType [lindex $args 7]
  51.     set fileName [lindex $args 9] 
  52.     $parentOTVersionsOfFileDict contents [lindex $args 10]
  53. }
  54. if {[llength $args] >= 15} {
  55.     set fileType [lindex $args 11]
  56.     set fileName [lindex $args 9]/[lindex $args 13] 
  57.     $parentOTVersionsOfFileDict contents [lindex $args 14]
  58. }
  59. set configOptions ""
  60. if [catch {set cc [ClientContext::global]}] {
  61.     set cc [ClientContext::global]
  62. }
  63. set corporate [$cc currentCorporate]
  64. set proj [$corporate findProject $projName]
  65. if [$proj isNil] {
  66.     wmtkerror "Project with name '$projName' does not exist"
  67.     .main popUp
  68.     return
  69. }
  70. $parentOTVersionsOfFileDict foreach fileVersion systemVersions {
  71.     foreach systemVersion $systemVersions {
  72.     foreach phaseV [$parentOTVersionsOfSystemDict set $systemVersion] {
  73.         foreach confVId [$parentOTVersionsOfPhaseDict set $phaseV] {
  74.         if {[lsearch $configOptions $confVId] == -1} {
  75.             lappend configOptions $confVId
  76.         }
  77.         }
  78.     }
  79.     }
  80. }
  81.         
  82. require "diagramedi.tcl"
  83.  
  84. sourceOptional u_ude
  85. set editorType $fileType
  86. set type $fileType
  87.  
  88. if {[string length $fileType] != 3 && $fileType != "Attribute" && $fileType != "Operation"} {
  89.     set editorType [lindex $args 11]
  90. }
  91.  
  92. require "${editorType}editor.tcl"
  93. [string toupper $editorType]Editor new .main \
  94.     -caller "$caller" 
  95.  
  96. set fileDict [Dictionary new]
  97. proc selectFromObject {confV phaseV systemV itemName itemType } {
  98.     set workItem [$systemV findDeclaration $itemName cl $confV]
  99.     set item [$workItem item]
  100.     $item getDecompositions $phaseV $systemV decompComponents $editorType resultSystems resultFiles
  101.     set fileNames ""
  102.     foreach graph $resultFiles {
  103.     set fileName  [[$graph file] name]
  104.     $fileDict set $fileName $graph
  105.     lappend fileNames $fileName
  106.     }
  107.     if {[llength $fileNames] == 0} {
  108.     wmtkinfo "$itemType $itemName does not exist in any $editorType diagram" 
  109.     }
  110.     if {[llength $fileNames] ==  1} {
  111.     fileSelected $confV $systemV [$fileDict set $fileNames]
  112.     }
  113.     if {[llength $fileNames] > 1} {
  114.     ListDialog new .main.selectFile \
  115.         -message "Select File Name/Version"\
  116.         -okPressed { 
  117.             set selFileName [.main.selectFile selectedSet]
  118.             set fileVersion [$fileDict set $selFileName]
  119.             .main fileVersion $fileVersion
  120.             .main startEdit $fileVersion
  121.         }
  122.     .main.selectFile entrySet $fileNames
  123.     .main.selectFile popUp
  124.     }
  125.     systemSelected $confV $systemV
  126.     .main popUp
  127. }
  128. proc findFile { $proj configV } {
  129.     set configVList [split $configV .]
  130.      set confName [lindex $configVList 0]
  131.      set confVersion [lindex $configVList 1]
  132.     set configV [$proj findConfigVersion $confName $confVersion]
  133.     set phaseV [$configV findPhaseVersion $phaseName $phaseName]
  134.     set systemV [$phaseV findSystemVersion $systemName system]
  135.     if {[lsearch "Class UseCase" $fileType] != -1} {
  136.         selectFromObject $configV $phaseV $systemV $fileName $fileType
  137.     } else {
  138.         set fileV [$systemV findFileVersion $fileName $fileType]
  139.         if ![$fileV isNil] {
  140.         fileSelected $configV $systemV $fileV
  141.         } else {
  142.         systemSelected $configV $systemV
  143.         if {[string length $fileType] > 3} { 
  144.             wmtkinfo "${fileType}s are not supported for navigation"
  145.         } else {
  146.             wmtkinfo "$fileType $fileName does not exist" 
  147.         }
  148.         }
  149.     }
  150. }
  151.  
  152.  
  153. proc systemSelected { configV systemV } { 
  154.     .main configVersion $configV
  155.     .main systemVersion $systemV
  156. }
  157.  
  158. proc fileSelected { configV systemV fileV} { 
  159.     systemSelected $configV $systemV
  160.     .main fileVersion $fileV
  161.     .main startEdit $fileV
  162. }
  163.  
  164. if {[llength $configOptions] > 1 } {
  165.     ListDialog new .main.listDialog \
  166.     -message "Select Configuration Name/Version"\
  167.     -okPressed { 
  168.             .main popUp
  169.             .main ready
  170.             findFile $proj [.main.listDialog selectedSet]
  171.     }
  172.     .main.listDialog entrySet $configOptions
  173.     .main.listDialog popUp
  174. } else {
  175.     findFile $proj $configOptions
  176.     .main popUp
  177. }
  178.