home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
qualopenby.tcl
< prev
next >
Wrap
Text File
|
1997-09-11
|
3KB
|
124 lines
#---------------------------------------------------------------------------
#
# (c) Westmount Technology 1994
#
# File: @(#)qualopenby.tcl /main/titanic/4
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)qualopenby.tcl /main/titanic/4 11 Sep 1997 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 "Classifier:"
}
SingleLineText className {}
Label l3 {
text "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 cc [ClientContext::global]
set sysV [$cc currentSystem]
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 cc [ClientContext::global]
set ed [$this editor]
set selected $className:$diagName
set index [lsearch -exact [$this fileNameList] $selected]
if {$index == -1} {
busy {
wmtkmessage "Creating '$selected.$type'"
set sysV [$cc currentSystem]
set configV [$cc currentConfig]
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]
}
} else {
set newFile [lindex [$this filevList] $index]
}
$ed doEdit [$cc createPath $newFile]
}
# Do not delete this line -- regeneration end marker