home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)newextfvdi.tcl /main/titanic/7
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)newextfvdi.tcl /main/titanic/7 26 Nov 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
-
- require wmt_util.tcl
-
- # End user added include file section
-
-
- Class NewExtFVDialog : {TemplateDialog} {
- constructor
- method destructor
- method checkcreateExtFile
- method createExtFile
- method createInterface
- method typeSelectionChanged
- method nameTextModified
- method createAndEdit
- method popUp
- attribute ExtFileVList
- }
-
- constructor NewExtFVDialog {class this name} {
- set this [TemplateDialog::constructor $class $this $name]
- # Start constructor user section
- $this createInterface
- # End constructor user section
- return $this
- }
-
- method NewExtFVDialog::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method NewExtFVDialog::checkcreateExtFile {this} {
-
- busy {
- set type [$this.DC.ExtFVtypeTL selectedSet]
- set name [$this.DC.ExtFVnameSLT text]
-
- # of type makefile, library/executable
- # only one instance per system is allowed
- set msgPartA "already exists, only one"
- set msgPartB "per system is allowed."
- case $type in {
- {makefile executable library} {
- set sysV [[ClientContext::global] currentSystem]
- foreach fv [$sysV localFileVersions] {
- if {[[$fv file] type] == $type} {
- wmtkinfo [cap "$type $msgPartA $type $msgPartB"]
- return ""
- }
- }
-
- if {$type == "executable" || $type == "library"} {
- set tmpType executable
- if {$type == "executable"} {
- set tmpType library
- }
- foreach fv [$sysV localFileVersions] {
- if {[[$fv file] type] == $tmpType} {
- wmtkinfo [cap "$tmpType $msgPartA executable/library $msgPartB"]
- return ""
- }
- }
- }
- if {$type == "makefile"} {
- return [$this createExtFile $type $type]
- }
- }
- }
- }
- return [$this createExtFile $name $type]
- }
-
- method NewExtFVDialog::createExtFile {this name type} {
-
- set objSpec [getObjectSpec [.main objectHdlr] ExternalFileVersion $type]
- if {"$objSpec" == ""} return ""
-
- wmtkmessage "Creating '$type' External File Version '$name'..."
- busy {
- set sysV [[ClientContext::global] currentSystem]
- set configV [[ClientContext::global] currentConfig]
- if {[$objSpec isAscii]} {
- set fileV [$sysV createFileVersion \
- $name cl 0 $type externalText $configV]
- } else {
- set fileV [$sysV createFileVersion \
- $name cl 0 $type externalBinary $configV]
- }
- set fsExt [$objSpec fsExtension]
- if {$fsExt == ""} {
- $fileV setProperty fileSystemPath $name
- } else {
- $fileV setProperty fileSystemPath $name.$fsExt
- }
- if {"$type" != "library"} {
- $fileV synchWithFileSystem
- }
- .main updateView
- }
- wmtkmessage ""
- return $fileV
- }
-
- method NewExtFVDialog::createInterface {this} {
-
- interface DlgColumn $this.DC {
- allowResize 1
- Label L {
- text "Type:"
- }
- TextList ExtFVtypeTL {
- entrySet {}
- rowCount 10
- }
- Label L {
- text "Name:"
- }
- SingleLineText ExtFVnameSLT {
- }
- }
- PushButton new $this.edit \
- -label Edit \
- -sensitive 0 \
- -activated "$this createAndEdit ; $this popDown"
-
- $this config \
- -modal yes \
- -title "New External File Version" \
- -okPressed "$this checkcreateExtFile" \
- -helpPressed ".main helpOnName [nt_get_type $this]"
-
- $this okSensitive 0
- $this okDefault 0
- $this cancelDefault 1
-
- $this.DC.ExtFVtypeTL selectionChanged "$this typeSelectionChanged"
- $this.DC.ExtFVnameSLT textModified "$this nameTextModified"
- }
-
- method NewExtFVDialog::typeSelectionChanged {this} {
- # for some entries there is no name possible
- case [$this.DC.ExtFVtypeTL selectedSet] in {
- {makefile} {
- $this.DC.ExtFVnameSLT text ""
- $this.DC.ExtFVnameSLT editable 0
- $this okSensitive 1
- $this okDefault 1
- $this.edit sensitive 1
- } {default} {
- $this.DC.ExtFVnameSLT editable 1
- $this nameTextModified
- }
- }
- }
-
- method NewExtFVDialog::nameTextModified {this} {
-
- if {[llength [$this.DC.ExtFVtypeTL selectedSet]] > 0 &&
- "[rmWhiteSpace [$this.DC.ExtFVnameSLT text]]" != ""} {
- $this okSensitive 1
- $this okDefault 1
- $this.edit sensitive 1
- } else {
- $this okSensitive 0
- $this cancelDefault 1
- $this.edit sensitive 0
- }
- }
-
- method NewExtFVDialog::createAndEdit {this} {
-
- set obj [$this checkcreateExtFile]
-
- if {$obj == ""} {
- return
- } else {
- $obj editFile
- }
- }
-
- method NewExtFVDialog::popUp {this} {
-
- # fill the type entry set with all the possible externalfileversion
- # skip 'section' type
- set types {}
- foreach objectSpec [[.main objectHdlr] currentObjectSpecSet] {
- if {[$objectSpec repositoryType] == "ExternalFileVersion"} {
- set browserType [$objectSpec browserType]
- if {"$browserType" != ""} {
- lappend types "$browserType"
- }
- }
- }
- set entrySet [lsort $types]
- if {$entrySet != [$this.DC.ExtFVtypeTL entrySet]} {
- $this.DC.ExtFVtypeTL entrySet $entrySet
- }
-
- $this TemplateDialog::popUp
- }
-
- # Do not delete this line -- regeneration end marker
-
-