home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
installman.tcl
< prev
next >
Wrap
Text File
|
1997-03-21
|
5KB
|
182 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)installman.tcl /main/hindenburg/4
# Author: <generated>
# Description: VCM integration file
#---------------------------------------------------------------------------
# SccsId = @(#)installman.tcl /main/hindenburg/4 21 Mar 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
# Generic install manager that provides functionality
# to install and uninstall customization files. It also
# provides a main window with a message area.
Class InstallManager : {GCObject} {
constructor
method destructor
method gotoLevel
method validFiles
method showMessage
method installCustomFiles
method unInstallCustomFiles
method customFileSet
method addCustomFile
method removeCustomFile
attribute installWindow
attribute messageArea
attribute _customFileSet
}
constructor InstallManager {class this} {
set this [GCObject::constructor $class $this]
$this _customFileSet [List new]
# Start constructor user section
$this installWindow [MainWindow new .main -closed { exit }]
$this messageArea [MessageArea new .main.messageArea]
interface DlgRow .main.row {
sizeEqual 1
index 0
DlgColumn col {
spaceType EVEN
Image image {
pixmap wmt
}
}
}
# End constructor user section
return $this
}
method InstallManager::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Go to the specified level. Level is
# specified with names only.
#
method InstallManager::gotoLevel {this level} {
#level: project_name/config_name/phase_name/system_name
set cc [ClientContext::global]
while { [$cc currentLevel] != "Corporate" } {
$cc upLevel
}
set levelComponents [split $level "/"]
set project [lindex $levelComponents 0]
$cc downLevel $project
if { [llength $levelComponents] == 1 } {
return
}
# find working config version with specified name
set configName [lindex $levelComponents 1]
foreach configVersion [[$cc currentProject] configVersions] {
if { ([$configVersion status] == "working") && \
([[$configVersion config] name] == $configName) } {
set version [$configVersion versionNumber]
$cc downLevel "$configName:$version"
break
}
}
if { [llength $levelComponents] == 2 } {
return
}
# goto phase name, assume name = type
set phaseName [lindex $levelComponents 2]
$cc downLevel "$phaseName.$phaseName"
if { [llength $levelComponents] == 2 } {
return
}
# goto system. If type 'system' fails, try 'document'
set systemName [lindex $levelComponents 3]
if [catch { $cc downLevel "$systemName.system" }] {
$cc downLevel "$systemName.document"
}
}
# Return subset of the customFile association:
# files that are valid for the specified level.
#
method InstallManager::validFiles {this level} {
set currentLevel [[ClientContext::global] currentLevel]
set fileList {}
[$this customFileSet] foreach customFile {
set validLevels [$customFile level]
if { $validLevels != "" } {
if { ![regexp $currentLevel $validLevels] } {
continue
}
}
lappend fileList $customFile
}
return $fileList
}
# Show the given message in the message area. Invoked for each install
# or uninstall action on a file.
#
method InstallManager::showMessage {this message} {
[$this messageArea] message $message
}
# Installs the files in the customFileList at the given
# level, discarding any files that are not
# appropriate for this level.
#
method InstallManager::installCustomFiles {this level} {
$this gotoLevel $level
foreach customFile [$this validFiles $level] {
$this showMessage "Installing [$customFile name] [$customFile type]\
at level $level..."
$customFile install
}
}
# Uninstalls the files in customFile list from the
# given level.
#
method InstallManager::unInstallCustomFiles {this level} {
$this gotoLevel $level
foreach customFile [$this validFiles $level] {
$this showMessage "Uninstalling [$customFile name] [$customFile type]\
at level $level..."
$customFile unInstall
}
}
# Do not delete this line -- regeneration end marker
method InstallManager::customFileSet {this} {
return [$this _customFileSet]
}
method InstallManager::addCustomFile {this newCustomFile} {
[$this _customFileSet] append $newCustomFile
$newCustomFile _manager $this
}
method InstallManager::removeCustomFile {this oldCustomFile} {
$oldCustomFile _manager ""
[$this _customFileSet] removeValue $oldCustomFile
}