home *** CD-ROM | disk | FTP | other *** search
- # Copyright (c) 1997 by Cayenne Software Inc.
- #
- # This software is furnished under a license and may be used only in
- # accordance with the terms of such license and with the inclusion of
- # the above copyright notice. This software or any other copies thereof
- # may not be provided or otherwise made available to any other person.
- # No title to and ownership of the software is hereby transferred.
- #
- # The information in this software is subject to change without notice
- # and should not be construed as a commitment by Cayenne Software Inc
- #
- #---------------------------------------------------------------------------
- #
- # File : @(#)drsconf.tcl /main/titanic/8 23 Jan 1997
- # Author : H. Broeze
- # Original date : 14 Januari 1997
- # Description : Configuration of the DOORS installation
- #
- #---------------------------------------------------------------------------
- #
-
-
- source [m4_path_name tcl cginit.tcl]
- require platform.tcl
- if $win95 {
- if [catch {set regBinDir [registry get HKEY_CLASSES_ROOT \
- "CLSID\\\{5b97da40-622e-11cf-a002-524153480003\}\\DIR" \
- "(Default)"] }] {
- puts "DOORS installation not found"
- return
- }
- set doorsHome [path_name concat $regBinDir ..]
- } else {
- set doorsHome $env(DOORSHOME)
- if ![llength $doorsHome] {
- puts "environment variable DOORSHOME not set"
- exit
- }
- }
-
- if ![file isdir $doorsHome] {
- puts "DOORSHOME: $doorsHome is not a valid directory"
- exit
- }
-
-
- set otDxlFileName [path_name concat $doorsHome lib]
- set otDxlFileName [path_name concat $otDxlFileName dxl]
- set otDxlDirName $otDxlFileName
- set otDxlFileName [path_name concat $otDxlFileName addins]
- set otDxlFileName [path_name concat $otDxlFileName user]
- set otDxlFileName [path_name concat $otDxlFileName ot.dxl]
-
- set otDxlIndexName [path_name concat $otDxlDirName addins]
- set otDxlIndexName [path_name concat $otDxlIndexName user]
- set otDxlIndexName [path_name concat $otDxlIndexName user.idx]
-
- set didExist 0
-
- if [file exists $otDxlFileName] {
- set didExist 1
- }
-
- if {[file exists $otDxlFileName] && ![file writable $otDxlFileName]} {
- puts "$otDxlFileName not writable by you!"
- puts "Configuration of DOORS canceled"
- exit
- }
- if {[file exists $otDxlIndexName] && ![file writable $otDxlIndexName]} {
- puts "$otDxlIndexName not writable by you!"
- puts "Configuration of DOORS canceled"
- exit
- }
- set otDxlFile [open $otDxlFileName w]
-
- set M4_home [m4_var get M4_home]
-
- if $win95 {
- regsub -all {\\} $M4_home "/" M4_home
- }
- puts $otDxlFile "// User Function
-
- // Copyright (c) Cayenne Software INC
-
- /*
- Example User Function
- */
-
- /* Modification history:
-
- Date: Who: Henk Broeze
- */
-
-
- void childCB(int cbNo) {
- status (current Module, \"An ObjectTeam editor is closed\")
- }
-
- Object orgCurr = current Object
- string orgType = orgCurr.\"OTType\"
- int orgTypeLength = length orgType
- if ((orgTypeLength == 0) || (orgType==\"Project\") || (orgType == \"Phase\") || (orgType == \"System\" )) {
- ack \"To start an ObjectTeam editor select a Diagram, a Diagram Object, Class Attribute or Operation\"
- halt
- }
-
- Object cur = orgCurr
- Object prev = orgCurr
- string parents = \"\"
- while (!null cur) {
- string parentOTVersions = cur.\"ParentOTVersions\"
- parentOTVersions = \"{\" parentOTVersions \"} \"
- string otType = cur.\"OTType\"
- if (otType == \"Attribute\" || otType == \"Operation\") {
- prev = cur
- cur = cur parent
- prev = cur
- cur = cur parent
- otType = cur.\"OTType\"
- orgCurr = cur
- }
- string curObjectHeading = cur.\"Object Heading\"
- if (otType == \"\")
- parents = prev.\"OTType\" \" \" parentOTVersions parents
- else
- parents = curObjectHeading \" \" parentOTVersions parents
- prev = cur
- cur = cur parent
- }
- string otType = orgCurr.\"OTType\"
- void startOTEditor () {
- status (current Module, \"Starting ObjectTeam editor\")
- if (platform==\"WIN32\") {
- string otkCommand = \"${M4_home}/bin/otk.exe ${M4_home}/modules/doors/tcl/drsude.tcl -- \" parents \"\"
- system otkCommand
- } else {
- string Command = \"otk ${M4_home}/modules/doors/tcl/drsude.tcl -- \" parents
- system (Command ,childCB)
- }
- }
-
- parents = \"{\" prev.\"SelectedItems\" \"} \" parents
- if (orgType ==\"Class\") {
- DB fileTypeBox =create \"FileTypes\"
- string fileTypes\[\] = {\"cad\", \"ccd\", \"etd\", \"std\", \"cod\"}
- DBE fileTypeList = list(fileTypeBox, \"Select Editor Type\", 4, fileTypes)
- string origParents = parents
- void getFileType(DBE fileTypeList) {
- int i = get fileTypeList
- parents = origParents fileTypes\[i\]
- hide fileTypeBox
- startOTEditor
- }
- set(fileTypeList, getFileType)
- show fileTypeBox
- } else {
- if (orgType ==\"Event\") {
- DB fileTypeBox =create \"FileTypes\"
- string fileTypes\[\] = {\"cod\", \"std\", \"etd\", \"mgd\"}
- DBE fileTypeList = list(fileTypeBox, \"Select Editor Type\", 3, fileTypes)
- string origParents = parents
- void getFileType(DBE fileTypeList) {
- int i = get fileTypeList
- parents = origParents fileTypes\[i\]
- hide fileTypeBox
- startOTEditor
- }
- set(fileTypeList, getFileType)
- show fileTypeBox
- } else {
- if (orgType ==\"Attribute\" || orgType==\"Operation\") {
- parents = parents \"cad\"
- } else {
- string edTypes = orgCurr.\"OTEditorTypes\" \"\"
- if (edTypes == \"\") {
- ack \"No editor defined for this object\"
- halt
- }
- parents = parents orgCurr.\"OTEditorTypes\" \"\"
- }
- startOTEditor
- }
- }"
-
- puts "The DOORS installation is configured for navigation to ObjectTeam"
- close $otDxlFile
- if $didExist {
- # config is already done once so
- # no extension of menu
- # default start up of dxl server already available
- return
- }
-
- puts "The DOORS installation is configured with an extra ObjectTeam option in the user menu"
- set otDxlIndexFile [open $otDxlIndexName a]
- puts $otDxlIndexFile "ot O _ Start ObjectTeam editor"
- close $otDxlIndexFile
-
- if $win95 {
- exit
- }
-
- set startupFileName [path_name concat $otDxlDirName startup.dxl]
- if ![file writable $startupFileName] {
- puts "$startupFileName does not exist or is not writable by you!"
- puts "Configuration of DOORS canceled"
- exit
- }
-
- # for default starting the dxl server
- puts "Configuration the DOORS installation so that the dxlserver is started automatic"
- set otStartUpFile [open $startupFileName a]
- puts "Configuration of DOORS completed"
- puts $otStartUpFile "// to start the server by default
- #include <standard/external/dxlserv.dxl>"
- close $otStartUpFile
-