home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)custcheckd.tcl /main/titanic/4
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)custcheckd.tcl /main/titanic/4 2 Jul 1997 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- require custcheckp.tcl
- require checkbrvie.tcl
- require config.tcl
- require custfileut.tcl
- # End user added include file section
-
-
- Class CustCheckDialog : {NoteBkDialog} {
- constructor
- method destructor
- method createInterface
- method read
- method edit
- method show
- method save
- method quit
- method getGroup
- method setGroup
- method removeGroup
- method getPhase
- method setPhase
- method removePhase
- attribute lvlObj
- attribute custObj
- attribute readOnly
- attribute number
- attribute group
- attribute phase
- }
-
- constructor CustCheckDialog {class this name} {
- set this [NoteBkDialog::constructor $class $this $name]
- $this group [Dictionary new]
- $this phase [Dictionary new]
- # Start constructor user section
- .main busy TRUE
- global classCount
- $this number $classCount
-
- # read phases file
- getPhases
-
- $this modal 1
- $this createInterface
- $this config \
- -cancelPressed { %this quit } \
- -okPressed { %this save ; %this quit} \
- -helpPressed {.main helpOnName checkConfigDialog } \
- -applyNowPressed { %this save }
- # End constructor user section
- return $this
- }
-
- method CustCheckDialog::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CustCheckDialog::createInterface {this} {
-
- set cc [ClientContext::global]
- set currentPhase ""
- if {![[$cc currentPhase] isNil]} {
- set currentPhase [[[$cc currentPhase] phase] type]
- }
- set count 0
- foreach phase ${BrowserProcs::phases} {
- set phaseType [lindex $phase 1]
- if {$currentPhase != "" && $currentPhase != $phaseType} continue
- if [[$this phase] exists "$phaseType"] continue
- set page [CustCheckPage new $this.phase$count \
- -label "$phaseType" \
- ]
- $this setPhase "$phaseType" $page
- incr count 1
- }
- }
-
- method CustCheckDialog::read {this levelObject} {
-
- $this lvlObj $levelObject
-
- if {"$levelObject" == "" || [$levelObject isA Corporate]} {
- $this custObj ""
- } else {
- $this custObj [$levelObject findCustomFileVersion checkconfig checkconfig]
- }
-
- set cc [ClientContext::global]
-
- set configList {}
- set groupList {}
- set mapList {}
-
- # read corporate
- set lvl Corporate
- if [$cc customFileExistsAt $lvl checkconfig checkconfig etc] {
- set config [args_file {}]
- $cc downLoadCustomFileAt $lvl checkconfig checkconfig etc $config
- set configList [readConfigurationFile $config]
- unlink $config
- }
- if [$cc customFileExistsAt $lvl checkgroups checkgroups etc] {
- set groups [args_file {}]
- $cc downLoadCustomFileAt $lvl checkgroups checkgroups etc $groups
- set groupList [readConfigurationFile $groups]
- unlink $groups
- }
- if [$cc customFileExistsAt $lvl checkmap checkmap etc] {
- set map [args_file {}]
- $cc downLoadCustomFileAt $lvl checkmap checkmap etc $map
- set mapList [readConfigurationFile $map]
- unlink $map
- }
-
- # read module stuff
- set modules [[.main moduleHdlr] moduleSpecSet]
- foreach mod $modules {
- set config [[.main moduleHdlr] getFiles etc checkconfig.checkconfig $mod]
- foreach file $config {
- set list [readConfigurationFile $file]
- # add level stuff in config spec
- foreach configLine $list {
- set configLvl [list "$configLine module"]
- set configList [concat $configList "$configLvl"]
- }
- }
- set groups [[.main moduleHdlr] getFiles etc checkgroups.checkgroups $mod]
- foreach file $groups {
- set list [readConfigurationFile $file]
- set groupList [concat $groupList $list]
- }
- set map [[.main moduleHdlr] getFiles etc checkmap.checkmap $mod]
- foreach file $map {
- set list [readConfigurationFile $file]
- set mapList [concat $mapList $list]
- }
- }
-
- # read level stuff
- foreach lvl {Project Config Phase System} {
- if [$cc customFileExistsAt $lvl checkconfig checkconfig etc] {
- set config [args_file {}]
- $cc downLoadCustomFileAt $lvl checkconfig checkconfig etc $config
- set list [readConfigurationFile $config]
- # add level stuff in config spec
- foreach configLine $list {
- set configLvl [list "$configLine $lvl"]
- set configList [concat $configList "$configLvl"]
- }
- unlink $config
- }
- if [$cc customFileExistsAt $lvl checkgroups checkgroups etc] {
- set groups [args_file {}]
- $cc downLoadCustomFileAt $lvl checkgroups checkgroups etc $groups
- set list [readConfigurationFile $groups]
- set groupList [concat $groupList $list]
- unlink $groups
- }
- if [$cc customFileExistsAt $lvl checkmap checkmap etc] {
- set map [args_file {}]
- $cc downLoadCustomFileAt $lvl checkmap checkmap etc $map
- set list [readConfigurationFile $map]
- set mapList [concat $mapList $list]
- unlink $map
- }
- if {$lvl == [$cc currentLevel]} {
- break
- }
- }
-
- # user files ingored.
-
- global groupArray
- foreach groupLine $groupList {
- set groupArray([lindex $groupLine 0]) [lindex $groupLine 1]
- }
-
- foreach mapLine $mapList {
- set msgNr [lindex $mapLine 1]
- set msgInfo [list $msgNr "[m4_msg get $msgNr]"]
- if {[$this getGroup [lindex $mapLine 0]] != ""} {
- set lst [$this getGroup [lindex $mapLine 0]]
- lappend lst "$msgInfo"
- } else {
- set lst [list "$msgInfo"]
- }
- $this setGroup [lindex $mapLine 0] $lst
- }
-
- foreach configLine $configList {
- set phase [lindex $configLine 0]
- set group [lindex $configLine 1]
- set checkValue [lindex $configLine 2]
- set configLevel [lindex $configLine 3]
- set page [$this getPhase $phase]
- if {$page == ""} continue
- if {$group == ""} continue
- set obj $page.DC.CBV.$group
- if {![isCommand $obj]} {
- CheckBrObject new $obj
- $obj prevCheckValues ""
- } else {
- # save previous checkvalue, and configLevel
- $obj prevCheckValues "\{[$obj checkValue] \"[$obj configLevel]\"\} [$obj prevCheckValues]"
- }
- $obj selected "$page.DC.CBV setMessages $group"
- $obj group $group
- $obj label $group
- $obj checkValue $checkValue
- $obj configLevel $configLevel
- $obj updateView
- }
-
- [$this phase] foreach key value {
- $value.DC.CBV sortit
- }
- }
-
- method CustCheckDialog::edit {this levelObject} {
-
- $this read $levelObject
- $this readOnly 0
-
- if {"[$this custObj]" != ""} {
- if [catch {[$this custObj] edit} msg] {
- wmtkerror $msg
- $this readOnly 1
- }
- }
-
- if [$this readOnly] {
- $this title "Show 'checkconfig'"
- } else {
- $this title "Edit 'checkconfig'"
- }
-
- $this popUp
- .main busy FALSE
- }
-
- method CustCheckDialog::show {this levelObject} {
-
- $this read $levelObject
- $this readOnly 1
- $this title "Show 'checkconfig'"
-
- $this popUp
- .main busy FALSE
- }
-
- method CustCheckDialog::save {this} {
-
- if [$this readOnly] {
- return
- }
-
- set tmpFile [args_file {}]
- set fid [open $tmpFile w]
-
- puts $fid "#-------------------------------------------------------------"
- puts $fid "# "
- puts $fid "# phase id : The id of the phase. Valid id's are: "
- puts $fid "# 'Analysis', 'SystemDesign', 'ObjectDesign' "
- puts $fid "# and 'Implementation' "
- puts $fid "# group name : The name of the group of checks. With this name"
- puts $fid "# you can define in the configuration file "
- puts $fid "# 'checkmap' which errors/warnings belong to this"
- puts $fid "# group. The name of the group is userdefineable."
- puts $fid "# value : Valid values are: 'off', 'default', 'error' "
- puts $fid "# and 'warning' With this field you can promote "
- puts $fid "# warnings to errors and visa versa. "
- puts $fid "# You cannot turn off fatals or normal messages! "
- puts $fid "# "
- puts $fid "# The key in this table is the phase id combined "
- puts $fid "# with the group name "
- puts $fid "#-------------------------------------------------------------"
- puts $fid "# phase id | group name | value "
- puts $fid "#-------------------------------------------------------------"
-
- set formatString "%-15.15s | %-25.25s | %-10.10s"
-
- set currentLevel [[ClientContext::global] currentLevel]
-
- [$this phase] foreach key value {
- foreach obj [$value.DC.CBV objectSet] {
- if {$currentLevel == [$obj configLevel]} {
- puts $fid "[format $formatString $key \
- [$obj label] [$obj checkValue]]"
- }
- }
- }
- close $fid
- require "custfileut.tcl"
- CustFileUtilities::save $tmpFile [$this lvlObj] checkconfig checkconfig
- unlink $tmpFile
-
- }
-
- method CustCheckDialog::quit {this} {
-
- if {"[$this custObj]" != "" && (! [$this readOnly])} {
- [$this custObj] quit
- }
-
- $this delete
- }
-
- # Do not delete this line -- regeneration end marker
-
- method CustCheckDialog::getGroup {this groupName} {
- return [[$this group] set $groupName]
- }
-
- method CustCheckDialog::setGroup {this groupName newGroup} {
- [$this group] set $groupName $newGroup
- }
-
- method CustCheckDialog::removeGroup {this groupName} {
- [$this group] unset $groupName
- }
-
- method CustCheckDialog::getPhase {this phaseType} {
- return [[$this phase] set $phaseType]
- }
-
- method CustCheckDialog::setPhase {this phaseType newPhase} {
- [$this phase] set $phaseType $newPhase
- }
-
- method CustCheckDialog::removePhase {this phaseType} {
- [$this phase] unset $phaseType
- }
-
-