home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / msexportco.tcl < prev    next >
Text File  |  1997-06-03  |  4KB  |  129 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1997
  4. #
  5. #      File:           @(#)msexportco.tcl    /main/hindenburg/5
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)msexportco.tcl    /main/hindenburg/5   15 May 1997 Copyright 1997 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. #require "msrepchoos.tcl"
  15.  
  16. Class MsExportControl : {MsRepChooser} {
  17.     constructor
  18.     method destructor
  19.     method handleOk
  20.     method export
  21.     method createRep
  22.     method installUML
  23.     method UMLInstalled
  24.     method enterModelName
  25.     attribute systems
  26. }
  27.  
  28. constructor MsExportControl {class this name userName password i_systems} {
  29.     set this [MsRepChooser::constructor $class $this $name $userName $password]
  30.     $this systems $i_systems
  31.     # Start constructor user section
  32.     $this config \
  33.         -title "Repository to export to" 
  34.     
  35.     # End constructor user section
  36.     return $this
  37. }
  38.  
  39. method MsExportControl::destructor {this} {
  40.     # Start destructor user section
  41.     # End destructor user section
  42.     $this MsRepChooser::destructor
  43. }
  44.  
  45. method MsExportControl::handleOk {this} {
  46.     $this MsRepChooser::handleOk
  47.     
  48.     if ![$this repFound] {
  49.         $this repFound [$this createRep] 
  50.         return
  51.     }
  52.     if ![$this repFound] {
  53.         return
  54.     }
  55.     if ![$this hasUml] {
  56.         $this installUML 
  57.     } 
  58.     $this enterModelName
  59.     
  60. }
  61.  
  62. method MsExportControl::export {this modelName} {
  63.     wmtkmessage "Starting to export ..."
  64.     set otprintScr "[m4_path_name bin  otsh$EXE_EXT] -f \
  65.         [quoteIf [m4_var get M4_home]/contrib/ObjectTeamMsRepUml/tcl/msumlexport.tcl] --  [$this repName] $modelName [$this systems]" 
  66.     .main startCommand mtool $otprintScr "" \
  67.                 "Exporting to MS Repository [$this repName]" {0 0} 0
  68.     $this delete
  69.  
  70. }
  71.  
  72. method MsExportControl::createRep {this} {
  73.     set box .main.msCreateRepQuestion
  74.     if ![isCommand $box] {
  75.         ClassMaker::extend QuestionDialog CreRepQuestionDialog control
  76.         CreRepQuestionDialog new $box \
  77.         -title "Repository Creation" \
  78.         -message "Do you want to create an Access database?"\
  79.         -okPressed { 
  80.             [%this control] installUML
  81.             }
  82.     }
  83.     $box control $this
  84.     $box popUp
  85. }
  86.  
  87. method MsExportControl::installUML {this} {
  88.     set newRep [OleAutoObject new Repository]
  89.     regsub -all {\\} [$this repName] {/} repName
  90.     if ![string match *.mdb $repName ] {
  91.         set repName $repName.mdb
  92.     }
  93.     if ![file isfile $repName] {
  94.         wmtkmessage "Creating $repName ..."
  95.         $newRep Create $repName
  96.     }
  97.     set catched [catch {set umlInstall [OleAutoObject new UMLInstall.TIM]}]
  98.     wmtkmessage "Installing UMLInstall.TIM ..."
  99.     set catched [catch { $umlInstall Install $repName }]
  100.     #$umlInstall Install $repName "" ""
  101.     $newRep delete
  102.     $umlInstall delete
  103.     $this enterModelName
  104. }
  105.  
  106. method MsExportControl::UMLInstalled {this} {
  107.     # !! Implement this function !!
  108. }
  109.  
  110. method MsExportControl::enterModelName {this} {
  111.     set box .main.msModelNameEntry
  112.         if ![isCommand $box] {
  113.                 ClassMaker::extend EntryDialog ModelEntryDialog control
  114.                 ModelEntryDialog new $box \
  115.             -modal yes \
  116.             -title "Model Name" \
  117.             -message "Enter model name:" \
  118.             -entry "ObjectTeam-Model" \
  119.             -okPressed { 
  120.                 [%this control] export [%this entry]
  121.             }
  122.     }
  123.     $box control $this
  124.         $box popUp
  125. }
  126.  
  127. # Do not delete this line -- regeneration end marker
  128.  
  129.