home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)ssysvdbobj.tcl /main/titanic/15
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)ssysvdbobj.tcl /main/titanic/15 16 Oct 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- require "wmt_util.tcl"
- # End user added include file section
-
- require "sysvdbobj.tcl"
-
- Class SSysVDbObj : {SysVDbObj} {
- method destructor
- constructor
- method promoter
- method addExternalLinks
- method addFileVersion
- method addGroupVersion
- method allowsDrop
- method canBeDragged
- method compareWithPrevPhase
- method importFiles
- method importFromPrevPhase
- method prevPhaseExists
- method printObjects
- method makeFileChooserFilter
- method reverseEngineer
- method savedGroupVersions
- method snapshotObjects
- attribute prevPhaseV
- attribute savedGroupVersionSet
- }
-
- method SSysVDbObj::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this SysVDbObj::destructor
- }
-
- constructor SSysVDbObj {class this name} {
- set this [SysVDbObj::constructor $class $this $name]
- return $this
- }
-
- method SSysVDbObj::promoter {this} {
- $this SysVDbObj::promoter
- module_promoter SSysVDbObj $this
- }
-
- method SSysVDbObj::addExternalLinks {this} {
- set box $wmttoolObj.newExternalL
- if {! [isCommand $box]} {
- ClassMaker::extend FileChooser NewExternalLFileChooser dbObj
- if $win95 {
- set filter "All Files (*.*)|*|"
- } else {
- set filter "*"
- }
- NewExternalLFileChooser new $box \
- -title "New External Link(s)" \
- -selectionPolicy EXTENDED \
- -directory [pwd] \
- -filter $filter \
- -helpPressed { .main helpOnName newExternalLink } \
- -okPressed {
- set script ""
- set invisibleTypes ""
- set currentSpec [[$wmttoolObj infoView] currentSpec]
- if [isCommand $currentSpec] {
- set visibleTypes [$currentSpec objectTypes]
- } else {
- set visibleTypes ""
- }
- foreach external [%this selectedSet] {
- set type [path_name type $external]
- set name [path_name base $external]
- if {(! [lempty $visibleTypes]) &&
- [lsearch -exact $visibleTypes "$type"] == -1} {
- append invisibleTypes "\n$external"
- }
- if {"$script" != ""} {
- append script " ;"
- }
- append script \
- " [%this dbObj] createExternalLink \
- [list $name] [list $type] [list $external]"
- }
- if {"$script" != ""} {
- $wmttoolObj startCommand tcl \
- "$script" "" \
- "Creating external file link(s)..." \
- {1 0} 1
- }
- if {"$invisibleTypes" != ""} {
- set box $wmttoolObj.newExternalLWarning
- set message \
- "The following external file links are not visible\n\
- within the current view:\n\
- $invisibleTypes"
- WarningDialog new $box \
- -title "New External Link(s) Warning" \
- -message $message \
- -okPressed "$box delete"
- $box popUp
- $box delHelpButton
- }
- }
- }
- $box dbObj $this
- $box popUp
- }
-
- method SSysVDbObj::addFileVersion {this type} {
- require "newdiagram.tcl"
-
- set box "$wmttoolObj.new[string toupper $type]"
- if {! [isCommand $box]} {
- NewDiagramDlg new $box -type $type
- }
- $box dbObj $this
- $box popUp
- }
-
- method SSysVDbObj::addGroupVersion {this} {
- # empty
- }
-
- method SSysVDbObj::allowsDrop {this uiClass} {
- case "$uiClass" in {
- {CorporateGroupVersion Graph GroupVersion Matrix} {
- return 1
- }
- {default} {
- return 0
- }
- }
- }
-
- proc SSysVDbObj::associations {} {
- return {localFileVersions customFileVersionSet workItemSet}
- }
-
- method SSysVDbObj::canBeDragged {this} {
- return 1
- }
-
- proc SSysVDbObj::childTypes {assoc} {
- if {[lsearch -exact "[SSysVDbObj::associations]" "$assoc"] == -1} {
- return ""
- }
- set childTypes [BrowserProcs::childTypes $assoc]
- case "$childTypes" in {
- {LocalFileVersion} {
- return "${BrowserProcs::diagramFileTypes}"
- }
- {default} {
- return [SysVDbObj::childTypes "$assoc"]
- }
- }
- }
-
- method SSysVDbObj::compareWithPrevPhase {this} {
- require "comparepha.tcl"
- ComparePhaseDlg new $wmttoolObj.compareWithPrevPhase \
- -dbObj $this \
- -title "Compare With Previous Phase" \
- -helpPressed {.main helpOnName compareWithPrevPhase}
- $wmttoolObj.compareWithPrevPhase popUp
- }
-
- proc SSysVDbObj::controlledLists {} {
- return [concat \
- [SysVDbObj::controlledLists] \
- {"[$this corporateGroupVersionLinkList]"
- "[$this externalLinkList]"
- "[[$this system] groupList]"
- "[$this groupVersionLinkList]"} \
- ]
- }
-
- method SSysVDbObj::importFiles {this fileList overwriteFlag} {
- set args "-f impfiles.tcl"
- if {"$overwriteFlag" != "" || (! [lempty $fileList])} {
- append args " --"
- if {"$overwriteFlag" != ""} {
- append args " $overwriteFlag"
- }
- if {! [lempty $fileList]} {
- append args " $fileList"
- }
- }
- set script "[quoteIf [m4_path_name bin otsh$EXE_EXT]] $args"
- $wmttoolObj startCommand mtool \
- "$script" "" "Starting 'Import Files'" {1 0} 0
- }
-
- method SSysVDbObj::importFromPrevPhase {this mode} {
- set fileList ""
- case "$mode" in {
- {selected} {
- foreach obj [$wmttoolObj selectedObjSet] {
- if [$obj isA SystemFileReference] {
- set fileV [$obj getInfo "File Version"]
- if {"$fileV" != ""} {
- lappend fileList [[$fileV file] identity]
- }
- } elseif [$obj isA FileVersion] {
- lappend fileList [[$obj file] identity]
- }
- }
- }
- }
-
- ClassMaker::extend YesNoWarningDialog OverwritePropertiesDialog \
- {dbObj fileList}
- set box $wmttoolObj.overwriteProperties
- OverwritePropertiesDialog new $box \
- -title "Overwrite Properties" \
- -message "Should properties of existing items be overwritten ?" \
- -dbObj $this \
- -fileList $fileList \
- -yesPressed {
- [%this dbObj] importFiles "[%this fileList]" "-overwrite"
- %this delete
- } \
- -noPressed {
- [%this dbObj] importFiles "[%this fileList]" ""
- %this delete
- } \
- -cancelPressed {%this delete} \
- -helpPressed {.main helpOnName overwriteProperties}
- $box popUp
- }
-
- proc SSysVDbObj::infoProperties {} {
- return [SysVDbObj::infoProperties]
- }
-
- method SSysVDbObj::prevPhaseExists {this} {
- set confV [$this getParent ConfigVersion]
- set phaseV [$this getParent PhaseVersion]
- set prevPhaseV [$phaseV previous $confV]
- if {! [$prevPhaseV isA PhaseVersion]} {
- return 0
- }
-
- $this prevPhaseV $prevPhaseV
- return 1
- }
-
- method SSysVDbObj::printObjects {this} {
- set asciiFiles ""
- set topostObjects ""
- set errorStack ""
- set confV [$this getParent ConfigVersion]
- foreach obj [$wmttoolObj selectedObjSet] {
- if [$obj isA ExternalLink] {
- lappend asciiFiles [$obj path]
- } elseif [$obj isA SystemFileReference] {
- set fileV [$obj getInfo "File Version"]
- if [$fileV isA Graph] {
- set sysV [$obj referredSystemVersion]
- if [$sysV isNil] {
- if {"$errorStack" == ""} {
- append errorStack "\n"
- }
- append errorStack "Could not print \
- [$obj getInfo Type] '[$obj getInfo Name]':\n \
- System '[[$obj referredSystem] name]' is not \
- selected within the current PhaseVersion"
- } else {
- require "print.tcl"
- eval Print::printDiagrams \
- -configVersion $confV \
- -systemVersion $sysV \
- $fileV
- }
- } elseif [$fileV isA ExternalFileVersion] {
- $fileV synchWithFileSystem
- lappend asciiFiles [$fileV path]
- }
- } elseif [$obj isA Graph] {
- lappend topostObjects $obj
- } elseif [$obj isA ExternalFileVersion] {
- $obj synchWithFileSystem
- lappend asciiFiles [$obj path]
- }
- }
- BrowserProcs::printObjects $asciiFiles $topostObjects
- if {"$errorStack" != ""} {
- wmtkerror $errorStack
- }
- }
-
- method SSysVDbObj::makeFileChooserFilter {this browserTypes} {
- set filter ""
- set extensions ""
- set objHdlr [$wmttoolObj objectHdlr]
- foreach brType $browserTypes {
- set typeSpec [getObjectSpec $objHdlr ExternalFileVersion $brType]
- if {$typeSpec == "" || [set fsExt [$typeSpec fsExtension]] == ""} {
- set fsExt $brType
- }
- if $win95 {
- set filter "${filter}[cap $brType] Files (*.${fsExt})|*.${fsExt}|"
- lappend extensions "*.$fsExt"
- } else {
- if {$filter != ""} {
- # more than one type to filter ==> make filter just "*"
- return "*"
- }
- set filter "*.$fsExt"
- }
- }
- if $win95 {
- if {[llength $extensions] > 1} {
- set extsStr [join $extensions \;]
- set filter "${filter}All Files (${extsStr})|${extsStr}|"
- }
- set filter "${filter}All Files (*.*)|*|"
- }
- return $filter
- }
-
- method SSysVDbObj::reverseEngineer {this lang language browserTypes} {
- # lang is the short name of the language; language is the long name of the
- # language; browserTypes is a list with types that can be reverse
- # engineered. E.g.: lang = "cpp", language = "C++", browserTypes = "h++"
- #
- set filter [$this makeFileChooserFilter $browserTypes]
- set box $wmttoolObj.reverseEngineer[cap $lang]Files
- if {! [isCommand $box]} {
- ClassMaker::extend FileChooser RevEng[cap $lang]FileChooser {dbObj lang}
- RevEng[cap $lang]FileChooser new $box \
- -title "Reverse Engineer $language" \
- -selectionPolicy EXTENDED \
- -directory [pwd] \
- -filter $filter \
- -okPressed {
- set clang [cap [%this lang]]
- set box $wmttoolObj.reverseEngineer$clang
- require [string range reveng[%this lang]dlg 0 9].tcl
- if {! [isCommand $box]} {
- RevEng${clang}Dlg new $box \
- -helpPressed ".main helpOnName reverseEngineer"
- }
- $box config \
- -dbObj [%this dbObj] \
- -headerFiles [%this selectedSet]
- $box popUp
- }
- $box delHelpButton
- }
- $box dbObj $this
- $box lang $lang
- $box popUp
- }
-
- method SSysVDbObj::savedGroupVersions {this} {
- # empty
- }
-
- method SSysVDbObj::snapshotObjects {this} {
- # empty
- }
-
- # Do not delete this line -- regeneration end marker
-
-