home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
msumlpacka.tcl
< prev
next >
Wrap
Text File
|
1997-08-29
|
4KB
|
153 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)msumlpacka.tcl /main/titanic/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)msumlpacka.tcl /main/titanic/2 29 Aug 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
#require "msumleleme.tcl"
Class MSUMLPackage : {MSUMLElement} {
constructor
method destructor
method ms2ot
method promoter
method model
method elementSet
method addElement
method removeElement
attribute _model
attribute smModel
attribute _elementSet
}
constructor MSUMLPackage {class this typeName smModel} {
set this [MSUMLElement::constructor $class $this $typeName]
$this smModel $smModel
$this _elementSet [List new]
# Start constructor user section
[$this elementSet] foreach element {
$element delete
}
# End constructor user section
return $this
}
method MSUMLPackage::destructor {this} {
set ref [$this _model]
if {$ref != ""} {
[$ref _packageSet] removeValue $this
}
foreach ref [[$this _elementSet] contents] {
$ref _package ""
}
# Start destructor user section
# End destructor user section
$this MSUMLElement::destructor
}
method MSUMLPackage::ms2ot {this {rtDiag ""} {phaseName ""} {confName ""} {confV ""}} {
set cc [ClientContext::global]
set proj [$cc currentProject]
set cv [$cc currentConfig]
set pv [$cc currentPhase]
set sv [$cc currentSystem]
if ![$sv isNil] {
$cc upLevel
}
set con [$cv config]
set myName [$this name]
puts "Package '$myName'"
set sv [$pv findSystemVersion $myName system]
if [$sv isNil] {
if [isCommand OTShRegister::repository] {
puts "Error: system '$myName' not available for merging"
return
}
$pv createSystemVersion $myName cl system $cv
}
$cc downLevel $myName.system
if [isCommand OTShRegister::repository] {
require roundtrip.tcl
#set $myName [RTDiagram new $myName $myName $phaseName $phaseName [$con name] [$cv versionNumber] [$proj name]]
set $myName [RTDiagram new $myName $myName $phaseName $phaseName ]
} else {
set $myName [REDiagram new $myName $myName $phaseName $phaseName ]
}
global diag
set rtDiag [set $myName]
set diag $rtDiag
[$this elementSet] foreach uElement {
set uType [$uElement objectType]
if {$uType == "UMLPackage"} {
$uElement ms2ot $rtDiag $phaseName
} else {
$uElement ms2ot $rtDiag
}
}
set tmpSaveFileName [args_file {}]
$rtDiag save $tmpSaveFileName
set resultFileName [lindex $argv 0]
if [file exists $resultFileName] {
set resultFile [open $resultFileName a]
} else {
set resultFile [open $resultFileName w]
}
set tmpFile [open $tmpSaveFileName r]
set tmpFileResult [read $tmpFile]
puts $resultFile $tmpFileResult
close $tmpFile
close $resultFile
unlink $tmpSaveFileName
}
method MSUMLPackage::promoter {this} {
$this MSUMLElement::promoter
$this _elementSet [List new]
set noOfElements [$this getNoOfElements]
for {set i 1} {$i <= $noOfElements} {incr i} {
set umlElement [$this getElementAsUML $i]
MS[$umlElement property objectType] promote $umlElement
$this addElement $umlElement
}
}
# Do not delete this line -- regeneration end marker
method MSUMLPackage::model {this args} {
if {$args == ""} {
return [$this _model]
}
set ref [$this _model]
if {$ref != ""} {
[$ref _packageSet] removeValue $this
}
set obj [lindex $args 0]
if {$obj != ""} {
[$obj _packageSet] append $this
}
$this _model $obj
}
method MSUMLPackage::elementSet {this} {
return [$this _elementSet]
}
method MSUMLPackage::addElement {this newElement} {
[$this _elementSet] append $newElement
$newElement _package $this
}
method MSUMLPackage::removeElement {this oldElement} {
$oldElement _package ""
[$this _elementSet] removeValue $oldElement
}