home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
scopechang.tcl
< prev
next >
Wrap
Text File
|
1996-12-02
|
7KB
|
219 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1996
#
# File: @(#)scopechang.tcl /main/hindenburg/1
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)scopechang.tcl /main/hindenburg/1 2 Dec 1996 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
require procs.tcl
# End user added include file section
Class ScopeChangeDialog : {TemplateDialog} {
constructor
method destructor
method scopeFile_scopeSystem
method scopeFile_scopePhase
method scopeSystem_scopeFile
method scopeSystem_scopePhase
method scopePhase_scopeFile
method scopePhase_scopeSystem
method popUp
method handleOk
method addAction
method removeAction
method addOption
method removeOption
attribute configV
attribute systemV
attribute diagram
attribute workItem
attribute item
attribute allowedScopes
attribute editor
attribute actionSet
attribute optionSet
}
constructor ScopeChangeDialog {class this name} {
set this [TemplateDialog::constructor $class $this $name]
$this actionSet [List new]
$this optionSet [List new]
# Start constructor user section
interface DlgColumn $this.c {
Label message {
text "Select Scope"
}
VerRadioGroup group {}
}
$this config -okPressed "$this handleOk; $this delete" \
-helpPressed {.main helpOnName editScope} \
-cancelPressed "$this delete" \
-title "Edit Scope" \
-modal 1
# End constructor user section
return $this
}
method ScopeChangeDialog::destructor {this} {
# Start destructor user section
# End destructor user section
}
method ScopeChangeDialog::scopeFile_scopeSystem {this} {
if {[[$this workItem] status] == "reused"} {
return
}
set existing \
[[$this systemV] findDeclaration [$this item] [$this configV]]
if [$existing isNil] {
$this addOption "Refer to (not yet existing) definition on System level"
$this addOption "Export definition to System level"
} elseif {[$existing scope] != "scopeSystem"} {
# Item exists with some scope phase variant. It is strange to
# lower the scope of that item via a scope change on a scope
# file item. A consistent set of allowed scopes will also
# provide the possibility to go to scope phase in this
# situation, so there is no need to do anything special here.
return
} else {
$this addOption "Refer to definition on System level"
$this addOption "Overwrite definition on System level"
}
$this addAction "[$this diagram] refer [$this item] 1"
$this addAction "[$this diagram] export [$this item] 1"
}
method ScopeChangeDialog::scopeFile_scopePhase {this} {
if {[[$this workItem] status] == "reused"} {
return
}
set existing \
[[$this systemV] findDeclaration [$this item] [$this configV]]
if [$existing isNil] {
$this addOption "Refer to (not yet existing) definition on Phase level"
$this addOption "Export definition to Phase level"
} elseif {[$existing scope] == "scopeSystem"} {
# In order to implement this we need two scope changes:
# one of the item we are changing and one of the existing item.
# To prevent surprises we let the user take care of this.
return
} else {
$this addOption "Refer to definition on Phase level"
$this addOption "Overwrite definition on Phase level"
}
$this addAction "[$this diagram] refer [$this item] 0"
$this addAction "[$this diagram] export [$this item] 0"
}
method ScopeChangeDialog::scopeSystem_scopeFile {this} {
if {[[$this diagram] status] != "working"} {
return
}
$this addOption "Create empty definition on File level"
$this addAction "[$this diagram] declareItem [$this item] scopeFile"
$this addOption "Copy definition to File level"
$this addAction "[$this diagram] import [$this item]"
}
method ScopeChangeDialog::scopeSystem_scopePhase {this} {
if {[[$this workItem] status] == "reused"} {
return
}
$this addOption "Refer to definition on Phase level"
$this addAction "[$this systemV] refer [$this item] 0"
$this addOption "Make definition available on Phase level"
$this addAction "[$this systemV] export [$this item] 0"
}
method ScopeChangeDialog::scopePhase_scopeFile {this} {
$this scopeSystem_scopeFile
}
method ScopeChangeDialog::scopePhase_scopeSystem {this} {
if {[[$this workItem] status] == "reused"} {
return
}
if {[[$this workItem] scope] != "scopePhaseDef"} {
$this addOption "Create empty definition on System level"
$this addAction \
"[$this systemV] declareItem [$this item] scopeSystem"
$this addOption "Copy definition to System level"
} else {
$this addOption "Restrict definition to System level"
}
$this addAction "[$this systemV] import [$this item]"
}
method ScopeChangeDialog::popUp {this} {
set itemRef [lindex [[$this editor] selectedItem] 0]
set workItem [$itemRef workItem [$this configV]]
if [$workItem isNil] {
wmtkerror "There is no work item for item '[$itemRef itemName]'\nScope Change is not possible."
$this delete
return
}
$this workItem $workItem
$this item [$workItem item]
set scope [$workItem scope]
if {$scope == "scopePhaseRef" || $scope == "scopePhaseDef"} {
set scope scopePhase
}
$this allowedScopes [$itemRef allowedScopes]
if {[$this allowedScopes] == ""} {
$this allowedScopes $scope
}
set selected ""
foreach newScope [$this allowedScopes] {
if {$newScope == $scope} {
set selected \
"Current scope is [string range $scope 5 end]"
$this addOption $selected
$this addAction ""
} else {
$this ${scope}_${newScope}
}
}
$this.c.group entrySet [[$this optionSet] contents]
$this.c.group selected $selected
$this TemplateDialog::popUp
}
method ScopeChangeDialog::handleOk {this} {
set option [$this.c.group selected]
set index [lsearch -exact [[$this optionSet] contents] $option]
set action [[$this actionSet] index $index]
if [catch {eval $action} msg] {
wmtkerror $msg
}
}
# Do not delete this line -- regeneration end marker
method ScopeChangeDialog::addAction {this newAction} {
[$this actionSet] append $newAction
}
method ScopeChangeDialog::removeAction {this oldAction} {
[$this actionSet] removeValue $oldAction
}
method ScopeChangeDialog::addOption {this newOption} {
[$this optionSet] append $newOption
}
method ScopeChangeDialog::removeOption {this oldOption} {
[$this optionSet] removeValue $oldOption
}