home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)razorfileu.tcl /main/hindenburg/5
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)razorfileu.tcl /main/hindenburg/5 30 May 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require_module_file "razorfile.tcl" razor
- require_module_file "vsfileobj.tcl" vcm
-
- Class RazorFileUiObj : {RazorFile VSFileObj} {
- constructor
- method destructor
- method initializeInfo
- method showDiff
- method path
- method previousVersion
- method promoter
- method otherVersions
- }
-
- constructor RazorFileUiObj {class this name type system i_name} {
- set this [RazorFile::constructor $class $this $name $type $system]
- set this [VSFileObj::constructor $class $this $i_name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RazorFileUiObj::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RazorFile::destructor
- $this VSFileObj::destructor
- }
-
-
- # Reuse assocations of VSFileObj
- #
- proc RazorFileUiObj::associations {} {
- return "[VSFileObj::associations]"
- }
-
-
- # Reuse child types of VSFileObj.
- #
- proc RazorFileUiObj::childTypes {assoc} {
- return "[VSFileObj::childTypes $assoc]"
- }
-
-
- # Reuse controlledLists of VSFileObj.
- #
- proc RazorFileUiObj::controlledLists {} {
- return "[VSFileObj::controlledLists]"
- }
-
-
- # Return properties of Razor File, apart from
- # standard properties these are:
- # Status, Version, Title, Description, Issues, Path, Platform, Branch.
- #
- proc RazorFileUiObj::infoProperties {} {
- return [concat \
- [VSFileObj::infoProperties] \
- {Version Status Owner "Last Modification" "Checked In" \
- Path Title Description Issues "Razor Type" Platform State Branch} \
- ]
- }
-
-
- # Initialize all info.
- #
- method RazorFileUiObj::initializeInfo {this dummy} {
- $this VSFileObj::initializeInfo $dummy
- $this setInfo Text "Razor File [file tail [$this path]]"
- $this setInfo Path [$this vsPath]
- set infoDict [Dictionary new]
- RazorCommand::getProperties [$this vsPath] $infoDict
-
- # check if there is a result, if so copy properties
- if { [$infoDict set Version] != "" } {
- $infoDict foreach key value {
- $this setInfo $key $value
- }
- } else {
- # clear properties and indicate not found status
- $this setInfo Version ""
- $this setInfo "Last Modification" ""
- $this setInfo "Checked In" ""
- $this setInfo Status "<not found>"
- $this setInfo Owner ""
- $this setInfo State ""
- $this setInfo "Razor Type" ""
- $this setInfo Platform ""
- $this setInfo Title ""
- $this setInfo Issues ""
- $this setInfo Description ""
- }
-
- $this setInfo Branch [$this branchName]
- }
-
-
- # Show diff with version using a standard diff in a
- # monitoring window. (Unix only).
- #
- method RazorFileUiObj::showDiff {this version {options ""}} {
- set latestVersion [$this getReference]
- set otherVersion [$this getReference $version]
-
- # check we actually got the references
- if { ($latestVersion == "" ) || ($otherVersion == "") } {
- return
- }
-
- set diffCommand [VSCommand new "diff $latestVersion $otherVersion" "Diff"]
- set endCommand "$this deleteReference $latestVersion"
- set endCommand "$endCommand; $this deleteReference $otherVersion"
-
- vsCommandHandler executeExternal $diffCommand mtool $endCommand
- }
-
-
- # Returns result of path of RazorFile.
- #
- method RazorFileUiObj::path {this} {
- return [$this RazorFile::path]
- }
-
- method RazorFileUiObj::previousVersion {this} {
- set owner [RazorCommand::getOwner [$this infoPath]]
- if { "$owner" == "[M4Login::getUserName]" } {
- return [$this getInfo Version]
- }
-
- return [RazorCommand::getPredecessor [$this historyPath]]
- }
-
- method RazorFileUiObj::promoter {this} {
- $this RazorFile::promoter
- $this VSFileObj::promoter
- }
-
- method RazorFileUiObj::otherVersions {this} {
- set versions [RazorCommand::getVersions [$this historyPath]]
-
- # remove latest version unless the current user has checked it out.
- set owner [RazorCommand::getOwner [$this infoPath]]
- if { "$owner" == "[M4Login::getUserName]" } {
- return $versions
- }
-
- set currentVersion [$this getInfo Version]
- set currentVersionIndex [lsearch -exact $versions $currentVersion]
- if { $currentVersionIndex == -1 } {
- return $versions
- }
- return [join [lreplace $versions $currentVersionIndex $currentVersionIndex ""]]
- }
-
- # Do not delete this line -- regeneration end marker
-
-