home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
browserpro.tcl
< prev
next >
Wrap
Text File
|
1997-11-26
|
37KB
|
1,381 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)browserpro.tcl /main/titanic/50
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)browserpro.tcl /main/titanic/50 26 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
Class BrowserProcs : {Object} {
constructor
method destructor
}
global BrowserProcs::externalFileTypes
set BrowserProcs::externalFileTypes ""
global BrowserProcs::diagramFileTypes
set BrowserProcs::diagramFileTypes ""
global BrowserProcs::programmerFileTypes
set BrowserProcs::programmerFileTypes ""
global BrowserProcs::itemTypes
set BrowserProcs::itemTypes "cl de doc et pe st"
global BrowserProcs::phases
set BrowserProcs::phases ""
global BrowserProcs::systemTypes
set BrowserProcs::systemTypes "system"
global BrowserProcs::infoProperties
set BrowserProcs::infoProperties "Name Type Identity Text"
constructor BrowserProcs {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method BrowserProcs::destructor {this} {
# Start destructor user section
# End destructor user section
}
proc BrowserProcs::action2String {map} {
BrowserProcs::initializeActionTable
set actions ""
for {set actionMap 1} \
{$actionMap <= 512} \
{set actionMap [expr $actionMap << 1]} {
if {$map & $actionMap} {
lappend actions $actionTable($actionMap)
}
}
return "$actions"
}
proc BrowserProcs::changeName {} {
set selectedObject [lindex [$wmttoolObj selectedObjSet] 0]
# get item and keeper for objects that have one
if [$selectedObject isA SystemVersion] {
set item [[$selectedObject system] item]
set keeper $selectedObject
} elseif [$selectedObject isA FileVersion] {
set item [[$selectedObject file] item]
set keeper [$selectedObject getParent SystemVersion]
} elseif [$selectedObject isA WorkItem] {
set item [$selectedObject item]
set keeper [$selectedObject owner]
} elseif {[$selectedObject isA ExternalLink] ||
[$selectedObject isA ConfigVersion] ||
[$selectedObject isA Project] ||
[$selectedObject isA Model]} {
set item ""
set keeper ""
} else {
wmtkerror "Cannot change the name of the selected object"
return
}
# determine configVersion of objects with an item
if { "$item" != "" } {
set configV [$selectedObject getParent ConfigVersion]
} else {
set configV ""
}
require "objnamecha.tcl"
ObjNameChangeDialog new $wmttoolObj.changeName $wmttoolObj \
-configV $configV \
-keeper $keeper \
-item $item
$wmttoolObj.changeName popUp
}
# Pops up a scope change dialog for the
# given object (a cdm).
#
proc BrowserProcs::changeScope {object} {
if { ![isCommand .main.scopechange] } {
require "cdmscopech.tcl"
CdmScopeChangeDialog new .main.scopechange
}
set systemVersion [$object getParent SystemVersion]
set configVersion [$object getParent ConfigVersion]
set item [[$object file] item]
set workItem [$systemVersion findDeclaration $item $configVersion]
.main.scopechange config \
-configV $configVersion \
-systemV $systemVersion \
-item $item \
-workItem $workItem
.main.scopechange popUp
}
proc BrowserProcs::childTypes {assoc} {
case "$assoc" in {
{controlledClasses} {
return "ControlledClass"
}
{controlledClassSet} {
return "ControlledClasses"
}
{accessRuleSet} {
return "AccessRules"
}
{rules} {
return "AccessRule"
}
{savedGroupVersion} {
return "SavedGroupVersion"
}
{roleLinks userLinks} {
return "UserRoleLink"
}
{default} {
if [regsub "Set" "$assoc" "s" assoc] {
return "[string toupper [string range $assoc 0 0]][string \
range $assoc 1 end]"
}
return "[string toupper [string range $assoc 0 0]][string \
range $assoc 1 [expr [string length $assoc] - 2]]"
}
}
}
proc BrowserProcs::clone {} {
set context ""
if [BrowserProcs::currentObjIsA BrowsUiObj] {
set browsUiObj [[$wmttoolObj currentObj] browsUiObj]
while {"$browsUiObj" != ""} {
set context "[$browsUiObj getInfo Identity] $context"
set browsUiObj [$browsUiObj parent]
}
}
# check the current view before cloning
[[.main infoView] fastViewHandler] checkView [.main infoView]
# save the view stuff
[[.main infoView] fastViewHandler] saveObjects
$wmttoolObj startCommand tcl \
"SystemUtilities::fork otk desk -c [list [get_comm_name]] $context" \
"" "Starting browser" {0 0} 1
}
proc BrowserProcs::compareVersion {obj orig versionList} {
if [lempty $versionList] {
wmtkinfo "There are no other versions to compare with"
return
}
set typeSpec [getObjectSpec [$wmttoolObj objectHdlr] \
[$obj uiClass] [$obj browserType] \
]
if {"$typeSpec" != ""} {
set icon [$typeSpec smallIcon]
} else {
set icon ""
}
set headerSpecList {
{Version 25 ascii {increasing 1}}
{Status 14 ascii {increasing 2}}
{"Frozen date" 30 ascii {none}}
{Comments 50 ascii {none}}
}
set objectSpecList ""
foreach version $versionList {
lappend objectSpecList [list $icon \
[$version versionName] \
[$version status] \
[$version freezeTime2String] \
[$version comments] \
]
}
require "browsviewd.tcl"
set box $wmttoolObj.compareVersion
ClassMaker::extend BrowsViewDialog CompareVBrowsViewDialog dbObj
CompareVBrowsViewDialog new $box \
-title "Compare Version" \
-message "[$orig text]" \
-headerSpecList $headerSpecList \
-objectSpecList $objectSpecList \
-objectList $versionList \
-dbObj $obj \
-cancelPressed {%this delete} \
-okPressed {
set dbObj [%this dbObj]
set version [[lindex [[%this view] selectedSet] 0] object]
if {[$dbObj isA Graph] || [$dbObj isA Matrix]} {
set script "[quoteIf [m4_path_name bin udmcmp$EXE_EXT]] \
[$dbObj identity] [$version identity]"
set endScript ""
set message "Starting 'Compare version'"
} elseif [$obj isA ExternalFileVersion] {
$obj synchWithFileSystem
set tmpFile [args_file {}]
case "[$version status]" in {
{backGround} {
$version activate
$version downLoadFrozenContents $tmpFile
$version deactivate
}
{frozen reused} {
$version downLoadFrozenContents $tmpFile
}
{default} {
copy_text_file \
[$version path [$version currentContext]] $tmpFile
}
}
set script "[m4_var get M4_diff] [$obj path] $tmpFile"
set endScript [list BasicFS::removeFile $tmpFile]
set message "Starting 'Compare'"
} elseif [$dbObj isA RemoteFile] {
set tmpFile1 [args_file {}]
$dbObj downLoad $tmpFile1
set tmpFile2 [args_file {}]
case "[$version status]" in {
{backGround} {
$version activate
$version downLoad $tmpFile2
$version deactivate
}
{default} {
$version downLoad $tmpFile2
}
}
set script "[m4_var get M4_diff] $tmpFile1 $tmpFile2"
set endScript ""
append endScript [list BasicFS::removeFile $tmpFile1]
append endScript " ;"
append endScript [list BasicFS::removeFile $tmpFile2]
set message "Starting 'Compare'"
} else {
wmtkerror "Sorry, don't know how to compare [$dbObj objType]"
}
$wmttoolObj startCommand mtool \
"$script" "$endScript" "$message" {0 0} 0
%this delete
}
[$box view] selectionPolicy BROWSE
$box popUp
}
proc BrowserProcs::copyUserEnv {level} {
if {"$level" == "Corporate"} {
set levelObj [$wmttoolObj corporateObj]
} else {
set levelObj [[$wmttoolObj currentObj] browsUiObj]
if {! [$levelObj isA $level]} {
set levelObj [$levelObj getParent $level]
}
}
require "copyenvdia.tcl"
CopyEnvDialog new $wmttoolObj.copyUserEnv 2 $levelObj \
-title "Copy User Env To $level" \
-m4VarDes [$wmttoolObj m4VarDes] \
-helpPressed {.main helpOnName copyUserEnv} \
-cancelPressed {%this delete} \
-okPressed {
%this save
%this delete
}
$wmttoolObj.copyUserEnv popUp
}
proc BrowserProcs::copyVersion {obj versionList} {
if [lempty $versionList] {
wmtkinfo "There are no other versions to copy from"
return
}
set typeSpec [getObjectSpec [$wmttoolObj objectHdlr] \
[$obj uiClass] [$obj browserType] \
]
if {"$typeSpec" != ""} {
set icon [$typeSpec smallIcon]
} else {
set icon ""
}
set headerSpecList {
{Name 25 ascii {increasing 1}}
{Version 25 ascii {increasing 2}}
{Status 14 ascii {increasing 3}}
{"Frozen date" 30 ascii {none}}
{Comments 50 ascii {none}}
}
set objectSpecList ""
foreach tuple $versionList {
set version [lindex $tuple 0]
lappend objectSpecList [list $icon \
[lindex $tuple 1] \
[$version versionName] \
[$version status] \
[$version freezeTime2String] \
[$version comments] \
]
}
require "browsviewd.tcl"
set box $wmttoolObj.copyVersion
ClassMaker::extend BrowsViewDialog CopyVBrowsViewDialog dbObj
CopyVBrowsViewDialog new $box \
-title "Copy Version From" \
-headerSpecList $headerSpecList \
-objectSpecList $objectSpecList \
-objectList $versionList \
-dbObj $obj \
-cancelPressed {%this delete} \
-okPressed {
set dbObj [%this dbObj]
set version \
[lindex [[lindex [[%this view] selectedSet] 0] object] 0]
if [$dbObj isA ConfigVersion] {
set args "-configVersion $version"
} elseif [$dbObj isA PhaseVersion] {
set args "-phaseVersion $version"
} elseif [$dbObj isA SystemVersion] {
set confV [$dbObj getParent ConfigVersion]
set args "{} -systemVersion $version $confV"
} else {
set args "$version"
}
set script "$dbObj copy $args"
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
%this delete
}
[$box view] config \
-rowCount 10 \
-selectionPolicy BROWSE
$box popUp
}
proc BrowserProcs::currentObjIsA {typeList} {
set currentObj [$wmttoolObj currentObj]
if {! [isCommand $currentObj]} {
return 0
}
foreach type $typeList {
if [[$currentObj browsUiObj] isA $type] {
return 1
}
}
return 0
}
proc BrowserProcs::currentUser {} {
set corporate [$wmttoolObj corporateObj]
return [$corporate currentUser]
}
proc BrowserProcs::displayDate {date} {
if {$date <= 0} {
return ""
}
return "[clock format $date]"
}
proc BrowserProcs::editProperties {} {
busy {
$wmttoolObj createPropContainers 1
# Don't reuse a PropertyDialog:
# The initial size does not change to fit new contents.
require "propertydi.tcl"
PropertyDialog new $wmttoolObj.editProperties $wmttoolObj \
-editable 1 \
-title "Edit Properties" \
-helpPressed {.main helpOnName editProperties}
$wmttoolObj.editProperties popUp
}
}
proc BrowserProcs::effectiveRoles {} {
set securityLevel [[ClientContext::global] currentSecurityLevel]
if [$securityLevel isNil] {
set securityLevel [$wmttoolObj corporateObj]
}
set effectiveRoleList ""
foreach role [$securityLevel effectiveRoles] {
set roleName "[$role name]"
lappend effectiveRoleList "$roleName"
}
return $effectiveRoleList
}
proc BrowserProcs::freezeObjects {objectList} {
if {! [isCommand $wmttoolObj.freezeVersion]} {
ClassMaker::extend EntryDialog FreezeVEntryDialog objectList
FreezeVEntryDialog new $wmttoolObj.freezeVersion \
-modal yes \
-title "Freeze Version" \
-message "Comments:" \
-helpPressed {.main helpOnName freezeVersion} \
-okPressed {
BrowserProcs::freezeObjectsOk \
"[%this objectList]" "[%this entry]"
}
}
$wmttoolObj.freezeVersion objectList "$objectList"
$wmttoolObj.freezeVersion popUp
}
proc BrowserProcs::freezeObjectsOk {objectList comments} {
set script ""
foreach obj $objectList {
if {"$script" != ""} {
append script " ;"
}
append script " $obj freeze [list $comments]"
}
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
}
proc BrowserProcs::getParentObj {} {
set currentObj [[.main treeView] selected]
if {"$currentObj" != ""} {
return [[$currentObj browsUiObj] parent]
}
set currentObj [.main currentObj]
if {! [isCommand $currentObj]} {
return ""
}
return [$currentObj browsUiObj]
}
proc BrowserProcs::graphTypes {} {
return "cad ccd cod etd std ucd"
}
proc BrowserProcs::id2obj {id type node} {
# Search object in given tree node
set myObj [$node browsUiObj]
if {! [$myObj isA $type]} {
set myObj [$node getParent $type]
}
if {[isCommand $myObj] && ([$myObj getInfo Identity] == $id)} {
return $myObj
}
# Search object in current tree node
set currentNode [.main currentObj]
if {$currentNode != $node} {
set currentObj [$currentNode browsUiObj]
if {! [$currentObj isA $type]} {
set currentObj [$currentNode getParent $type]
}
if {[isCommand $currentObj] &&
([$currentObj getInfo Identity] == $id)} {
return $currentObj
}
}
# Search in currrent view
foreach flatObj [[.main flatView] objectSet] {
if [$flatObj filteredOutState] continue
set childObj [$flatObj browsUiObj]
if {[isCommand $childObj] &&
([$childObj getInfo Identity] == $id)} {
return $childObj
}
}
return [$type new $id]
}
proc BrowserProcs::importSystems {systemList} {
set args "-f impsystems.tcl"
if {! [lempty $systemList]} {
set args "$args -- $systemList"
}
set script "[quoteIf [m4_path_name bin otsh$EXE_EXT]] $args"
$wmttoolObj startCommand mtool \
"$script" "" "Starting 'Import Systems'" {1 0} 0
}
proc BrowserProcs::infoProperties {} {
return ${BrowserProcs::infoProperties}
}
proc BrowserProcs::initializeActionTable {} {
global actionTable
if [info exists actionTable] {
return
}
set actionTable(1) controlAction
set actionTable(2) createAction
set actionTable(4) destroyAction
set actionTable(8) readAction
set actionTable(16) modifyAction
set actionTable(32) insertAction
set actionTable(64) removeAction
set actionTable(128) freezeAction
set actionTable(256) unfreezeAction
set actionTable(512) modifyStatusAction
}
proc BrowserProcs::initializeInfo {obj node} {
global initializeInfoDict initializeInfoDictSet
if {! [info exists initializeInfoDict]} {
set initializeInfoDict [Dictionary new]
}
if {(! [info exists initializeInfoDictSet]) ||
(! $initializeInfoDictSet)} {
$initializeInfoDict set FilePropertyReference ConfigVersion
set initializeInfoDictSet 1
}
set parentClass [$initializeInfoDict set [$obj uiClass]]
if {"$parentClass" != ""} {
set parent $node
if [$parent isA TreeNode] {
set parent [$parent browsUiObj]
}
if {! [$parent isA $parentClass]} {
set parent [$node getParent $parentClass]
}
} else {
set parent ""
}
$obj initializeInfo "$parent"
}
proc BrowserProcs::matrixTypes {{dsmToo 0}} {
set matrixTypes "cdm"
if $dsmToo {
lappend matrixTypes "dsm"
}
return $matrixTypes
}
proc BrowserProcs::objectsAre {type} {
case "[$wmttoolObj getStatus $type]" in {
{yes} {
return 1
}
{no} {
return 0
}
{default} {
foreach obj [$wmttoolObj selectedObjSet] {
if {! [$obj isA $type]} {
$wmttoolObj setStatus $type no
return 0
}
}
$wmttoolObj setStatus $type yes
return 1
}
}
}
proc BrowserProcs::objectsReturn {method} {
case "[$wmttoolObj getStatus $method]" in {
{yes} {
return 1
}
{no} {
return 0
}
{default} {
foreach obj [$wmttoolObj selectedObjSet] {
if {! [$obj $method]} {
$wmttoolObj setStatus $method no
return 0
}
}
$wmttoolObj setStatus $method yes
return 1
}
}
}
proc BrowserProcs::parentObjIsA {typeList} {
set parentObj [BrowserProcs::getParentObj]
if {! [isCommand $parentObj]} {
return 0
}
foreach type $typeList {
if [$parentObj isA $type] {
return 1
}
}
return 0
}
proc BrowserProcs::printObjects {asciiFiles topostObjects {deleteFlag 0}} {
busy {
if {! [lempty $asciiFiles]} {
# Can not print more than 1 file at once on win95
if {$win95 && ([llength $asciiFiles] > 1)} {
foreach asciiFile $asciiFiles {
BrowserProcs::printObjects "[list $asciiFile]" "" $deleteFlag
}
} else {
set printer [m4_var get M4_a_printer]
set cmd $printer
set endCmd ""
foreach asciiFile $asciiFiles {
if $deleteFlag {
if {"$endCmd" != ""} {
append endCmd " ;"
}
append endCmd "[list BasicFS::removeFile $asciiFile]"
}
if $win95 {
append cmd " $asciiFile"
} else {
append cmd " \"$asciiFile\""
}
}
set msg "Sending "
if {[llength $asciiFiles] == 1} {
append msg "'[lindex $asciiFiles 0]'"
} else {
append msg "output"
}
append msg " to $printer..."
$wmttoolObj startCommand extern "$cmd" "$endCmd" "$msg" {0 0} 0
}
}
if {! [lempty $topostObjects]} {
set sysV [[$wmttoolObj currentObj] browsUiObj]
if {! [$sysV isA SystemVersion]} {
set sysV [$sysV getParent SystemVersion]
}
set confV [$sysV getParent ConfigVersion]
require "print.tcl"
eval Print::printDiagrams \
-configVersion $confV \
-systemVersion $sysV \
$topostObjects
}
}
}
proc BrowserProcs::removeMessage {{dialog ""}} {
if {"$dialog" == ""} {
set objects [$wmttoolObj selectedNameSet]
set len [llength $objects]
if {$len == 1} {
set object [lindex $objects 0]
set description "[lindex $object 1] '[lindex $object 0]'"
}
} else {
set selectedSet [[$dialog view] selectedSet]
if [lempty $selectedSet] {
set selectedSet [[$dialog view] objectSet]
}
set len [llength $selectedSet]
if {$len == 1} {
set version [[lindex $selectedSet 0] object]
set description \
"version [$version versionName] of [[$dialog orig] text]"
}
}
if {$len > 1} {
set description "these $len objects"
} elseif [.main isA CommonBrowser] {
set selectedNode [[.main treeView] selected]
if {"$selectedNode" != ""} {
[.main infoView] removedObj $selectedNode
}
}
return "Are you sure you want to delete $description ?"
}
proc BrowserProcs::removeProperties {} {
busy {
$wmttoolObj createPropContainers 1
# Don't reuse a RmPropDialog:
# The initial size does not change to fit new contents.
require "rmpropdial.tcl"
RmPropDialog new $wmttoolObj.removeProperties $wmttoolObj \
-title "Delete Properties" \
-helpPressed {.main helpOnName removeProperties}
$wmttoolObj.removeProperties popUp
}
}
proc BrowserProcs::removeVersion {obj orig versionList {endScript ""}} {
set selectedObj [lindex [$wmttoolObj selectedObjSet] 0]
set typeSpec [getObjectSpec [$wmttoolObj objectHdlr] \
[$selectedObj uiClass] [$selectedObj browserType] \
]
if {"$typeSpec" != ""} {
set icon [$typeSpec smallIcon]
} else {
set icon ""
}
set headerSpecList {
{Version 25 ascii {increasing 1}}
{Status 14 ascii {increasing 2}}
{"Frozen date" 30 ascii {none}}
{Comments 50 ascii {none}}
}
set objectSpecList ""
foreach version $versionList {
lappend objectSpecList [list $icon \
[$version versionName] \
[$version status] \
[$version freezeTime2String] \
[$version comments] \
]
}
require "browsviewd.tcl"
set box $wmttoolObj.removeVersion
ClassMaker::extend BrowsViewDialog RemoveVBrowsViewDialog {dbObj orig endScript}
ClassMaker::extend YesNoWarningDialog WarningDialogWithEndScript endScript
RemoveVBrowsViewDialog new $box \
-title "Delete Version" \
-message "[$orig text]" \
-headerSpecList $headerSpecList \
-objectSpecList $objectSpecList \
-objectList $versionList \
-dbObj $obj \
-orig $orig \
-cancelPressed {%this delete} \
-endScript "$endScript" \
-okPressed {
WarningDialogWithEndScript new [format "%s%s" %this Warning] \
-title "Confirm Version Delete" \
-message [BrowserProcs::removeMessage %this] \
-helpPressed {.main helpOnName removeVersionWarning} \
-noPressed {
%this delete
[format "%s%s" %this Warning] delete
} \
-yesPressed {
set dbObj [%this dbObj]
set orig [%this orig]
set objectSet [[%this view] objectSet]
set selectedSet [[%this view] selectedSet]
if [lempty $selectedSet] {
set selectedSet $objectSet
}
set script ""
foreach object $selectedSet {
if {"$script" != ""} {
append script " ;"
}
append script " $dbObj removeObject [$object object]"
}
$wmttoolObj startCommand tcl "$script" [%this endScript] "" {1 0} 1
[format "%s%s" %this Warning] delete
%this delete
}
[format "%s%s" %this Warning] delCancelButton
[format "%s%s" %this Warning] endScript "[%this endScript]"
[format "%s%s" %this Warning] popUp
}
if {[$orig isA Config] ||
([llength $versionList] == 1 &&
[lindex $versionList 0] == $selectedObj)} {
$box display
eval [$box okPressed]
} else {
$box popUp
}
}
proc BrowserProcs::scopeObjectsAre {scope} {
case "[$wmttoolObj getStatus $scope]" in {
{yes} {
return 1
}
{no} {
return 0
}
{default} {
foreach obj [$wmttoolObj selectedObjSet] {
set objScope [$obj getInfo Scope]
if {"$objScope" == ""} continue
if {"$objScope" != "$scope"} {
$wmttoolObj setStatus "$scope" no
return 0
}
}
$wmttoolObj setStatus "$scope" yes
return 1
}
}
}
proc BrowserProcs::selectObject {obj versionList mode} {
if [lempty $versionList] {
wmtkinfo "There are no other versions to select from"
return
}
set headerSpecList ""
if {"$mode" != "selected"} {
lappend headerSpecList {Name 25 ascii {increasing 2}}
lappend headerSpecList {Version 25 ascii {increasing 3}}
lappend headerSpecList {Type 18 ascii {increasing 1}}
} else {
lappend headerSpecList {Version 25 ascii {increasing 1}}
}
lappend headerSpecList {"Frozen date" 30 ascii {none}}
lappend headerSpecList {Comments 50 ascii {none}}
set objectSpecList ""
foreach tuple $versionList {
set version [lindex $tuple 0]
set typeSpec [getObjectSpec [$wmttoolObj objectHdlr] \
[$version uiClass] [$version browserType] \
]
if {"$typeSpec" != ""} {
set icon [$typeSpec smallIcon]
} else {
set icon ""
}
set objectSpec "$icon"
if {"$mode" != "selected"} {
lappend objectSpec [lindex $tuple 1]
lappend objectSpec [$version versionName]
lappend objectSpec [$version browserType]
} else {
lappend objectSpec [$version versionName]
}
lappend objectSpec [$version freezeTime2String]
lappend objectSpec [$version comments]
lappend objectSpecList $objectSpec
}
require "browsviewd.tcl"
set box $wmttoolObj.selectVersion
ClassMaker::extend BrowsViewDialog SelectVBrowsViewDialog dbObj
SelectVBrowsViewDialog new $box \
-title "Select Version" \
-headerSpecList $headerSpecList \
-objectSpecList $objectSpecList \
-objectList $versionList \
-dbObj $obj \
-cancelPressed {%this delete} \
-okPressed {
set dbObj "[%this dbObj]"
set script ""
foreach object [[%this view] selectedSet] {
if {"$script" != ""} {
append script " ;"
}
append script \
" $dbObj selectVersion [lindex [$object object] 0]"
}
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
%this delete
}
if {"$mode" == "selected"} {
set selectionPolicy BROWSE
} else {
set selectionPolicy EXTENDED
}
[$box view] config \
-rowCount 10 \
-selectionPolicy $selectionPolicy
$box popUp
}
proc BrowserProcs::showInfo {{skip 0}} {
set objList [$wmttoolObj selectedObjSet]
if [lempty $objList] {
return
}
global classCount
incr classCount
set box $wmttoolObj.info$classCount
interface TemplateDialog $box {
title "Info"
DlgColumn col { }
helpPressed { .main helpOnName info }
okPressed { %this delete }
}
$box modal $win95
$box delCancelButton
set lineCnt 0
set sepCnt 0
foreach obj $objList {
if { $sepCnt != 0 } {
HorSeparator new $box.col.$sepCnt
}
incr sepCnt
foreach header [[$obj browserObjType]::infoProperties] {
set info [$obj getInfo $header]
if $skip {
if {$info == " "} continue
}
DlgRow new $box.col.row$lineCnt \
-spaceType NONE -justification RIGHT
Label new $box.col.row$lineCnt.$lineCnt -text "$header:" \
-alignment RIGHT -horStretchFactor 10 \
-justification TOP -font "courier-bold-12"
DlgColumn new $box.col.row$lineCnt.col
set breakUpCnt 0
if { $info == "" } {
set info " "
}
foreach line [split $info "\n"] {
foreach part [lineBreak $line 49 " "] {
set text [format "%-49s" $part]
Label new $box.col.row$lineCnt.col.${lineCnt}_$breakUpCnt \
-text $text -font "courier-normal-12"
incr breakUpCnt
}
}
incr lineCnt
}
}
$box popUp
}
proc BrowserProcs::showProperties {} {
busy {
$wmttoolObj createPropContainers 0
# Don't reuse a PropertyDialog:
# The initial size does not change to fit new contents.
require "propertydi.tcl"
PropertyDialog new $wmttoolObj.editProperties $wmttoolObj \
-editable 0 \
-title "Show Properties" \
-helpPressed {.main helpOnName editProperties}
$wmttoolObj.editProperties popUp
}
}
proc BrowserProcs::splitAssociations {associations} {
set id [lsearch -regexp $associations Set]
if {$id > 0} {
set db_associations [lrange $associations 0 [expr $id - 1]]
} else {
set db_associations ""
}
if {$id >= 0} {
set ui_associations [lrange $associations $id end]
} else {
set ui_associations ""
}
return [list $db_associations $ui_associations]
}
proc BrowserProcs::statusObjectsAre {status} {
case "[$wmttoolObj getStatus $status]" in {
{yes} {
return 1
}
{no} {
return 0
}
{default} {
foreach obj [$wmttoolObj selectedObjSet] {
set objStatus [$obj getInfo Status]
if {"$objStatus" == ""} continue
if {("$objStatus" != "reused" &&
[$obj getInfo "In Corporate"] == "Yes") ||
"$objStatus" != "$status"} {
$wmttoolObj setStatus "$status" no
return 0
}
}
$wmttoolObj setStatus "$status" yes
return 1
}
}
}
proc BrowserProcs::statusObjectsAreNot {status} {
case "[$wmttoolObj getStatus not$status]" in {
{yes} {
return 1
}
{no} {
return 0
}
{default} {
foreach obj [$wmttoolObj selectedObjSet] {
set objStatus [$obj getInfo Status]
if {"$objStatus" == ""} continue
if {"$objStatus" == "$status"} {
$wmttoolObj setStatus "not$status" no
return 0
}
}
$wmttoolObj setStatus "not$status" yes
return 1
}
}
}
proc BrowserProcs::string2Action {actions} {
BrowserProcs::initializeActionTable
set map 0
foreach action $actions {
for {set actionMap 1} \
{$actionMap <= 512} \
{set actionMap [expr $actionMap << 1]} {
if {$actionTable($actionMap) == $action} {
set map [expr $map | $actionMap]
break
}
}
}
return $map
}
proc BrowserProcs::typeObjectsAre {type} {
case "[$wmttoolObj getStatus $type]" in {
{yes} {
return 1
}
{no} {
return 0
}
{default} {
foreach obj [$wmttoolObj selectedObjSet] {
if {"[$obj getInfo Type]" != "$type"} {
$wmttoolObj setStatus "$type" no
return 0
}
}
$wmttoolObj setStatus "$type" yes
return 1
}
}
}
proc BrowserProcs::unfreezeObjects {} {
set script ""
foreach obj [$wmttoolObj selectedObjSet] {
if {"$script" != ""} {
append script " ;"
}
append script " $obj unfreeze"
}
$wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
}
proc BrowserProcs::userRoles {} {
set securityLevel [[ClientContext::global] currentSecurityLevel]
if [$securityLevel isNil] {
set securityLevel [$wmttoolObj corporateObj]
}
set currentUser [BrowserProcs::currentUser]
set userRoleList ""
while {[$securityLevel isA SecurityLevel]} {
foreach roleL [$securityLevel roleLinks $currentUser] {
set role [$roleL role]
set roleName "[$role name]"
if {[lsearch -exact $userRoleList "$roleName"] == -1} {
lappend userRoleList $roleName
}
}
set securityLevel [$securityLevel upperLevel]
}
return $userRoleList
}
proc BrowserProcs::createShellLink {} {
set objList [$wmttoolObj selectedObjSet]
if [lempty $objList] {
return
}
set cc [ClientContext::global]
set lvlBase [$cc currentLevelString]
foreach obj $objList {
if [catch {set shl [ShellLink new]} msg] {
# NT 3.51? ignore
wmtkerror $msg
return
}
set file [$obj file]
set fName [$file qualifiedName /].[$file type]
set lvl $lvlBase/$fName
$shl path [m4_path_name bin otk.exe]
$shl arguments "[quoteIf [m4_path_name tcl ude.tcl]] -- $lvl"
set guiName \
"[$file qualifiedName " "] [ShortLongName::longName [$file type]].lnk"
set dir [registry get HKEY_CURRENT_USER \
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" Desktop]
$shl createIt $dir\\$guiName
}
}
proc BrowserProcs::mergeConfigurations {} {
set sel [lindex [.main selectedObjSet] 0]
set names ""
foreach obj [[.main flatView] objectSet] {
set obj [$obj browsUiObj]
if {$obj == $sel} {
continue
}
lappend names [$obj getInfo Name].[$obj getInfo Version]
lappend objects $obj
}
if {$names == ""} {
wmtkinfo "No other Configuration to choose from."
return
}
ListDialog new .main.mergeDialog
.main.mergeDialog entrySet $names
.main.mergeDialog selectionPolicy SINGLE
.main.mergeDialog title "Select Merge Source"
.main.mergeDialog helpPressed { .main helpOnName merge }
.main.mergeDialog okPressed {
set config1 [lindex [.main selectedObjSet] 0]
set selName [lindex [%this selectedSet] 0]
if {$selName == ""} {
return
}
set cc [[ClientContext::global] currentLevelIdString]
set tc $cc/[$config1 identity]
foreach obj [[.main flatView] objectSet] {
set obj [$obj browsUiObj]
set name [$obj getInfo Name].[$obj getInfo Version]
if {$name == $selName} {
set config2 $obj
break;
}
}
set fc $cc/[$config2 identity]
set script "SystemUtilities::fork otk mtmerge"
set script "$script -c [list [get_comm_name]] -fc $fc -tc $tc"
set endScript ""
set message "Starting Merge Tool"
.main startCommand tcl \
"$script" "$endScript" "$message" {0 0} 0
}
.main.mergeDialog popUp
}
proc BrowserProcs::mergePhasesOnSystemLevel {{withPrevious ""}} {
set sel [lindex [.main selectedObjSet] 0]
if [$sel isA PhaseVersion] {
BrowserProcs::importPhases $withPrevious
return
}
set phase [$sel getParent PhaseVersion]
if {[$phase getInfo Type] == "Implementation"} {
wmtkinfo "Can not merge into phase 'Implementation'."
return
}
set sysName [[$sel system] name]
set sysType [[$sel system] type]
set cc [ClientContext::global]
set curPhase [$cc currentPhase]
set curConfig [$cc currentConfig]
if {$withPrevious != ""} {
set previousPhase [$phase previous $curConfig]
if [$previousPhase isNil] {
wmtkinfo "Previous phase not found"
} else {
set sys [$previousPhase findSystemVersion $sysName $sysType]
if [$sys isNil] {
wmtkinfo "System '$sysName' not found in previous phase"
} else {
set sId [$sys identity]
set pId [$previousPhase identity]
BrowserProcs::doMergePhasesOnSystemLevel $sel $sId $pId
}
}
return
}
set names ""
set objects ""
foreach phase [$curConfig phaseVersions] {
if {[[$phase phase] type] == "Implementation"} {
continue
}
if {$phase == $curPhase} {
continue
}
set sys [$phase findSystemVersion $sysName $sysType]
if [$sys isNil] {
continue
}
lappend names [[$phase phase] name].[$phase versionName]
lappend objects "$phase $sys"
}
if {$names == ""} {
wmtkinfo "[cap $sysType] '$sysName' not found in another phase."
return
}
ClassMaker::extend ListDialog ImportSysDialog objects
ImportSysDialog new .main.importDialog2
.main.importDialog2 entrySet $names
.main.importDialog2 objects $objects
.main.importDialog2 selectionPolicy SINGLE
.main.importDialog2 title "Select Merge Source"
.main.importDialog2 helpPressed { .main helpOnName selectImportSource }
.main.importDialog2 okPressed {
set sys1 [lindex [.main selectedObjSet] 0]
set sel [lindex [%this objects] [%this selectedIndexSet]]
set phase2 [[lindex $sel 0] identity]
set sys2 [[lindex $sel 1] identity]
BrowserProcs::doMergePhasesOnSystemLevel $sys1 $sys2 $phase2
}
.main.importDialog2 popUp
}
proc BrowserProcs::doMergePhasesOnSystemLevel {sys1 sys2 phase2} {
set cc [ClientContext::global]
set tc [$cc currentLevelIdString]/[$sys1 identity]
set corp2 [[$cc currentCorporate] identity]
set proj2 [[$cc currentProject] identity]
set conf2 [[$cc currentConfig] identity]
set fc "/$corp2/$proj2/$conf2/$phase2/$sys2"
set script "SystemUtilities::fork otk mtmerge"
set script "$script -c [list [get_comm_name]] -fc $fc -tc $tc"
set endScript ""
set message "Starting Merge From Other Phase"
.main startCommand tcl \
"$script" "$endScript" "$message" {0 0} 0
}
proc BrowserProcs::mergePhases {{withPrevious ""}} {
set sel [lindex [.main selectedObjSet] 0]
if [$sel isA SystemVersion] {
BrowserProcs::mergePhasesOnSystemLevel $withPrevious
return
}
set cc [ClientContext::global]
set curConfig [$cc currentConfig]
set curPhase [$cc currentPhase]
set curPhase $sel
if {[$curPhase getInfo Type] == "Implementation"} {
wmtkinfo "Can not merge into phase 'Implementation'."
return
}
if {$withPrevious != ""} {
set previousPhase [$curPhase previous $curConfig]
if [$previousPhase isNil] {
wmtkinfo "Previous phase not found"
} else {
BrowserProcs::doMergePhases $curPhase $previousPhase
}
return
}
set names ""
set objects ""
foreach phase [$curConfig phaseVersions] {
if {[[$phase phase] type] == "Implementation"} {
continue
}
if {$phase == $curPhase} {
continue
}
lappend names [[$phase phase] name].[$phase versionName]
lappend objects $phase
}
if {$names == ""} {
wmtkinfo "No other phase to merge from."
return
}
ClassMaker::extend ListDialog ImportPhaseDialog objects
ImportPhaseDialog new .main.importDialog
.main.importDialog entrySet $names
.main.importDialog objects $objects
.main.importDialog selectionPolicy SINGLE
.main.importDialog title "Select Merge Source"
.main.importDialog helpPressed { .main helpOnName selectImportSource }
.main.importDialog okPressed {
set phase1 [lindex [.main selectedObjSet] 0]
set selName [lindex [%this selectedSet] 0]
if {$selName == ""} {
return
}
foreach obj [%this objects] {
set name [$obj getInfo Name].[$obj getInfo Version]
if {$name == $selName} {
set phase2 $obj
break;
}
}
BrowserProcs::doMergePhases $phase1 $phase2
}
.main.importDialog popUp
}
proc BrowserProcs::doMergePhases {phase1 phase2} {
set cc [[ClientContext::global] currentLevelIdString]
set curPhase [[ClientContext::global] currentPhase]
if [$curPhase isNil] {
set tc $cc/[$phase1 identity]
} else {
# do nothing, in the right context
set tc $cc
}
if [$curPhase isNil] {
set fc $cc/[$phase2 identity]
} else {
set gcc [ClientContext::global]
set corp [[$gcc currentCorporate] identity]
set proj [[$gcc currentProject] identity]
set config [[$gcc currentConfig] identity]
set fc /$corp/$proj/$config/[$phase2 identity]
}
set script "SystemUtilities::fork otk mtmerge"
set script "$script -c [list [get_comm_name]] -fc $fc -tc $tc"
set endScript ""
set message "Starting Merge From Other Phase"
.main startCommand tcl \
"$script" "$endScript" "$message" {0 0} 0
}
# Do not delete this line -- regeneration end marker