home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)diagramsel.tcl /main/titanic/4
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)diagramsel.tcl /main/titanic/4 29 Aug 1997 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 cc [ClientContext::global]
- set configV [$cc currentConfig]
- if [$sysV isNil] {
- set phaseV [$cc 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 [ShortLongName::longName $CAD_TYPE]:\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 cc [ClientContext::global]
- set levelPathObj [LevelPath new [$cc currentLevelString]]
- # would like to use LevelPath::parentAt ... (not available in TCL!!)
- while {[$levelPathObj depth] != "Phase"} {
- $levelPathObj removeTail
- }
- $levelPathObj append "[[$fileV system] name].[[$fileV system] type]"
- $levelPathObj append "[[$fileV file] name].[[$fileV file] type]"
-
- set script "SystemUtilities::fork otk ude \
- -c [list [get_comm_name]] [$levelPathObj asString]"
- $classBrowser startCommand tcl "$script" "" "Starting editor for [\
- ShortLongName::longName $CAD_TYPE] '[[$fileV file] name]'" \
- {0 0} 1
- }
-
- # 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
- }
-
-