home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
qualopenby.tcl
< prev
next >
Wrap
Text File
|
1996-09-17
|
3KB
|
122 lines
#---------------------------------------------------------------------------
#
# (c) Westmount Technology 1994
#
# File: @(#)qualopenby.tcl /main/hindenburg/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)qualopenby.tcl /main/hindenburg/2 17 Sep 1996 Copyright 1994 Westmount Technology
# Start user added include file section
# End user added include file section
Class QualOpenByName : {TemplateDialog} {
constructor
method destructor
method handleSelectionChanged
method popUp
method handleOk
attribute filevList
attribute fileNameList
attribute editor
}
constructor QualOpenByName {class this name editor} {
set this [TemplateDialog::constructor $class $this $name]
$this editor $editor
# Start constructor user section
interface DlgColumn $this.c {
Label l1 {
text "Diagrams:"
}
TextList list {
rowCount 10
}
Label l2 {
text "Class Name:"
}
SingleLineText className {}
Label l3 {
text "Diagram Name:"
}
SingleLineText diagName {}
}
$this config -okPressed {%this handleOk} -title "Open By Name"
$this.c.list config \
-selectionChanged "$this handleSelectionChanged" \
-activated "$this popDown; $this handleOk"
# End constructor user section
return $this
}
method QualOpenByName::destructor {this} {
# Start destructor user section
# End destructor user section
}
method QualOpenByName::handleSelectionChanged {this} {
set qualDiag [split [$this.c.list selectedSet] :]
$this.c.className text [lindex $qualDiag 0]
$this.c.diagName text [lindex $qualDiag 1]
}
method QualOpenByName::popUp {this} {
set ed [$this editor]
set sysV [$ed systemVersion]
set type [$ed diagramType]
set fileVersions [$sysV localFileVersions]
set myTypeFileList ""
set myTypeNameList ""
foreach fv $fileVersions {
if {[[$fv file] type] == "$type"} {
lappend myTypeFileList $fv
lappend myTypeNameList [[$fv file] qualifiedName :]
}
}
$this filevList $myTypeFileList
$this fileNameList $myTypeNameList
$this.c.list entrySet [lsort $myTypeNameList]
$this TemplateDialog::popUp
}
method QualOpenByName::handleOk {this} {
set className [rmWhiteSpace [$this.c.className text]]
set diagName [rmWhiteSpace [$this.c.diagName text]]
if {$className == "" || $diagName == ""} {
wmtkerror "Both class name and diagram name must be specified"
return
}
set selected $className:$diagName
set index [lsearch -exact [$this fileNameList] $selected]
if {$index == -1} {
busy {
set ed [$this editor]
wmtkmessage "Creating '$selected.$type'"
set sysV [$ed systemVersion]
set configV [$ed configVersion]
set type [$ed diagramType]
set scopePhase [fileHasScopePhase $type]
set itemType [file2itemtype $type]
if {$scopePhase} {
set scope scopePhaseDef
} else {
set scope scopeSystem
}
set qualItem [[$sysV findDeclareItem -byName \
$className cl $scope] item]
set diagItem \
[$qualItem findCreateItem $diagName $itemType]
set newFile [$sysV createFileVersion $diagItem \
$scopePhase $type graph $configV]
$ed doEdit $newFile
}
} else {
[$this editor] doEdit [lindex [$this filevList] $index]
}
}
# Do not delete this line -- regeneration end marker