home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / komix / DATA.Z / sysvdbobj.tcl < prev    next >
Text File  |  1997-11-26  |  22KB  |  821 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1997
  4. #
  5. #      File:           @(#)sysvdbobj.tcl    /main/titanic/30
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)sysvdbobj.tcl    /main/titanic/30   26 Nov 1997 Copyright 1997 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. require "custfvuiob.tcl"
  13. require "witemuiobj.tcl"
  14. # End user added include file section
  15.  
  16. require "browsdbobj.tcl"
  17. require "versionobj.tcl"
  18.  
  19. Class SysVDbObj : {BrowsDbObj SystemVersion VersionObj} {
  20.     method destructor
  21.     constructor
  22.     method promoter
  23.     method activateObject
  24.     method changeLinks
  25.     method copy
  26.     method copyConflict
  27.     method handleConflict
  28.     method copyFileVersions
  29.     method copyGroupVersion
  30.     method copyVersion
  31.     method deactivateObject
  32.     method deselectObjects
  33.     method finalizeCopy
  34.     method finalizeFailedCopy
  35.     method groupVersions
  36.     method importObject
  37.     method importObjects
  38.     method initializeInfo
  39.     method linkStatus
  40.     method localFileVersions
  41.     method localFileOnlyVersions
  42.     method makeUpToDate
  43.     method moveFileVersions
  44.     method name
  45.     method newObjects
  46.     method removeObjects
  47.     method removeVersion
  48.     method reuse
  49.     method reused
  50.     method selectObject
  51.     method system
  52.     attribute workItemSet
  53. }
  54.  
  55. method SysVDbObj::destructor {this} {
  56.     # Start destructor user section
  57.     # End destructor user section
  58.     $this BrowsDbObj::destructor
  59.     $this VersionObj::destructor
  60. }
  61.  
  62. constructor SysVDbObj {class this name} {
  63.     set this [SystemVersion::constructor $class $this $name]
  64.     set this [BrowsDbObj::constructor $class $this $name]
  65.     set this [VersionObj::constructor $class $this $name]
  66.     return $this
  67. }
  68.  
  69. selfPromoter SystemVersion {this} {
  70.     if {"[[$this system] type]" == "document"} {
  71.     SysVDbObj promote $this
  72.     } elseif {"[[$this phase] type]" == "Implementation"} {
  73.     PSysVDbObj promote $this
  74.     } else {
  75.     SSysVDbObj promote $this
  76.     }
  77. }
  78.  
  79. method SysVDbObj::promoter {this} {
  80.     $this BrowsDbObj::promoter
  81.  
  82.     set customFileVersionSet $this.${CustFVUiObj::uiClass}:0
  83.     if {! [isCommand $customFileVersionSet]} {
  84.     CustFVUiObj new $customFileVersionSet -parent $this
  85.     }
  86.     $this customFileVersionSet $customFileVersionSet
  87.     set workItemSet $this.${WItemUiObj::uiClass}:0
  88.     if {! [isCommand $workItemSet]} {
  89.     WItemUiObj new $workItemSet -parent $this
  90.     }
  91.     $this workItemSet $workItemSet
  92.  
  93.     module_promoter SysVDbObj $this
  94. }
  95.  
  96. method SysVDbObj::activateObject {this} {
  97.     # empty
  98. }
  99.  
  100. method SysVDbObj::changeLinks {this} {
  101.  
  102.     ClassMaker::extend TemplateDialog ChangeLinksTemplateDialog dbObj
  103.     ChangeLinksTemplateDialog new $wmttoolObj.changeLink \
  104.     -modal yes \
  105.     -title "Change Link Status" \
  106.     -dbObj $this \
  107.     -helpPressed {.main helpOnName changeLink} \
  108.     -cancelPressed {%this delete} \
  109.     -okPressed {
  110.         set status [%this.top.status selected]
  111.         set script ""
  112.         foreach obj [$wmttoolObj selectedObjSet] {
  113.         if [$obj isA PropertySection] {
  114.             wmtkerror "Can not set the link status of a PropertySection"
  115.             continue
  116.         }
  117.         set found 0
  118.         foreach link [$obj systemVersionLinks] {
  119.             if {"[$link systemVersion]" == "[%this dbObj]"} {
  120.             set found 1
  121.             break
  122.             }
  123.         }
  124.         if {! $found} {
  125.             wmtkerror "link to [$obj getInfo Type] \
  126.                 '[$obj getInfo Name]' not found"
  127.             continue
  128.         }
  129.         if {"$script" != ""} {
  130.             append script " ;"
  131.         }
  132.         append script " $link status $status"
  133.         }
  134.         if {"$script" != ""} {
  135.         $wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
  136.         }
  137.         %this delete
  138.     }
  139.     interface DlgColumn $wmttoolObj.changeLink.top {
  140.     Label messageLab {
  141.         text "Link Status:"
  142.     }
  143.     VerRadioGroup status {
  144.         entrySet {fixed dynamicFrozen}
  145.     }
  146.     }
  147.     if {[llength [$wmttoolObj selectedObjSet]] == 1} {
  148.     $wmttoolObj.changeLink.top.status selected \
  149.         [[lindex [$wmttoolObj selectedObjSet] 0] getInfo Link]
  150.     } else {
  151.     $wmttoolObj.changeLink.top.status selected fixed
  152.     }
  153.     $wmttoolObj.changeLink popUp
  154. }
  155.  
  156. proc SysVDbObj::childTypes {assoc} {
  157.     set childTypes [BrowserProcs::childTypes $assoc]
  158.     case "$childTypes" in {
  159.     {ExternalLink} {
  160.         return "${BrowserProcs::externalFileTypes}"
  161.     }
  162.     {FileVersionReference LocalFileVersion} {
  163.         return [concat \
  164.         ${BrowserProcs::diagramFileTypes} \
  165.         ${BrowserProcs::programmerFileTypes}]
  166.     }
  167.     {Section} {
  168.         return [concat \
  169.         {None Fileprop Itemprop} \
  170.         ${BrowserProcs::diagramFileTypes} \
  171.         ${BrowserProcs::programmerFileTypes}]
  172.     }
  173.     {default} {
  174.         return "$childTypes"
  175.     }
  176.     }
  177. }
  178.  
  179. proc SysVDbObj::controlledLists {} {
  180.     return {
  181.     "[[$this system] customFileList]"
  182.     "[$this customFileVersionLinkList]"
  183.     "[[$this system] fileList]"
  184.     "[$this fileVersionLinkList]"
  185.     "[[$this system] systemVersionList]"
  186.     }
  187. }
  188.  
  189. method SysVDbObj::copy {this sourceContext args} {
  190.     set argc [llength $args]
  191.     set flag [lindex $args 0]
  192.     case "$flag" in {
  193.     {-fileVersion} {
  194.             if {$argc <= 3} {
  195.         eval $this SystemVersion::copy $args
  196.         break
  197.             }
  198.         set fileV [lindex $args 1]
  199.             set editPasteCmdBusy [lindex $args [expr $argc -1]]
  200.             set newFileV [eval \
  201.                 $this SystemVersion::copy [lrange $args 0 [expr $argc -2]]]
  202.             if {$editPasteCmdBusy && (! [$newFileV isNil])} {
  203.                 [.main undoCommand] addObject $newFileV
  204.             }
  205.     }
  206.     {-groupVersion} {
  207.         if {$argc <= 5} {
  208.         eval $this SystemVersion::copy $args
  209.         break
  210.         }
  211.         set groupV [lindex $args 1]
  212.         set fromSysV [lindex $args 2]
  213.         set editPasteCmdBusy [lindex $args [expr $argc -1]]
  214.  
  215.         set groupName [$groupV name]
  216.         set oldGroupV [$this findGroupVersion $groupName]
  217.         if {! [$oldGroupV isNil]} {
  218.         $this deselectVersion $oldGroupV
  219.         if $editPasteCmdBusy {
  220.             [.main undoCommand] addDeselected $oldGroupV
  221.         }
  222.         }
  223.         if [catch {
  224.         eval $this SystemVersion::copy \
  225.             [lrange $args 0 [expr $argc -2]] "definition" \
  226.             } errorMessage] {
  227.         $fromSysV select -groupVersion $groupV
  228.         if $editPasteCmdBusy {
  229.             [.main undoCommand] delete
  230.         }
  231.         wmtkerror $errorMessage
  232.         }
  233.         if $editPasteCmdBusy {
  234.         set newGroupV [$this findGroupVersion $groupName]
  235.         if {! [$newGroupV isNil]} {
  236.             [.main undoCommand] addObject $newGroupV
  237.         }
  238.         }
  239.     }
  240.     {default} {
  241.         eval $this SystemVersion::copy $args
  242.     }
  243.     }
  244. }
  245.  
  246.  
  247. # Handle copy conflict. Pop up options to
  248. # resolve it based on conflictType and conflictMessage
  249. # and retry the copy.
  250. #
  251. method SysVDbObj::copyConflict {this fileVersions conflictType conflictingFiles fromConfV fromSysV editPasteCmdBusy} {
  252.     interface TemplateDialog .main.copyconflict {
  253.     title "Copy Conflict"
  254.     DlgColumn col {
  255.         DlgRow row {
  256.         Label message {
  257.         }
  258.         }
  259.     }
  260.     PushButton overwrite {
  261.         label "Overwrite"
  262.     }
  263.     PushButton skip {
  264.         label "Skip"
  265.     }
  266.     }
  267.  
  268.     if { $conflictType == "NameConflict" } {
  269.     .main.copyconflict.col.row.message text "Conflicting files:"
  270.     Viewport new .main.copyconflict.col.vp
  271.     set filescol .main.copyconflict.col.vp.col
  272.     DlgColumn new $filescol
  273.  
  274.     set count 1
  275.     foreach fileV $conflictingFiles {
  276.         set typeSpec [getObjectSpec [.main objectHdlr] \
  277.             [$fileV uiClass] [$fileV browserType] \
  278.             ]
  279.         if {"$typeSpec" != ""} {
  280.         set icon [$typeSpec smallIcon]
  281.         } else {
  282.         set icon ""
  283.         }
  284.  
  285.         DlgRow new $filescol.row$count -spaceType NONE
  286.         set fileName [[$fileV file] name]
  287.         if { $icon != "" } {
  288.         Image new $filescol.row$count.ico -pixmap $icon
  289.         }
  290.         Label new $filescol.row$count.file -text "$fileName"
  291.         incr count
  292.     }
  293.     } else {
  294.     .main.copyconflict.col.row.message text "There are conflicting items"
  295.     }
  296.     .main.copyconflict delOkButton
  297.     .main.copyconflict helpPressed {.main helpOnName copyConflict}
  298.  
  299.     .main.copyconflict.overwrite activated \
  300.         "$this handleConflict [list $fileVersions] \
  301.         overwrite $fromConfV $fromSysV $editPasteCmdBusy"
  302.     .main.copyconflict.skip activated \
  303.         "$this handleConflict [list $fileVersions] \
  304.         skip $fromConfV $fromSysV $editPasteCmdBusy"
  305.  
  306.     .main.copyconflict popUp
  307. }
  308.  
  309. method SysVDbObj::handleConflict {this fileVersions copyMode fromConfV fromSysV editPasteCmdBusy} {
  310.     .main.copyconflict popDown
  311.     .main.copyconflict delete
  312.     if [catch {
  313.     set copyResult [$this SystemVersion::copy -specified $fileVersions \
  314.         $copyMode files $fromConfV]
  315.     } errorMsg] {
  316.     $this finalizeFailedCopy $fromSysV $errorMsg $editPasteCmdBusy
  317.     return
  318.     }
  319.  
  320.     if { !$copyResult } {
  321.     $this finalizeCopy $files $fromSysV $editPasteCmdBusy
  322.     }
  323. }
  324.  
  325.  
  326. # Copies the specified file versions to this system
  327. # using the 'copyspecs' copy method.
  328. #
  329. method SysVDbObj::copyFileVersions {this sourceSystem sourceConfig args} {
  330.     set argc [llength $args]
  331.  
  332.     # -fileVersion
  333.     set type [lindex $args 0]
  334.     set fileVs [lindex $args 1]
  335.     set editPasteCmdBusy [lindex $args 2]
  336.  
  337.     # removed: automatic deselection of existing files
  338.     wmtkmessage "Copying file(s)"
  339.     if [catch {
  340.     set copyResult [$this SystemVersion::copy \
  341.         -specified "$fileVs" abort files $sourceConfig]
  342.     } errorMsg] {
  343.         $this finalizeFailedCopy $sourceSystem $errorMsg $editPasteCmdBusy
  344.         return 0
  345.     }
  346.     wmtkmessage ""
  347.  
  348.  
  349.     if { $copyResult == -1 } {
  350.     if { $files == "" } {
  351.         set conflictType "ItemConflict"
  352.     } else {
  353.         set conflictType "NameConflict"
  354.     }
  355.     $this copyConflict $fileVs $conflictType \
  356.         $files $sourceConfig $sourceSystem $editPasteCmdBusy
  357.     } else {
  358.     if $editPasteCmdBusy {
  359.         $this finalizeCopy $files $sourceSystem $editPasteCmdBusy
  360.     }
  361.     }
  362. }
  363.  
  364. method SysVDbObj::copyGroupVersion {this groupV fromSysV fromConfV toConfV} {
  365.     # empty
  366. }
  367.  
  368. method SysVDbObj::copyVersion {this} {
  369.     set myType "[[$this system] type]"
  370.     set versionList ""
  371.     foreach system [[$this phase] systems] {
  372.     if {"[$system type]" != "$myType"} continue
  373.     foreach version [$system systemVersions] {
  374.         if {"$version" == "$this"} continue
  375.         lappend versionList [list $version "[$system name]"]
  376.     }
  377.     }
  378.     BrowserProcs::copyVersion $this $versionList
  379. }
  380.  
  381. method SysVDbObj::deactivateObject {this} {
  382.     # empty
  383. }
  384.  
  385. method SysVDbObj::deselectObjects {this} {
  386.     set script ""
  387.     foreach obj [$wmttoolObj selectedObjSet] {
  388.     if {"$script" != ""} {
  389.         append script " ;"
  390.     }
  391.     append script " $this deselectVersion $obj"
  392.     }
  393.     $wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
  394. }
  395.  
  396.  
  397. # Administer the result of the copy of
  398. # the specified file versions in the undocommand.
  399. #
  400. method SysVDbObj::finalizeCopy {this fileVersions fromSysV editPasteCmdBusy} {
  401.     if $editPasteCmdBusy {
  402.     foreach file $fileVersions {
  403.         [.main undoCommand] addObject $file
  404.     }
  405.     if {$this == [[.main currentObj] browsUiObj]} {
  406.         .main updateView
  407.     }
  408.     }
  409. }
  410.  
  411. method SysVDbObj::finalizeFailedCopy {this fromSysV errorMessage editPasteCmdBusy} {
  412.     if {$editPasteCmdBusy && "[[.main undoCommand] operation]" == "cut"} {
  413.     set restoreFileVs {}
  414.     foreach cutFileV [.main cutFileVersions] {
  415.         if { [lsearch -exact $restoreFileVs $cutFileV] == -1 } {
  416.         lappend restoreFileVs $cutFileV
  417.         }
  418.     }
  419.  
  420.     foreach fileV $restoreFileVs {
  421.         $fromSysV select -fileVersion $fileV
  422.     }
  423.     }
  424.     wmtkmessage ""
  425.     if $editPasteCmdBusy {
  426.     [.main undoCommand] delete
  427.     }
  428.     wmtkerror $errorMessage
  429. }
  430.  
  431. method SysVDbObj::groupVersions {this} {
  432.     # empty
  433. }
  434.  
  435. method SysVDbObj::importObject {this context node} {
  436.     set len [llength $context]
  437.     set type [lindex $context [expr $len - 2]]
  438.  
  439.     if {$this == [[.main currentObj] browsUiObj]} {
  440.     set update 1
  441.     } else {
  442.     set update 0
  443.     }
  444.  
  445.     # Import CorporateGroupVersion
  446.     if {$len == 3} {
  447.     set corpGVId [lindex $context 0]
  448.     set corpGV [BrowserProcs::id2obj $corpGVId CorporateGroupVersion $node]
  449.  
  450.     # Make sure CorporateGroupVersion exists
  451.     if [catch {$corpGV corporateGroup}] {
  452.         wmtkinfo "Can not import [lindex $context 1] because it is removed"
  453.         if [isCommand [.main undoCommand]] {
  454.         [.main undoCommand] delete
  455.         }
  456.         return 1
  457.     }
  458.  
  459.     set dstType [[$this phase] type]
  460.     set srcType [[[[$corpGV savedGroupVersion] system] phase] type]
  461.     if {"$srcType" != "$dstType" &&
  462.         ("$srcType" == "Implementation" ||
  463.          "$dstType" == "Implementation")} {
  464.         wmtkmessage "Can not import '$type' from '$srcType' to '$dstType'"
  465.         if [isCommand [.main undoCommand]] {
  466.         [.main undoCommand] delete
  467.         }
  468.         return 0
  469.     }
  470.  
  471.     set myConfV [$node getParent ConfigVersion]
  472.     set editPasteCmdBusy [.main undoCommandBusy EditPasteCmd]
  473.     set script "$this reuse $corpGV $myConfV $editPasteCmdBusy"
  474.     $wmttoolObj startCommand tcl \
  475.         "$script" "" \
  476.         "Reusing [$corpGV getInfo Text]" \
  477.         [list $update 0] 1
  478.  
  479.     return 1
  480.     }
  481.  
  482.     set sysVId [lindex $context 3]
  483.     if {$sysVId == [$this getInfo Identity]} {
  484.     wmtkmessage "Can not import object into its own parent"
  485.     if [isCommand [.main undoCommand]] {
  486.         [.main undoCommand] delete
  487.     }
  488.     return 0
  489.     }
  490.     set sysV [BrowserProcs::id2obj $sysVId SystemVersion $node]
  491.  
  492.     # Import GroupVersion
  493.     set myConfV [$node getParent ConfigVersion]
  494.     set confVId [lindex $context 1]
  495.     set confV [BrowserProcs::id2obj $confVId ConfigVersion $node]
  496.     if {"$type" == "GroupVersion"} {
  497.     set dstType [[$this phase] type]
  498.     set srcType [[$sysV phase] type]
  499.     if {"$srcType" != "$dstType" &&
  500.         ("$srcType" == "Implementation" ||
  501.          "$dstType" == "Implementation")} {
  502.         wmtkmessage "Can not import '$type' from '$srcType' to '$dstType'"
  503.         if [isCommand [.main undoCommand]] {
  504.         [.main undoCommand] delete
  505.         }
  506.         return 0
  507.     }
  508.     set groupVId [lindex $context 4]
  509.     set groupV [BrowserProcs::id2obj $groupVId GroupVersion $node]
  510.  
  511.     # Make sure GroupVersion exists
  512.     if [catch {$groupV group}] {
  513.         wmtkinfo \
  514.         "Can not import [lindex $context 5] because it is removed"
  515.         if [isCommand [.main undoCommand]] {
  516.         [.main undoCommand] delete
  517.         }
  518.         return 1
  519.     }
  520.     $this copyGroupVersion $groupV $sysV $confV $myConfV
  521.  
  522.     return 1
  523.     }
  524. }
  525.  
  526. method SysVDbObj::importObjects {this contextList node} {
  527.  
  528.     set context [lindex $contextList 0]
  529.  
  530.     # just pick one configId and systemId of the dropped files,
  531.     # they will all be the same
  532.     set confVId [lindex $context 1]
  533.     set sysVId [lindex $context 3]
  534.     if {$sysVId == [$this getInfo Identity]} {
  535.     wmtkmessage "Can not import object into its own parent"
  536.     if [isCommand [.main undoCommand]] {
  537.         [.main undoCommand] delete
  538.     }
  539.     return 0
  540.     }
  541.     set sysV [BrowserProcs::id2obj $sysVId SystemVersion $node]
  542.  
  543.     # Remove imported object in case of a cut operation
  544.     set editPasteCmdBusy [.main undoCommandBusy EditPasteCmd]
  545.     if {$editPasteCmdBusy && "[[.main undoCommand] operation]" == "cut"} {
  546.     set cutIt 1
  547.     } else {
  548.     set cutIt 0
  549.     }
  550.  
  551.     set copyList ""
  552.     foreach context $contextList {
  553.     # Import FileVersion
  554.     set fileVId [lindex $context 4]
  555.     set fileV [BrowserProcs::id2obj $fileVId FileVersion $node]
  556.  
  557.     # Make sure FileVersion exists
  558.     if [catch {$fileV file}] {
  559.         set name [lindex $context 5]
  560.         wmtkinfo "Can not import $name because it is removed"
  561.         continue
  562.     }
  563.     lappend copyList $fileV
  564.     }
  565.  
  566.     if {$copyList == ""} {
  567.     if [isCommand [.main undoCommand]] {
  568.            [.main undoCommand] delete
  569.     }
  570.     return 1
  571.     }
  572.  
  573.     set sourceContext [BrowserProcs::id2obj $confVId ConfigVersion $node]
  574.  
  575.     if $cutIt {
  576.     $this moveFileVersions $sysV \
  577.         $sourceContext -fileVersion $copyList $editPasteCmdBusy
  578.     } else {
  579.     $this copyFileVersions $sysV \
  580.         $sourceContext -fileVersion $copyList $editPasteCmdBusy
  581.  
  582.     }
  583.     return 1
  584. }
  585.  
  586. proc SysVDbObj::infoProperties {} {
  587.     return [concat \
  588.     [BrowserProcs::infoProperties] \
  589.     {Status Link Version Comments Created Updated Frozen \
  590.      "Controlled Actions" "Created By" "Updated By"} \
  591.     ]
  592. }
  593.  
  594. method SysVDbObj::initializeInfo {this dummy} {
  595.     set oldLink [[$this info] set PhaseSystemLink]
  596.     [$this info] contents ""
  597.     $this setInfo PhaseSystemLink $oldLink
  598. }
  599.  
  600. method SysVDbObj::linkStatus {this} {
  601.     return [[[$this info] set PhaseSystemLink] status]
  602. }
  603.  
  604. method SysVDbObj::localFileVersions {this} {
  605.     global SysVDbObj::this
  606.     set SysVDbObj::this $this
  607.     set localFileVersions ""
  608.     foreach link [$this fileVersionLinks] {
  609.     set fileV [$link fileVersion]
  610.     $fileV setInfo SystemFileLink $link
  611.     lappend localFileVersions $fileV
  612.     }
  613.     unset SysVDbObj::this
  614.     return $localFileVersions
  615. }
  616.  
  617. method SysVDbObj::localFileOnlyVersions {this} {
  618.     set localFileOnlyVersions ""
  619.     foreach fileV [$this localFileVersions] {
  620.     if {"[$fileV getInfo Status]" == "reused"} continue
  621.     lappend localFileOnlyVersions $fileV
  622.     }
  623.     return $localFileOnlyVersions
  624. }
  625.  
  626. method SysVDbObj::makeUpToDate {this} {
  627.     $this VersionObj::makeUpToDate
  628. }
  629.  
  630. method SysVDbObj::moveFileVersions {this sourceSystem sourceConfig args} {
  631.     # poor man's move: add implicitly selected files (copyspecs)
  632.     # to copyList and deselect files after copying (in finalizeCopy)
  633.     # after titanic a 'move' should be added to the server interface
  634.     # and called here.
  635.     set type [lindex $args 0]
  636.     set fileVs [lindex $args 1]
  637.     set editPasteCmdBusy [lindex $args 2]
  638.     foreach cutFileV [.main cutFileVersions] {
  639.     if { [lsearch -exact $fileVs $cutFileV] == -1 } {
  640.         lappend fileVs $cutFileV
  641.     }
  642.     }
  643.  
  644.     foreach fileV $fileVs {
  645.     $sourceSystem cutVersion $fileV
  646.     }
  647.  
  648.     $this copyFileVersions $sourceSystem \
  649.         $sourceConfig $type $fileVs $editPasteCmdBusy
  650. }
  651.  
  652. method SysVDbObj::name {this} {
  653.     return "[[$this system] name]"
  654. }
  655.  
  656. method SysVDbObj::newObjects {this} {
  657.     set script ""
  658.     foreach obj [$wmttoolObj selectedObjSet] {
  659.     if {"$script" != ""} {
  660.         append script " ;"
  661.     }
  662.     if [$obj isA FileVersion] {
  663.         set flag "-fileVersion"
  664.     } elseif [$obj isA GroupVersion] {
  665.         set flag "-groupVersion"
  666.     } else {
  667.         set flag ""
  668.     }
  669.     append script " \
  670.         set configV \[$obj getParent ConfigVersion\];\
  671.         $this derive $flag $obj \$configV"
  672.     }
  673.     $wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
  674. }
  675.  
  676. method SysVDbObj::removeObjects {this} {
  677.     set box $wmttoolObj.removeWarning
  678.     ClassMaker::extend YesNoWarningDialog RemoveObjectsWarningDialog dbObj
  679.     RemoveObjectsWarningDialog new $box \
  680.     -title "Confirm Object Delete" \
  681.     -message [BrowserProcs::removeMessage] \
  682.     -dbObj $this \
  683.     -noPressed {%this delete} \
  684.     -yesPressed {
  685.         set dbObj [%this dbObj]
  686.         set script ""
  687.         foreach obj [$wmttoolObj selectedObjSet] {
  688.         if {"$script" != ""} {
  689.             append script " ;"
  690.         }
  691.         append script " $dbObj removeObject $obj"
  692.         }
  693.         $wmttoolObj startCommand tcl "$script" "" "" {1 0} 1
  694.         %this delete
  695.     }
  696.     $box delCancelButton
  697.     $box popUp
  698. }
  699.  
  700. method SysVDbObj::removeVersion {this} {
  701.     set versionList ""
  702.     foreach version [[$this system] systemVersions] {
  703.     if [$version isLeaf] {
  704.         lappend versionList $version
  705.     }
  706.     }
  707.     BrowserProcs::removeVersion \
  708.     "[$this getParent PhaseVersion]" "[$this system]" $versionList
  709. }
  710.  
  711. method SysVDbObj::reuse {this args} {
  712.     set argc [llength $args]
  713.     if {$argc <= 2} {
  714.     eval $this SystemVersion::reuse $args
  715.     return
  716.     }
  717.  
  718.     set corpGV [lindex $args 0]
  719.     set editPasteCmdBusy [lindex $args [expr $argc -1]]
  720.     eval $this SystemVersion::reuse [lrange $args 0 [expr $argc -2]]
  721.     if $editPasteCmdBusy {
  722.     [.main undoCommand] addObject $corpGV
  723.     }
  724. }
  725.  
  726. method SysVDbObj::reused {this} {
  727.     # empty
  728. }
  729.  
  730. method SysVDbObj::selectObject {this mode} {
  731.     busy {
  732.     if [isCommand [[.main moduleHdlr] getModuleSpec corpmodelling]] {
  733.         set corpmodelling 1
  734.     } else {
  735.         set corpmodelling 0
  736.     }
  737.  
  738.     set versionList ""
  739.     foreach fileV [$this localFileVersions] {
  740.         set workingList([$fileV file]) $fileV
  741.     }
  742.     if $corpmodelling {
  743.         foreach groupV [$this groupVersions] {
  744.         set workingList([$groupV group]) $groupV
  745.         }
  746.     }
  747.     case "$mode" in {
  748.         {new} {
  749.         set fileList ""
  750.         foreach file [[$this system] files] {
  751.             if [info exists workingList($file)] continue
  752.             lappend fileList $file
  753.         }
  754.         if $corpmodelling {
  755.             set groupList ""
  756.             foreach group [[$this system] groups] {
  757.             if [info exists workingList($group)] continue
  758.             lappend groupList $group
  759.             }
  760.         }
  761.         }
  762.         {default} {
  763.         set fileList ""
  764.         set groupList ""
  765.         foreach obj [$wmttoolObj selectedObjSet] {
  766.             if [$obj isA FileVersion] {
  767.             lappend fileList [$obj file]
  768.             } elseif [$obj isA GroupVersion] {
  769.             lappend groupList [$obj group]
  770.             }
  771.         }
  772.         }
  773.     }
  774.     foreach file $fileList {
  775.         set fileName [$file qualifiedName :]
  776.         if [info exists workingList($file)] {
  777.         set working $workingList($file)
  778.         } else {
  779.         set working [ORB::nil]
  780.         }
  781.         foreach version [$file fileVersions] {
  782.         if [$version isSame $working] continue
  783.         set status [$version status]
  784.         if {"$status" == "working" || "$status" == "reused"} continue
  785.         lappend versionList [list $version "$fileName"]
  786.         }
  787.     }
  788.     if $corpmodelling {
  789.         foreach group $groupList {
  790.         set groupName [$group name]
  791.         if [info exists workingList($group)] {
  792.             set working $workingList($group)
  793.         } else {
  794.             set working [ORB::nil]
  795.         }
  796.         foreach version [$group groupVersions] {
  797.             if [$version isSame $working] continue
  798.             if {"[$version status]" == "working"} continue
  799.             lappend versionList [list $version "$groupName"]
  800.         }
  801.         }
  802.     }
  803.     BrowserProcs::selectObject $this $versionList $mode
  804.     }
  805. }
  806.  
  807. method SysVDbObj::system {this} {
  808.     if {[catch {set system [[[$this info] set PhaseSystemLink] system]}] ||
  809.     [$system isNil]} {
  810.     global errorInfo
  811.     set errorInfo ""
  812.     global errorCode
  813.     set errorCode ""
  814.     return [$this SystemVersion::system]
  815.     }
  816.     return $system
  817. }
  818.  
  819. # Do not delete this line -- regeneration end marker
  820.  
  821.