home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
mergetool.tcl
< prev
next >
Wrap
Text File
|
1997-11-25
|
13KB
|
525 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)mergetool.tcl /main/titanic/28
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)mergetool.tcl /main/titanic/28 25 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require mtnavigati.tcl
require mtinformat.tcl
require mtwmtarea.tcl
require mtversiona.tcl
require mtproject.tcl
require mtcontaine.tcl
require mtconfig.tcl
require mtphase.tcl
require mtsystem.tcl
require mtfile.tcl
require mtcustfile.tcl
require mtgroup.tcl
require mtcorpgrou.tcl
require mtproprepo.tcl
require mtitemprop.tcl
require browserobj.tcl
# End user added include file section
require "wmttool.tcl"
Class MergeTool : {MainWindow WmtTool} {
method destructor
constructor
method createInterface
method initialize
method selectedObjSet
method selectedMergeObjSet
method selectionChanged
method start
method addContextArea
method updateWmtArea
method updateToolBar
method updateMenu
method setCurrentContextVars
method helpOnName
attribute _selectedObjSet
attribute currentObj
attribute freezeComment
attribute mergeLinkComment
attribute showAll
attribute project
attribute import
attribute opened
attribute fromCurContext
attribute toCurContext
attribute menuHdlr
attribute wmtArea
attribute navigView
attribute infoView
attribute toSystem
attribute toPhase
attribute toConfig
attribute toFile
attribute fromFile
attribute fromConfig
attribute fromPhase
attribute fromSystem
attribute toContext
attribute fromContext
attribute objectHdlr
}
method MergeTool::destructor {this} {
# Start destructor user section
if [$this opened] {
$this saveToolBarPresence mt
$this saveContextAreaPresence mt
$this saveMessageAreaPresence mt
$this saveWindowGeometry mt
}
# End destructor user section
$this WmtTool::destructor
}
constructor MergeTool {class this name toolId} {
set this [MainWindow::constructor $class $this $name]
set this [WmtTool::constructor $class $this $name]
# Start constructor user section
global makeSelectionUpToDate
set makeSelectionUpToDate 1
$this showAll 0
$this opened 0
global classCount
set classCount 0
MenuBar new $this.MB
eval [$globalModuleHandler moduleSpecSetChanged]
$this menuHdlr [CustBrMenuHandler new $toolId $globalModuleHandler]
$this createInterface
$this objectHdlr [CustObjHandler new $globalModuleHandler]
# Check if handlers are created without errors:
# the corporate customization files exist
if [isCommand $this.error] {
return $this
}
# Go back to corporate level and initialize the interface (toolbar)
set clientContext [ClientContext::global]
set levelIds [$clientContext currentLevelIdString]
while {! [[$clientContext currentProject] isNil]} {
$clientContext upLevel
}
[$this menuHdlr] setCurrentContext
if [catch {[$this objectHdlr] setCurrentContext} msg] {
wmtkerror $msg
}
# Reset clientContext
$clientContext setLevelIds $levelIds
m4_var foreach m4var {
if [m4_var saveStatus $m4var] {
m4_var saveStatus $m4var 0
}
}
$this setWindowGeometry mt
return $this
}
method MergeTool::createInterface {this} {
DlgColumn new $this.DC
$this setContextAreaPresence mt
if [isCommand [$this wmtArea]] {
[$this wmtArea] update
}
$this setToolBarPresence mt
interface VerSplitter $this.DC.VS {
MTNavigationView navigV {
rowCount 10
columnCount 25
horStretchFactor 5
verStretchFactor 5
horShrinkFactor 5
verShrinkFactor 5
}
MTInformationView infoV {
columnCount 40
}
}
$this setMessageAreaPresence mt
$this navigView $this.DC.VS.navigV
[$this navigView] font "[m4_var get M4_font -context mt]"
$this infoView $this.DC.VS.infoV
[$this infoView] font "[m4_var get M4_font -context mt]"
}
method MergeTool::initialize {this} {
$this import 0
busy {
wmtkmessage "Loading ..."
# create the nodes, do this from the 'source' point of view.
set cc [ClientContext::global]
$cc setLevelIds [$this fromContext]
$this project [$cc currentProject]
$this fromConfig [$cc currentConfig]
if [[$this fromConfig] isNil] {
$this fromConfig ""
}
$this fromPhase [$cc currentPhase]
if [[$this fromPhase] isNil] {
$this fromPhase ""
} else {
[$this fromPhase] parent [$this fromConfig]
}
$this fromSystem [$cc currentSystem]
if [[$this fromSystem] isNil] {
$this fromSystem ""
} else {
[$this fromSystem] parent [$this fromPhase]
}
$this fromFile [$cc currentFile]
if [[$this fromFile] isNil] {
$this fromFile ""
} else {
[$this fromFile] parent [$this fromSystem]
}
$cc setLevelIds [$this toContext]
$this toFile [$cc currentFile]
if [[$this toFile] isNil] {
$this toFile ""
}
$this toSystem [$cc currentSystem]
if [[$this toSystem] isNil] {
$this toSystem ""
} else {
MTVersion new ccSystem [$this fromSystem] [$this toSystem]
}
$this toPhase [$cc currentPhase]
if [[$this toPhase] isNil] {
$this toPhase ""
} else {
if {[[$this toPhase] phase] != [[$this fromPhase] phase]} {
$this import 1
}
MTVersion new ccPhase [$this fromPhase] [$this toPhase]
if [isCommand ccSystem] {
ccPhase addChild ccSystem
}
}
$this toConfig [$cc currentConfig]
if [[$this toConfig] isNil] {
$this toConfig ""
} else {
MTVersion new ccConfig [$this fromConfig] [$this toConfig]
if [isCommand ccPhase] {
ccConfig addChild ccPhase
}
}
if [[$this project] isNil] {
$this project ""
} else {
MTProject new ccProject [$this project] [$this project]
if [isCommand ccConfig] {
ccProject addChild ccConfig
}
}
if {[$this toPhase] != ""} {
[$this toPhase] parent [$this toConfig]
}
if {[$this toSystem] != ""} {
[$this toSystem] parent [$this toPhase]
}
if {[$this toFile] != ""} {
[$this toFile] parent [$this toSystem]
}
# start int from context
$cc setLevelIds [$this fromContext]
$this updateMenu
# create popup menu for view
ViewPopUpMenu new [$this infoView].pop -poppedUp {
[.main infoView].pop entrySet [[.main menuHdlr] validPopUpEntrySet]
}
$this start
wmtkmessage Done
$this opened 1
}
}
method MergeTool::selectedObjSet {this} {
set selectedObjSet [$this _selectedObjSet]
if {"$selectedObjSet" == "undefined"} {
set selectedObjSet [[$this infoView] selectedSet]
$this _selectedObjSet $selectedObjSet
}
if $makeSelectionUpToDate {
foreach obj $selectedObjSet {
set repObj [$obj repObj]
if {! [isCommand $repObj]} continue
set from [$repObj fromRepObj]
if [isCommand $from] {
$from makeUpToDate
}
set to [$repObj toRepObj]
if [isCommand $to] {
$to makeUpToDate
}
}
}
return $selectedObjSet
}
method MergeTool::selectedMergeObjSet {this} {
set mergeObjects {}
foreach object [$this selectedObjSet] {
lappend mergeObjects [$object repObj]
}
return $mergeObjects
}
method MergeTool::selectionChanged {this} {
global makeSelectionUpToDate
set makeSelectionUpToDate 0
$this _selectedObjSet "undefined"
[$this menuHdlr] selectionChanged
set makeSelectionUpToDate 1
}
method MergeTool::start {this} {
set cc [ClientContext::global]
global classCount
incr classCount
set unique $classCount
set name MTVersion$unique
case [$cc currentLevel] in {
{Config} {
MTConfig new $name [$this fromConfig] [$this toConfig]
ccProject addChild $name
set from [$this fromConfig]
set to [$this toConfig]
set start Configuration
}
{Phase} {
MTPhase new $name [$this fromPhase] [$this toPhase]
ccConfig addChild $name
set from [$this fromPhase]
set to [$this toPhase]
set start Phase
}
{System} {
MTSystem new $name [$this fromSystem] [$this toSystem]
ccPhase addChild $name
set from [$this fromSystem]
set to [$this toSystem]
set start System
}
{File} {
MTFile new $name [$this fromFile] [$this toFile]
ccSystem addChild $name
set from [$this fromFile]
set to [$this toFile]
set start File
}
}
set fromName [$from getInfo Name]
set toName [$to getInfo Name]
if ![MTProcs::isDerived $from $to] {
# now create the tree element
MTVersionable new [$this navigView].$unique $name
[$this navigView].$unique parent ""
[$this navigView].$unique initialize
}
if [isCommand [$this navigView].$unique] {
[$this navigView].$unique open
} else {
# create the top link
if ![MTProcs::isDerived $from $to] {
MTProcs::createMergeLink $name [.main mergeLinkComment]
}
wmtkinfo "Merge complete."
wmtkmessage "Merge complete."
}
set title "ObjectTeam Merge - "
set title "$title From $start '$fromName (V[$from versionName])'"
set title "$title To $start '$toName (V[$to versionName])'"
$this title $title
$this selectionChanged
$this freezeComment "created by mergetool"
$this mergeLinkComment "created by mergetool"
}
method MergeTool::addContextArea {this} {
$this wmtArea [MTWmtArea new $this.DC.WA]
}
method MergeTool::updateWmtArea {this} {
[$this wmtArea] update
}
method MergeTool::updateToolBar {this} {
if [catch {[$this menuHdlr] setCurrentContext} errorMsg] {
if [info exists errorInfo] {
set errorTrace $errorInfo
set errorCodeCopy $errorCode
resetErrorVars
} else {
set errorTrace ""
set errorCodeCopy ""
}
} else {
set errorMsg ""
}
# check the menu's after setCurrentContext of menu handler
$this updateMenu
}
method MergeTool::updateMenu {this} {
# adjust menu for import
if [$this import] {
if [isCommand $this.MB.view.menu.showAllMergeObjects] {
$this.MB.view.menu.showAllMergeObjects delete
}
if [isCommand $this.MB.version.menu.merge] {
$this.MB.version.menu.merge delete
}
if [isCommand $this.MB.version.menu.overwrite] {
$this.MB.version.menu.overwrite delete
}
if [isCommand $this.MB.version.menu.import] {
$this.MB.version.menu.import label Merge
}
} else {
if [isCommand $this.MB.version.menu.import] {
$this.MB.version.menu.import delete
}
}
}
method MergeTool::setCurrentContextVars {this} {
# update the 'to Context', it can be changed due to
# new actions
set cc [ClientContext::global]
set toContext /[[$cc currentCorporate] identity]
append toContext /[[$cc currentProject] identity]
if {[$cc currentLevel] == "Config"} {
append toContext /[[$this toConfig] identity]
} elseif {[$cc currentLevel] == "Phase"} {
append toContext /[[$this toConfig] identity]
append toContext /[[$this toPhase] identity]
} elseif {[$cc currentLevel] == "System"} {
append toContext /[[$this toConfig] identity]
append toContext /[[$this toPhase] identity]
append toContext /[[$this toSystem] identity]
}
$this toContext $toContext
# set the current Context vars
set from ""
set to ""
set p ""
if {[$this currentObj] != ""} {
set p [[$this currentObj] repObj]
}
for {} {"$p" != "" && [$p level] != ""} {set p [$p parent]} {
if {[$p parent] == "" || [[$p parent] level] == ""} {
continue
}
# check if currentLevel reached
if {[$p level] == [$cc currentLevel]} {
break
}
$this from[$p level] [$p fromRepObj]
if {$from == ""} {
set from "[[$p fromRepObj] identity]"
} else {
set from "[[$p fromRepObj] identity]/$from"
}
$this to[$p level] [$p toRepObj]
if {[$p toRepObj] == ""} {
continue
}
if {$to == ""} {
set to "[[$p toRepObj] identity]"
} else {
set to "[[$p toRepObj] identity]/$to"
}
}
if {$from != ""} {
set from "[$this fromContext]/$from"
} else {
set from "[$this fromContext]"
}
if {$to != ""} {
set to "[$this toContext]/$to"
} else {
set to "[$this toContext]"
}
$this fromCurContext $from
$this toCurContext $to
}
method MergeTool::helpOnName {this name} {
global short2url
if {! [catch {set url $short2url($name)}]} {
showHelp $url
return
}
if [regsub "crnt_" $name "" name] {
$this helpOnName $name
return
}
wmtkerror "Sorry, no help available for '$name'"
}
# Do not delete this line -- regeneration end marker