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

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1997
  4. #
  5. #      File:           @(#)contsysvdb.tcl    /main/hindenburg/4
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)contsysvdb.tcl    /main/hindenburg/4   16 May 1997 Copyright 1997 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. require_module_file "newcontinu.tcl" continuus-vcm
  13. require_module_file "contsysdia.tcl" continuus-vcm
  14. require_module_file "contchange.tcl" continuus-vcm
  15. require_module_file "vssyswarni.tcl" vcm
  16. # End user added include file section
  17.  
  18. require_module_file "contsystem.tcl" continuus
  19. require_module_file "vssysvdbob.tcl" vcm
  20.  
  21. # This class represents a system with Continuus files in the browser.
  22.  
  23. Class ContSysVDbObj : {ContSystem VSSysVDbObj} {
  24.     constructor
  25.     method destructor
  26.     method promoter
  27.     method promoteFile
  28.     method path
  29.     method localFileVersions
  30.     method copy
  31.     method vsFiles
  32.     method fileList
  33.     method addContFile
  34.     method checkOutFiles
  35.     method checkInFiles
  36.     method checkInTask
  37.     method findUse
  38.     method useVersion
  39.     method unUseVersions
  40.     method deleteVersions
  41.     method history
  42.     method editProperties
  43.     method updateWorkArea
  44.     method startQuery
  45.     method startObjectMake
  46.     method startSelectTask
  47.     method startProblemTracking
  48.     method showProjectVersion
  49.     method changeProjectVersion
  50.     method initializeVCMVars
  51.  
  52.     # Used to hold information about files in this system:
  53.     # Version, Owner, Status, Continuus Type, Created,
  54.     # Modified, Platform, Release, Task.
  55.     # For performance reasons.
  56.     #
  57.     attribute continuusFileInfoDict
  58. }
  59.  
  60. constructor ContSysVDbObj {class this name i_name} {
  61.     set this [ContSystem::constructor $class $this $name]
  62.     set this [VSSysVDbObj::constructor $class $this $i_name]
  63.     # Start constructor user section
  64.     # End constructor user section
  65.     return $this
  66. }
  67.  
  68. method ContSysVDbObj::destructor {this} {
  69.     # Start destructor user section
  70.     # End destructor user section
  71.     $this ContSystem::destructor
  72.     $this VSSysVDbObj::destructor
  73. }
  74.  
  75.  
  76. # Reuse associations of VSSysVDbObj.
  77. #
  78. proc ContSysVDbObj::associations {} {
  79.     return [VSSysVDbObj::associations]
  80. }
  81.  
  82.  
  83. # Reuse childTypes of VSSysVDbObj.
  84. #
  85. proc ContSysVDbObj::childTypes {assoc} {
  86.     return [VSSysVDbObj::childTypes $assoc]
  87. }
  88.  
  89.  
  90. # Reuse controlledLists of VSSysVDbObj.
  91. #
  92. proc ContSysVDbObj::controlledLists {} {
  93.     return [VSSysVDbObj::controlledLists]
  94. }
  95.  
  96.  
  97. # Reuse infoProperties of VSSysVDbObj.
  98. #
  99. proc ContSysVDbObj::infoProperties {} {
  100.     return [VSSysVDbObj::infoProperties]
  101. }
  102.  
  103. method ContSysVDbObj::promoter {this} {
  104.     $this continuusFileInfoDict [Dictionary new]
  105.     $this VSSysVDbObj::promoter
  106. }
  107.  
  108.  
  109. # Promotes file to a ContFileUiObj.
  110. #
  111. method ContSysVDbObj::promoteFile {this file} {
  112.     ContFileUiObj promote $file
  113. }
  114.  
  115.  
  116. # Call path in ContSystem.
  117. #
  118. method ContSysVDbObj::path {this} {
  119.     return [$this ContSystem::path]
  120. }
  121.  
  122.  
  123. # Resolve ambiguity: call localFileVersions of ContSystem.
  124. #
  125. method ContSysVDbObj::localFileVersions {this} {
  126.     return [$this ContSystem::localFileVersions]
  127. }
  128.  
  129.  
  130. # Call copy of VSSysDbObj.
  131. #
  132. method ContSysVDbObj::copy {this args} {
  133.     eval $this VSSysVDbObj::copy $args
  134. }
  135.  
  136.  
  137. # Redefine to perform initialization and cache updates.
  138. #
  139. method ContSysVDbObj::vsFiles {this} {
  140.     # read customization files for this system
  141.     if { ![$this initializedCustomization] } {
  142.     $this initializeCustomization
  143.     }
  144.     $this initializeVCMVars
  145.  
  146.     set files [$this ContSystem::vsFiles]
  147.     $this updateFileInfo $files
  148.     return $files
  149. }
  150.  
  151.  
  152. # returns a list of Continuus controlled file names in
  153. # the directories specified in pathList and
  154. # fills continuusFileInfoDict with additional
  155. # info about the files.
  156. #
  157. method ContSysVDbObj::fileList {this pathList} {
  158.     # refresh continuusFileInfoDict
  159.     foreach name [[$this continuusFileInfoDict] names]  {
  160.     [$this continuusFileInfoDict] unset $name
  161.     }
  162.  
  163.     ContCommand::longListing $pathList [$this continuusFileInfoDict]
  164.     set fileList {}
  165.     foreach fileName [[$this continuusFileInfoDict] names] {
  166.     lappend fileList [path_name file $fileName]
  167.     }
  168.  
  169.     return $fileList
  170. }
  171.  
  172.  
  173. # Pop up dialog to create new Continuus file.
  174. #
  175. method ContSysVDbObj::addContFile {this} {
  176.     if { ![isCommand .main.newContFile] } {
  177.     NewContinuusFileDialog new .main.newContFile
  178.     }
  179.  
  180.     .main.newContFile popUp
  181. }
  182.  
  183. method ContSysVDbObj::checkOutFiles {this} {
  184.     if { ![isCommand .main.cont.checkout] } {
  185.     ContSysDialog new .main.cont.checkout
  186.     .main.cont.checkout contDialogCommand [ContCommand::checkOutDialog]
  187.     .main.cont.checkout needsUpdate 1
  188.     }
  189.  
  190.     .main.cont.checkout popUpContinuusDialog 
  191. }
  192.  
  193. method ContSysVDbObj::checkInFiles {this} {
  194.     if { ![isCommand .main.cont.checkin] } {
  195.     ContSysDialog new .main.cont.checkin
  196.     .main.cont.checkin contDialogCommand [ContCommand::checkInDialog]
  197.     .main.cont.checkin needsUpdate 1
  198.     }
  199.  
  200.     .main.cont.checkin popUpContinuusDialog 
  201. }
  202.  
  203.  
  204. # Checks in the task related with the selected file in the browser.
  205. # Generates warning if no task is associated.
  206. #
  207. method ContSysVDbObj::checkInTask {this} {
  208.     set selectedFile [lindex [.main selectedObjSet] 0]
  209.     set task [$selectedFile getInfo Task]
  210.     set fileVersion "[path_name file [$selectedFile path]]-[$selectedFile getInfo Version]"
  211.     if { "$task" == "<void>" } {
  212.     wmtkwarning "No tasks associated with $fileVersion"
  213.     return
  214.     }
  215.  
  216.     vsCommandHandler execute [ContCommand::checkInTaskDialog $task]
  217. }
  218.  
  219.  
  220. # Pop up the find use dialog for the selected object.
  221. #
  222. method ContSysVDbObj::findUse {this} {
  223.     if { ![isCommand .main.cont.finduse] } {
  224.     ContSysDialog new .main.cont.finduse
  225.     .main.cont.finduse contDialogCommand [ContCommand::findUseDialog]
  226.     .main.cont.finduse needsUpdate 0
  227.     }
  228.  
  229.     .main.cont.finduse popUpContinuusDialog 
  230. }
  231.  
  232. method ContSysVDbObj::useVersion {this} {
  233.     if { ![isCommand .main.cont.use] } {
  234.     ContSysDialog new .main.cont.use
  235.     .main.cont.use contDialogCommand [ContCommand::useDialog]
  236.     .main.cont.use needsUpdate 1
  237.     }
  238.  
  239.     .main.cont.use popUpContinuusDialog 
  240. }
  241.  
  242. method ContSysVDbObj::unUseVersions {this} {
  243.     if { ![isCommand .main.contUnuse] } {
  244.     VSSysWarningDialog new .main.contUnuse
  245.     .main.contUnuse vsMethod { $file unuseVersion }
  246.     .main.contUnuse action "Unuse and replace current version of"
  247.     }
  248.  
  249.     .main.contUnuse popUp
  250. }
  251.  
  252. method ContSysVDbObj::deleteVersions {this} {
  253.     if { ![isCommand .main.contDelete] } {
  254.     VSSysWarningDialog new .main.contDelete
  255.     .main.contDelete vsMethod { $file deleteVersion }
  256.     .main.contDelete action "Delete and replace current version of"
  257.     }
  258.  
  259.     .main.contDelete popUp
  260. }
  261.  
  262. method ContSysVDbObj::history {this} {
  263.     if { ![isCommand .main.cont.history] } {
  264.     ContSysDialog new .main.cont.history
  265.     .main.cont.history contDialogCommand [ContCommand::historyDialog]
  266.     .main.cont.history needsUpdate 0
  267.     }
  268.  
  269.     .main.cont.history popUpContinuusDialog 
  270. }
  271.  
  272. method ContSysVDbObj::editProperties {this} {
  273.     if { ![isCommand .main.cont.properties] } {
  274.     ContSysDialog new .main.cont.properties
  275.     .main.cont.properties contDialogCommand [ContCommand::propertyDialog]
  276.     .main.cont.properties needsUpdate 0
  277.     }
  278.  
  279.     .main.cont.properties popUpContinuusDialog 
  280. }
  281.  
  282. method ContSysVDbObj::updateWorkArea {this} {
  283.     set reconfigCommand [ContCommand::reconfigure [$this path]]
  284.     vsCommandHandler execute $reconfigCommand
  285.  
  286.     .main updateView
  287. }
  288.  
  289. method ContSysVDbObj::startQuery {this} {
  290.     set queryDialog [ContCommand::queryDialog]
  291.     vsCommandHandler execute $queryDialog
  292. }
  293.  
  294. method ContSysVDbObj::startObjectMake {this} {
  295.     set objectMakeDialog [ContCommand::objectMakeDialog]
  296.  
  297.     # invoke from current directory
  298.     set oldDir [pwd]
  299.     cd [$this path]
  300.     vsCommandHandler execute $objectMakeDialog
  301.     cd $oldDir
  302. }
  303.  
  304. method ContSysVDbObj::startSelectTask {this} {
  305.     set selectTaskDialog [ContCommand::selectTaskDialog]
  306.     vsCommandHandler execute $selectTaskDialog
  307. }
  308.  
  309. method ContSysVDbObj::startProblemTracking {this} {
  310.     set problemTrackingDialog [ContCommand::problemTrackingBrowser]
  311.     vsCommandHandler execute $problemTrackingDialog
  312. }
  313.  
  314.  
  315. # Show the project version currently in use in
  316. # an info dialog box.
  317. #
  318. method ContSysVDbObj::showProjectVersion {this} {
  319.     InfoDialog new .main.versionInfo \
  320.         -title "Current Project Version" \
  321.         -message "[$this currentProjectVersion]" \
  322.         -okPressed { %this delete }
  323.  
  324.     .main.versionInfo delHelpButton
  325.     .main.versionInfo popUp
  326. }
  327.  
  328.  
  329. # Change the current project version:
  330. # allow selection of the working versions
  331. # or selection of the latest working version.
  332. #
  333. method ContSysVDbObj::changeProjectVersion {this} {
  334.     if { ![isCommand .main.changeprojectversion] } {
  335.     ContChangeProjectVersionDialog new .main.changeprojectversion
  336.     }
  337.  
  338.     # pass current version
  339.     set currentProjectVersion [$this currentProjectVersion]
  340.     .main.changeprojectversion currentVersion $currentProjectVersion
  341.  
  342.     # make list of project versions and pass to dialog
  343.     regsub {\-[^-]*$} $currentProjectVersion "" project
  344.     set projectVersions {}
  345.     foreach version [ContCommand::getWorkingProjectVersions $project] {
  346.     lappend projectVersions "$project-$version"
  347.     }
  348.     .main.changeprojectversion workingVersions $projectVersions
  349.     .main.changeprojectversion currentSystem $this
  350.  
  351.     .main.changeprojectversion popUp
  352. }
  353.  
  354.  
  355. # Initialize work area variable.
  356. #
  357. method ContSysVDbObj::initializeVCMVars {this} {
  358.     # sport7/Continuus: initialize Continuus vars, always at system level
  359.     global ContCommand::ccmWorkArea
  360.     if { ${ContCommand::ccmWorkArea} == "" } {
  361.     if { ![ContCommand::initializeCcmVars] } {
  362.         return
  363.     }
  364.     }
  365. }
  366.  
  367. # Do not delete this line -- regeneration end marker
  368.  
  369.