home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)ucustfuiob.tcl /main/titanic/18
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)ucustfuiob.tcl /main/titanic/18 17 Oct 1997 Copyright 1996 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require "browsuiobj.tcl"
-
- Class UCustFUiObj : {BrowsUiObj} {
- constructor
- method destructor
- method addExternalFile
- method externalFiles
- method files
- method moduleFiles
- method printObjects
- method removeObjects
- attribute pattern
- }
-
- global UCustFUiObj::uiClass
- set UCustFUiObj::uiClass "UserCustomFiles"
-
-
- constructor UCustFUiObj {class this name} {
- set this [BrowsUiObj::constructor $class $this $name]
- # Start constructor user section
-
- $this uiName "<user customization files>"
- $this uiText "user customization files"
- $this pattern "*"
-
- # End constructor user section
- return $this
- }
-
- method UCustFUiObj::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this BrowsUiObj::destructor
- }
-
- method UCustFUiObj::addExternalFile {this} {
- foreach childType [UCustFUiObj::externalFileNames] {
- set externalFileList($childType) 1
- }
- foreach externalFile [$this getChildSet externalFiles] {
- set type [$externalFile uiName]
- if [info exists externalFileList($type)] {
- unset externalFileList($type)
- }
- }
- if [info exists externalFileList] {
- set entrySet [lsort [array names externalFileList]]
- } else {
- set entrySet ""
- }
-
- require "editseldia.tcl"
- set box .main.newExternalF
- ClassMaker::extend EditSelDialog NewExternalFileEditSelDialog uiObj
- NewExternalFileEditSelDialog new $box \
- -title "New External File" \
- -message "External File:" \
- -entrySet $entrySet \
- -uiObj $this \
- -okPressed {
- set file [%this text]
- set selection [splitFileName $file]
- set name [lindex $selection 0]
- set type [lindex $selection 1]
- case "$type" in {
- {opendefs openlocs propdefs proplocs} {
- wmtkerror "External file of type $type not supported"
- %this delete
- return
- }
- }
- set script "global UCustFUiObj:custF"
- append script " ;"
- append script " set UCustFUiObj:custF \[CustFileUtilities::make \
- \"\" [list $name] [list $type] \
- \]"
- require "custfileut.tcl"
- .main startCommand tcl \
- "$script" "" \
- "Creating external file '$file'" \
- {1 0} 1
- %this delete
- } \
- -editPressed {
- if [info exists UCustFUiObj:custF] {
- if [file isfile ${UCustFUiObj:custF}] {
- regsub -all " |\\." "[$this text]" "_" fileId
- [$this uiObj].ExternalFile:$fileId editFile
- }
- unset UCustFUiObj:custF
- }
- }
- $box popUp
- }
-
- proc UCustFUiObj::associations {} {
- set associations {externalFiles}
-
- # Only show module files when it is visible within the view spec
- if [catch {
- set viewSpec [[.main viewHdlr] getViewSpec \
- "${UCustFUiObj::uiClass}" "" "[[.main infoView] currentViewName]"]
- }] {
- resetErrorVars
- lappend associations moduleFiles
- } elseif {[isCommand $viewSpec] &&
- [lsearch -exact "[$viewSpec associations]" moduleFiles] != -1} {
- lappend associations moduleFiles
- }
-
- return $associations
- }
-
- proc UCustFUiObj::childTypes {assoc} {
- if {[lsearch -exact "[UCustFUiObj::associations]" "$assoc"] == -1} {
- return ""
- }
- set childTypes [BrowserProcs::childTypes $assoc]
- case "$childTypes" in {
- {ModuleFile} {
- return ExternalDirectory
- }
- {default} {
- return "$childTypes"
- }
- }
- }
-
- proc UCustFUiObj::externalEtcFileNames {} {
- set externalEtcFileNames {
- cad.mnu cad.pnl ccd.mnu ccd.pnl checkconfig.checkconfig class.mnu \
- cod.mnu cod.pnl copyspecs.copyspecs desk.mnu desk.vie \
- dfd.mnu dfd.pnl diagram.mnu etd.mnu etd.pnl mgd.mnu mgd.pnl
- objtype.objtype roundtrip.roundtrip std.mnu std.pnl ucd.mnu ucd.pnl
- }
- if [[[.main currentObj] browsUiObj] isA UCustFUiObj] {
- lappend externalEtcFileNames modules.modules
- lappend externalEtcFileNames [path_name file [m4_var meta4UserEnv]]
- } else {
- lappend externalEtcFileNames "m4env.m4env"
- }
-
- return $externalEtcFileNames
- }
-
- proc UCustFUiObj::externalFileNames {} {
- set currentObj [[.main currentObj] browsUiObj]
- if {"$currentObj" == ""} {
- return ""
- }
- if [$currentObj isA UCustFUiObj] {
- return [concat \
- [UCustFUiObj::externalEtcFileNames] \
- [UCustFUiObj::externalTclFileNames] \
- ]
- }
- for {set parent $currentObj} \
- {"$parent" != ""} \
- {set parent [$parent parent]} {
- if {! [$parent isA ExtFUiObj]} break
- if {"[$parent getInfo Type]" != "ExternalDirectory"} continue
- if {"[$parent getInfo Name]" == "tcl"} {
- return [UCustFUiObj::externalTclFileNames]
- }
- if {"[$parent getInfo Name]" == "etc"} {
- return [UCustFUiObj::externalEtcFileNames]
- }
- }
- return ""
- }
-
- method UCustFUiObj::externalFiles {this} {
- set triples ""
-
- set icaseDir [location [M4Login::getHomeDir] "icase"]
-
- if {[BasicFS::makeDirAll $icaseDir] == 0} {
- set icasePattern [path_name concat $icaseDir \
- [$this pattern]]
- if {! [catch {set files [otglob $icasePattern]}]} {
- foreach pathFile $files {
- if {! [file isfile $pathFile]} continue
- set file [file tail $pathFile]
- lappend triples [list $file $icaseDir 0]
- }
- }
- }
-
- set meta4UserEnv [m4_var meta4UserEnv]
- if [file exists "$meta4UserEnv"] {
- set directory [path_name directory $meta4UserEnv]
- set file [path_name file $meta4UserEnv]
- lappend triples [list $file $directory 0]
- }
-
- return [$this files $triples]
- }
-
- proc UCustFUiObj::externalTclFileNames {} {
- if [[[.main currentObj] browsUiObj] isA UCustFUiObj] {
- return {u_clbrowse.tcl u_desk.tcl u_docbatch.tcl u_uce.tcl u_ude.tcl}
- }
- return {
- clbrowse.tcl d_desk.tcl docbatch.tcl mtool.tcl s_desk.tcl uce.tcl
- ude.tcl
- }
- }
-
- method UCustFUiObj::files {this triples} {
- set externalFiles ""
- foreach triple $triples {
- set file [lindex $triple 0]
- set directory [lindex $triple 1]
- set inModule [lindex $triple 2]
- regsub -all " |\\." "$file" "_" fileId
- set externalFile $this.${ExtFUiObj::uiClass}:$fileId
- if {! [isCommand $externalFile]} {
- ExtFUiObj new $externalFile \
- -parent $this \
- -uiName "$file" \
- -directory $directory \
- -isDirectory $inModule \
- -inModule $inModule
- }
- lappend externalFiles $externalFile
- }
- return "$externalFiles"
- }
-
- proc UCustFUiObj::infoProperties {} {
- return [BrowserProcs::infoProperties]
- }
-
- method UCustFUiObj::moduleFiles {this} {
- set triples ""
- if {[.main customLevelVersion] == ""} {
- foreach module [[.main moduleHdlr] moduleSpecSet] {
- set path [$module path]
- set directory [path_name directory $path]
- set file [path_name file $path]
- lappend triples [list $file $directory 1]
- }
- }
- return [$this files [lsort $triples]]
- }
-
- method UCustFUiObj::printObjects {this} {
- set asciiFiles ""
- foreach obj [.main selectedObjSet] {
- lappend asciiFiles [path_name concat [$obj directory] [$obj uiName]]
- }
- BrowserProcs::printObjects $asciiFiles ""
- }
-
- method UCustFUiObj::removeObjects {this} {
- set box .main.removeWarning
- YesNoWarningDialog new $box \
- -title "Confirm Object Delete" \
- -message [BrowserProcs::removeMessage] \
- -noPressed {%this delete} \
- -yesPressed {
- set script ""
- foreach obj [.main selectedObjSet] {
- if {"$script" != ""} {
- append script " ;"
- }
- append script [list BasicFS::removeFile \
- [path_name concat [$obj directory] [$obj uiName]]]
- }
- .main startCommand tcl "$script" "" "" {1 0} 1
- %this delete
- }
- $box delCancelButton
- $box popUp
- }
-
- # Do not delete this line -- regeneration end marker
-
-