home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)diagramsel.tcl /main/hindenburg/2
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)diagramsel.tcl /main/hindenburg/2 8 Oct 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- # End user added include file section
-
-
- Class DiagramSelHandler : {ListDialog} {
- constructor
- method destructor
- method handle
- method handleOkPressed
- method popUp
- method editCAD
- method browser
- method addDecomposition
- method removeDecomposition
- attribute command
- attribute _browser
- attribute decompositionSet
- }
-
- constructor DiagramSelHandler {class this name} {
- set this [ListDialog::constructor $class $this $name]
- $this decompositionSet [List new]
- # Start constructor user section
- $this config \
- -okPressed {%this handleOkPressed} \
- -helpPressed ".main helpOnName selectDiagram" \
- -selectionPolicy BROWSE \
- -rowCount 4 \
- -font "courier-normal-12"
- # End constructor user section
- return $this
- }
-
- method DiagramSelHandler::destructor {this} {
- set ref [$this _browser]
- if {$ref != ""} {
- $ref _startEditCADHandler ""
- }
- # Start destructor user section
- # End destructor user section
- }
-
- method DiagramSelHandler::handle {this sysV item} {
- set configV [[[$this browser] ccontext] currentConfig]
- if [$sysV isNil] {
- set phaseV [[[$this browser] ccontext] currentPhase]
- $phaseV getDecompositions $item $configV \
- decompComponents $CAD_TYPE systems files
- } else {
- $sysV getDecompositions $item $configV \
- decompComponents $CAD_TYPE systems files
- }
- [$this decompositionSet] contents $files
- if {[llength $files] == 0} {
- wmtkerror "Item '[$item name]' does not have decompositions"
- return
- }
- if {[llength $files] == 1} {
- $this [$this command] [lindex $files 0]
- return
- }
- $this popUp
- }
-
- method DiagramSelHandler::handleOkPressed {this} {
- set idx [lsearch [$this entrySet] [lindex [$this selectedSet] 0]]
- if {$idx != -1} {
- $this [$this command] \
- [lindex [[$this decompositionSet] contents] $idx]
- }
- }
-
- method DiagramSelHandler::popUp {this} {
- set maxNameLength [string length "Name"]
- [$this decompositionSet] foreach fileV {
- set length [string length [[$fileV file] name]]
- if {$maxNameLength < $length} {
- set maxNameLength $length
- }
- }
- set formatString "%-${maxNameLength}.${maxNameLength}s %s"
- $this message "Select CAD:\n\n[\
- format $formatString "Name" "System Name"]"
- set entrySet ""
- [$this decompositionSet] foreach fileV {
- lappend entrySet [format $formatString \
- [[$fileV file] name] [[$fileV system] name]]
- }
- $this entrySet $entrySet
- $this ListDialog::popUp
- }
-
- method DiagramSelHandler::editCAD {this fileV} {
- set CContext [$classBrowser ccontext]
- set orgCContext [$CContext currentLevelString]
- set confV [$CContext currentConfig]
- set phaseV [$CContext currentPhase]
- set sysV [$phaseV findSystemVersion -bySystem [$fileV system]]
- while {[$CContext currentLevel] != "Phase"} {
- $CContext upLevel
- }
- $CContext downLevelId $sysV
- $CContext downLevelId $fileV
- set script "SystemUtilities::fork otk ude \
- -c [list [get_comm_name]] \
- [$fileV identity] [$sysV identity] [$confV identity]"
- $classBrowser startCommand tcl "$script" "" \
- "Starting ude for '[[$fileV file] name].$CAD_TYPE'" \
- {0 0} 1
- $CContext setLevelPath $orgCContext
- }
-
- # Do not delete this line -- regeneration end marker
-
- method DiagramSelHandler::browser {this args} {
- if {$args == ""} {
- return [$this _browser]
- }
- set ref [$this _browser]
- if {$ref != ""} {
- $ref _startEditCADHandler ""
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- $obj _startEditCADHandler $this
- }
- $this _browser $obj
- }
-
- method DiagramSelHandler::addDecomposition {this newDecomposition} {
- [$this decompositionSet] append $newDecomposition
-
- }
-
- method DiagramSelHandler::removeDecomposition {this oldDecomposition} {
- [$this decompositionSet] removeValue $oldDecomposition
- }
-
-