home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)ccfileuiob.tcl /main/titanic/7
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)ccfileuiob.tcl /main/titanic/7 16 Jun 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require_module_file "ccfile.tcl" clearcase
- require_module_file "vsfileobj.tcl" vcm
-
- # This class represents a ClearCase file in the browser.
-
- Class CCFileUiObj : {CCFile VSFileObj} {
- constructor
- method destructor
- method initializeInfo
- method showDiff
- method getInfo
- method path
- method previousVersion
- method promoter
- method otherVersions
- }
-
- constructor CCFileUiObj {class this name type system i_name} {
- set this [CCFile::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 CCFileUiObj::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this CCFile::destructor
- $this VSFileObj::destructor
- }
-
-
- # Reuse associations of VSFile.
- #
- proc CCFileUiObj::associations {} {
- return "[VSFileObj::associations]"
- }
-
-
- # Reuse child types of VSFileObj
- #
- proc CCFileUiObj::childTypes {assoc} {
- return "[VSFileObj::childTypes $assoc]"
- }
-
-
- # Reuse controlledLists of VSFileObj.
- #
- proc CCFileUiObj::controlledLists {} {
- return "[VSFileObj::controlledLists]"
- }
-
-
- # Return the ClearCase properties:
- # Status, Version, Rule, Comments, Path, Labels, Attributes, Hyperlinks.
- #
- proc CCFileUiObj::infoProperties {} {
- return [concat \
- [VSFileObj::infoProperties] \
- {Version Status Rule "Created By" Created Comments \
- "ClearCase Type" Path Labels Attributes Hyperlinks} \
- ]
- }
-
-
- # Initialize the properties: get from the FileInfoDict of this
- # system and postpone other properties.
- # Postponed: Comments, Labels, Attributes, Hyperlinks.
- #
- method CCFileUiObj::initializeInfo {this dummy} {
- $this VSFileObj::initializeInfo $dummy
- $this setInfo Text "ClearCase File [file tail [$this path]]"
- $this setInfo Path [$this vsPath]
- set infoList [[[$this systemVersion] ccFileInfoDict] set [$this path]]
- if { ![lempty $infoList] } {
- $this setInfo Version [lindex $infoList 0]
- $this setInfo Status [lindex $infoList 1]
- $this setInfo Rule [lindex $infoList 2]
- } else {
- # not found: indicate in status and clear others
- $this setInfo Version ""
- $this setInfo Status "<not found>"
- $this setInfo Rule ""
- }
- }
-
-
- # Show diffs with version, options indicate whether it must
- # be graphical or not.
- #
- method CCFileUiObj::showDiff {this version {options ""}} {
- set graphical 0
- if { "$options" == "graphical" } {
- set graphical 1
- }
-
- set diffCommand [CCCommand::diff [$this path] $version $graphical]
- if $graphical {
- set tool external
- } else {
- set tool mtool
- }
- vsCommandHandler executeExternal $diffCommand $tool
- }
-
-
- # If header is indicates a 'slow' info object, initialize all remaining info
- # if initializedAllInfo was not yet set.
- # Returns the requested info.
- #
- method CCFileUiObj::getInfo {this header} {
- if { [$this initializedAllInfo] != "1" } {
- if { [lsearch {Comments Attributes Labels Hyperlinks "Created By" \
- "ClearCase Type" "Generated From Class" Created } \
- $header] != -1 } {
- # get the description items and add them to info
- busy {
- set descrDict [Dictionary new]
- CCCommand::describe [$this path] $descrDict
- $descrDict foreach key value {
- $this setInfo $key $value
- }
- $this initializedAllInfo 1
- }
- }
- }
-
- set info [[$this info] set $header]
- if { $info != ""} {
- return $info
- }
-
- return "[$this BrowsUiObj::getInfo $header]"
- }
-
-
- # Returns result of path of CCFile.
- #
- method CCFileUiObj::path {this} {
- return [$this CCFile::path]
- }
-
- method CCFileUiObj::previousVersion {this} {
- return [CCCommand::getPredecessor [$this path]]
- }
-
- method CCFileUiObj::promoter {this} {
- $this VSFileObj::promoter
- }
-
- method CCFileUiObj::otherVersions {this} {
- set versions [CCCommand::getVersions [$this path]]
-
- # remove current version
- set currentVersion [$this getInfo Version]
- set currentVersionIndex [lsearch -exact $versions $currentVersion]
- if { $currentVersionIndex == -1 } {
- return $versions
- }
- return [concat [lrange $versions 0 [expr $currentVersionIndex-1]] \
- [lrange $versions [expr $currentVersionIndex+1] end]]
- }
-
- # Do not delete this line -- regeneration end marker
-
-