home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / classbrows.tcl < prev    next >
Encoding:
Text File  |  1996-11-29  |  21.6 KB  |  885 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1996
  4. #
  5. #      File:           @(#)classbrows.tcl    /main/hindenburg/12
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)classbrows.tcl    /main/hindenburg/12   29 Nov 1996 Copyright 1996 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. require "cbwmtarea.tcl"
  13. require "cbsupercla.tcl"
  14. require "cbsubclass.tcl"
  15. require "cbclasstex.tcl"
  16. require "cbfeaturet.tcl"
  17. require "cbassoctex.tcl"
  18.  
  19. require "cbcadmodel.tcl"
  20. require "cbclasssta.tcl"
  21.  
  22. require "classselha.tcl"
  23. require "diagramsel.tcl"
  24. require "workitemse.tcl"
  25.  
  26. require "cbpropview.tcl"
  27. require "cbfindclas.tcl"
  28. require "cbfindfeat.tcl"
  29. require "cbattrfilt.tcl"
  30. require "cboperfilt.tcl"
  31. require "cbfilterfe.tcl"
  32. require "cbfontchoo.tcl"
  33. require "tooloption.tcl"
  34.  
  35. require "cb2url.tcl"
  36. require "showversio.tcl"
  37. require "closeexitd.tcl"
  38. # End user added include file section
  39.  
  40. require "wmttool.tcl"
  41.  
  42. Class ClassBrowser : {WmtTool MainWindow} {
  43.     method destructor
  44.     constructor
  45.     method fileReloadClasses
  46.     method fileOpen
  47.     method fileClose
  48.     method fileFindClass
  49.     method fileFindFeature
  50.     method filePrintView
  51.     method fileExit
  52.     method itemShowProperties
  53.     method itemShowScope
  54.     method viewFlat
  55.     method viewFilterFeatures
  56.     method optionsSortCaseSensitive
  57.     method optionsFont
  58.     method optionsPrinterSetup
  59.     method utilEditCAD
  60.     method helpOnContext
  61.     method popUp
  62.     method initView
  63.     method selTextListChanged
  64.     method getSelTextListEntry
  65.     method getSelectedSet
  66.     method getCBClass
  67.     method getCurrentOpenedClassIndex
  68.     method addFileHistory
  69.     method renumberFileHistory
  70.     method updateFileHistory
  71.     method setFileHistory
  72.     method saveFileHistory
  73.     method addContextArea
  74.     method updateToolBar
  75.     method updateWmtArea
  76.     method updateTitle
  77.     method updateWmtAreaClass
  78.     method popupCloseExit
  79.     method doClose
  80.     method setFont
  81.     method helpOnName
  82.     method classTL
  83.     method superClassTL
  84.     method subClassTL
  85.     method featureTL
  86.     method assocTL
  87.     method startEditCADHandler
  88.     attribute projectName
  89.     attribute configurationName
  90.     attribute phaseName
  91.     attribute systemName
  92.     attribute className
  93.     attribute historyCount
  94.     attribute isInFlatViewMode
  95.     attribute phaseLevelpathIds
  96.     attribute _classTL
  97.     attribute _superClassTL
  98.     attribute _subClassTL
  99.     attribute _featureTL
  100.     attribute _assocTL
  101.     attribute propertyViewer
  102.     attribute propKnowledgeDB
  103.     attribute filterFeaturesDialog
  104.     attribute options
  105.     attribute fileHistorySet
  106.     attribute showScopeHandler
  107.     attribute closeExit
  108.     attribute menuHandler
  109.     attribute _startEditCADHandler
  110.     attribute editCADHandler
  111.     attribute openHandler
  112.     attribute selTextList
  113.     attribute currentOpenedClass
  114.     attribute openHistory
  115.     attribute ccontext
  116.     attribute model
  117.     attribute wmtArea
  118. }
  119.  
  120. global ClassBrowser::attrFilter
  121. set ClassBrowser::attrFilter ""
  122.  
  123. global ClassBrowser::operFilter
  124. set ClassBrowser::operFilter ""
  125.  
  126.  
  127. method ClassBrowser::destructor {this} {
  128.     set ref [$this _classTL]
  129.     if {$ref != ""} {
  130.         $ref _browser ""
  131.     }
  132.     set ref [$this _superClassTL]
  133.     if {$ref != ""} {
  134.         $ref _browser ""
  135.     }
  136.     set ref [$this _subClassTL]
  137.     if {$ref != ""} {
  138.         $ref _browser ""
  139.     }
  140.     set ref [$this _featureTL]
  141.     if {$ref != ""} {
  142.         $ref _browser ""
  143.     }
  144.     set ref [$this _assocTL]
  145.     if {$ref != ""} {
  146.         $ref _browser ""
  147.     }
  148.     set ref [$this _startEditCADHandler]
  149.     if {$ref != ""} {
  150.         $ref _browser ""
  151.     }
  152.     # Start destructor user section
  153.     $this saveFileHistory
  154.     $this saveToolBarPresence classbrowser
  155.     $this saveContextAreaPresence classbrowser
  156.     $this saveMessageAreaPresence classbrowser
  157.     $this saveWindowGeometry classbrowser
  158.     if {[$this model] != ""} {
  159.         [$this model] delete
  160.     }
  161.     GCControl collect
  162.     # End destructor user section
  163.     $this WmtTool::destructor
  164. }
  165.  
  166. constructor ClassBrowser {class this name ccontext} {
  167.     set this [MainWindow::constructor $class $this $name]
  168.     set this [WmtTool::constructor $class $this $name]
  169.     $this ccontext $ccontext
  170.  
  171.     # Initialize some attributes
  172.     #
  173.     $this model ""
  174.     $this isInFlatViewMode \
  175.         [expr {([m4_var get M4_flat_view] == "1") ? 1 : 0}]
  176.  
  177.     # Initialize graphical stuff
  178.     #
  179.     $this config \
  180.         -title "ObjectTeam Class Browser" \
  181.         -fileHistorySet [List new] \
  182.         -historyCount 0 \
  183.         -closed {%this fileExit} \
  184.         -exitButton $this.bar.file.menu.exit \
  185.         -icon clbrowser \
  186.         -iconTitle "ObjectTeam Class Browser"
  187.  
  188.     global classCount
  189.     set classCount 1
  190.     MenuBar new $this.bar
  191.     $this menuHandler [CustCBMenuHandler new class]
  192.     $this setToolBarPresence classbrowser
  193.     [$this menuHandler] setCurrentContext
  194.     # Initialize the two menucheckbuttons if they exist
  195.     if {[isCommand $this.bar.view.menu.flat]} {
  196.         $this.bar.view.menu.flat state \
  197.             [expr {([m4_var get M4_flat_view] == "1") ? 1 : 0}]
  198.     }
  199.     if {[isCommand $this.bar.options.menu.sortcasesensitive]} {
  200.         $this.bar.options.menu.sortcasesensitive state [expr \
  201.             {([m4_var get M4_sort_case_sensitive] == "1") ? 1 : 0}]
  202.     }
  203.  
  204.     DlgColumn new $this.c
  205.     $this setContextAreaPresence classbrowser
  206.     HorSeparator new $this.c.sep
  207.     interface VerSplitter $this.c.vs {
  208.         DlgRow r1 {
  209.         HorSplitter hs1 {
  210.             DlgColumn c1 {
  211.             Label superClassesLab {
  212.                 text "Superclasses"
  213.             }
  214.             CBSuperClassTextList superClasses {
  215.                 selectionPolicy BROWSE
  216.                 rowCount 3
  217.             }
  218.             }
  219.             DlgColumn c2 {
  220.             Label classesLab {
  221.                 text "Classes"
  222.             }
  223.             CBClassTextList classes {
  224.                 selectionPolicy BROWSE
  225.                 rowCount 7
  226.                 justification FILLED
  227.             }
  228.             }
  229.             DlgColumn c3 {
  230.             Label subClassesLab {
  231.                 text "Subclasses"
  232.             }
  233.             CBSubClassTextList subClasses {
  234.                 selectionPolicy BROWSE
  235.                 rowCount  3
  236.             }
  237.             }
  238.         }
  239.         }
  240.         DlgRow r2 {
  241.         HorSplitter hs2 {
  242.             DlgColumn c1 {
  243.             Label featuresLab {
  244.                 text "Features"
  245.             }
  246.             CBFeatureTextlist features {
  247.                 selectionPolicy BROWSE
  248.                 rowCount 12
  249.                 justification FILLED
  250.             }
  251.             }
  252.             DlgColumn c2 {
  253.             Label associationsLab {
  254.                 text "Associations"
  255.             }
  256.             CBAssocTextList associations {
  257.                 selectionPolicy BROWSE
  258.                 rowCount 3
  259.             }
  260.             }
  261.         }
  262.         }
  263.     }
  264.     $this projectName [[[$this ccontext] currentProject] name]
  265.     set confName [[[[$this ccontext] currentConfig] config] name]
  266.     set confVersion [[[$this ccontext] currentConfig] versionNumber]
  267.     $this configurationName "$confName (V$confVersion)"
  268.     $this phaseName [[[[$this ccontext] currentPhase] phase] name]
  269.     $this updateWmtArea
  270.  
  271.         $this superClassTL $this.c.vs.r1.hs1.c1.superClasses
  272.         $this classTL $this.c.vs.r1.hs1.c2.classes
  273.         $this subClassTL $this.c.vs.r1.hs1.c3.subClasses
  274.         $this featureTL $this.c.vs.r2.hs2.c1.features
  275.         $this assocTL $this.c.vs.r2.hs2.c2.associations
  276.  
  277.     $this setMessageAreaPresence classbrowser
  278.  
  279.     $this setFont [m4_var get M4_font -context classbrowser]
  280.  
  281.     $this options [ToolOptions new $this.options]
  282.  
  283.     # Set phaseLevelpathIds attribute with LevelPathIds upto Phase level.
  284.     lappend ids [[$ccontext currentCorporate] identity]
  285.     lappend ids [[$ccontext currentProject] identity]
  286.     lappend ids [[$ccontext currentConfig] identity]
  287.     lappend ids [[$ccontext currentPhase] identity]
  288.     $this phaseLevelpathIds [join [concat {""} $ids] /]
  289.  
  290.     # Create PropKnowledgeDB and PropertyViewer.
  291.     # Set context of PropKnowledgeDB with LevelPathIds upto current System.
  292.     #
  293.     $this propKnowledgeDB [PropKnowledgeDB new $this.propKnowledgeDB]
  294.     set systemLevelIds [$this phaseLevelpathIds]
  295.     if {![[$ccontext currentSystem] isNil]} {
  296.         set systemLevelIds [join [concat $systemLevelIds \
  297.             [[$ccontext currentSystem] identity]] /]
  298.     }
  299.     $this.propKnowledgeDB context $systemLevelIds
  300.  
  301.     $this propertyViewer [CBPropViewer new $this.propViewer \
  302.         [$this propKnowledgeDB]]
  303.  
  304.     # Create global attribute and operation filters
  305.     #
  306.     global ClassBrowser::attrFilter
  307.     set ClassBrowser::attrFilter [CBAttrFilter new \
  308.         .attrFilter [$this propKnowledgeDB]]
  309.     global ClassBrowser::operFilter
  310.     set ClassBrowser::operFilter [CBOperFilter new \
  311.         .operFilter [$this propKnowledgeDB]]
  312.  
  313.     # Initialize handlers/dialogs
  314.     #
  315.     $this openHandler [ClassSelHandler new $this.openHandler \
  316.                     -title "Open Class" \
  317.                     -message "Select Class:" \
  318.                     -command open]
  319.     $this showScopeHandler [WorkItemSelHandler new $this.showScopeHandler \
  320.                     -title "Show Scope" \
  321.                     -message "Select Item:" \
  322.                     -command showScope]
  323.     $this editCADHandler [ClassSelHandler new $this.editCADHandler \
  324.                     -title "Edit CAD Class" \
  325.                     -message "Select Class:" \
  326.                     -command editCAD]
  327.     $this startEditCADHandler [DiagramSelHandler new \
  328.                     $this.startEditCADHandler \
  329.                     -title "Edit CAD" \
  330.                     -message "Select CAD:" \
  331.                     -command editCAD]
  332.     $this filterFeaturesDialog ""
  333.  
  334.     $this setWindowGeometry classbrowser
  335.  
  336.     ClassMaker::extend CustMenuPushButton HistMenuButton {cbClass nameItem}
  337.  
  338.     return $this
  339. }
  340.  
  341. method ClassBrowser::fileReloadClasses {this} {
  342.     $this initView 1
  343. }
  344.  
  345. method ClassBrowser::fileOpen {this} {
  346.     busy {
  347.         set textListEntry [$this getSelTextListEntry]
  348.         if {$textListEntry != ""} {
  349.             $textListEntry open
  350.         }
  351.     }
  352. }
  353.  
  354. method ClassBrowser::fileClose {this} {
  355.     if {[[$this openHistory] size] == 0} {
  356.         $this popupCloseExit "$this fileExit"
  357.     } else {
  358.         $this doClose
  359.     }
  360. }
  361.  
  362. method ClassBrowser::fileFindClass {this} {
  363.     if {![isCommand $this.findClassDialog]} {
  364.         CBFindClassDialog new $this.findClassDialog
  365.     }
  366.     $this.findClassDialog popUp
  367. }
  368.  
  369. method ClassBrowser::fileFindFeature {this} {
  370.     if {![isCommand $this.findFeatureDialog]} {
  371.         CBFindFeatureDialog new $this.findFeatureDialog
  372.     }
  373.     $this.findFeatureDialog popUp
  374. }
  375.  
  376. method ClassBrowser::filePrintView {this} {
  377.     set printer [m4_var get M4_a_printer]
  378.     set tmpFile [args_file {}]
  379.     set fid [open $tmpFile w]
  380.  
  381.     puts $fid "View of:"
  382.     puts $fid "  Project: [$this projectName]"
  383.     puts $fid "  Configuration Version: [$this configurationName]"
  384.     puts $fid "  Phase Version: [$this phaseName]"
  385.     puts $fid "  System Version: [$this systemName]"
  386.     puts $fid "  Class: [$this className]"
  387.     puts $fid "\n-- Superclasses --"
  388.     foreach entry [[$this superClassTL] entrySet] {
  389.         puts $fid "  $entry"
  390.     }
  391.     puts $fid "\n-- Subclasses --"
  392.     foreach entry [[$this subClassTL] entrySet] {
  393.         puts $fid "  $entry"
  394.     }
  395.     puts $fid "\n-- Features --"
  396.     foreach entry [[$this featureTL] entrySet] {
  397.         puts $fid "  $entry"
  398.     }
  399.     puts $fid "\n-- Associations --"
  400.     foreach entry [[$this assocTL] entrySet] {
  401.         puts $fid "  $entry"
  402.     }
  403.  
  404.     close $fid
  405.     $this startCommand extern \
  406.         "$printer $tmpFile" "[list BasicFS::removeFile $tmpFile]" \
  407.         "Sending output to $printer..." \
  408.         {0 0} 0
  409. }
  410.  
  411. method ClassBrowser::fileExit {this} {
  412.     $this delete
  413.     exit
  414. }
  415.  
  416. method ClassBrowser::itemShowProperties {this} {
  417.     busy {
  418.         set textListEntry [$this getSelTextListEntry]
  419.         if {$textListEntry != ""} {
  420.             [$this propertyViewer] showProperties $textListEntry
  421.         }
  422.     }
  423. }
  424.  
  425. method ClassBrowser::itemShowScope {this} {
  426.     busy {
  427.         set textListEntry [$this getSelTextListEntry]
  428.         if {$textListEntry != ""} {
  429.             $textListEntry showScope
  430.         }
  431.     }
  432. }
  433.  
  434. method ClassBrowser::viewFlat {this checkButton} {
  435.     if {[catch {m4_var set M4_flat_view [$checkButton state]}]} {
  436.         wmtkerror "Unable to set Display Flat View"
  437.         $checkButton state [expr ![$checkButton state]]
  438.         return
  439.     }
  440.     $this isInFlatViewMode [$checkButton state]
  441.  
  442.     set currentClass [$this currentOpenedClass]
  443.     if {$currentClass == ""} {
  444.         return
  445.     }
  446.     busy {
  447.         [$this superClassTL] updateView $currentClass
  448.         [$this featureTL] updateView $currentClass
  449.         [$this assocTL] updateView $currentClass
  450.     }
  451. }
  452.  
  453. method ClassBrowser::viewFilterFeatures {this} {
  454.     if {[$this filterFeaturesDialog] == ""} {
  455.         $this filterFeaturesDialog [CBFilterFeaturesDialog \
  456.             new $this.filterFeaturesDialog]
  457.     }
  458.     $this.filterFeaturesDialog popUp
  459. }
  460.  
  461. method ClassBrowser::optionsSortCaseSensitive {this checkButton} {
  462.     if {[catch {m4_var set M4_sort_case_sensitive [$checkButton state]}]} {
  463.         wmtkerror "Unable to set Sort Case Sensitive"
  464.         $checkButton state [expr ![$checkButton state]]
  465.         return
  466.     }
  467.  
  468.     busy {
  469.         [$this superClassTL] sort
  470.         [$this classTL] sort
  471.         [$this subClassTL] sort
  472.     }
  473. }
  474.  
  475. method ClassBrowser::optionsFont {this} {
  476.     busy {
  477.         if {![isCommand $this.fontChooser]} {
  478.             CBFontChooser new $this.fontChooser
  479.         }
  480.     }
  481.     $this.fontChooser popUp
  482. }
  483.  
  484. method ClassBrowser::optionsPrinterSetup {this} {
  485.     [$this options] aPrinterSetup
  486. }
  487.  
  488. method ClassBrowser::utilEditCAD {this} {
  489.     busy {
  490.         set textListEntry [$this getSelTextListEntry]
  491.         if {$textListEntry != ""} {
  492.             $textListEntry editCAD
  493.         }
  494.     }
  495. }
  496.  
  497. method ClassBrowser::helpOnContext {this} {
  498.     set selTextList [$this selTextList]
  499.     if {$selTextList == ""} {
  500.         $this helpOnName context
  501.         return
  502.     }
  503.     set idx [expr {[string last "." $selTextList] + 1}]
  504.     set name [string range $selTextList $idx end]TL
  505.     $this helpOnName $name
  506. }
  507.  
  508. method ClassBrowser::popUp {this} {
  509.     $this MainWindow::popUp
  510.     $this ready
  511. }
  512.  
  513. method ClassBrowser::initView {this {reload 0}} {
  514.     busy {
  515.         # (Re)Initialize attributes
  516.         #
  517.         $this openHistory [CBClassStack new]
  518.         $this currentOpenedClass ""
  519.         $this updateWmtAreaClass ""
  520.  
  521.         if {[$this model] != ""} {
  522.             [$this model] delete
  523.         }
  524.         $this model [CBCADModel new [[$this ccontext] currentConfig] \
  525.             [[$this ccontext] currentPhase]]
  526.  
  527.         # Reinitialise findClassDialog and findFeatureDialog
  528.         #
  529.         if {[isCommand $this.findClassDialog]} {
  530.             $this.findClassDialog initialisedView
  531.         }
  532.         if {[isCommand $this.findFeatureDialog]} {
  533.             $this.findFeatureDialog initialisedView
  534.         }
  535.  
  536.         # Do GC
  537.         #
  538.         GCControl collect
  539.         #puts "GCControl lastNrOfColl: [GCControl lastNrOfCollected]"
  540.  
  541.         # (Re)Load
  542.         #
  543.         if {!$reload} {
  544.             wmtkmessage "Loading Classes ..."
  545.         } else {
  546.             wmtkmessage "Reloading Classes ..."
  547.         }
  548.         [$this model] load
  549.         [$this superClassTL] initView
  550.         [$this subClassTL] initView
  551.         [$this classTL] initView
  552.         [$this featureTL] initView
  553.         [$this assocTL] initView
  554.         $this selTextList ""
  555.         wmtkmessage ""
  556.  
  557.         if {!$reload} {
  558.             $this setFileHistory
  559.         } else {
  560.             $this updateFileHistory
  561.         }
  562.  
  563.         # notify the menuhandler of the selectionChange
  564.         [$this menuHandler] selectionChanged
  565.     }
  566. }
  567.  
  568. method ClassBrowser::selTextListChanged {this newSelTextList} {
  569.     set selTextList [$this selTextList]
  570.     if {$selTextList == $newSelTextList} {
  571.         [$this menuHandler] selectionChanged
  572.         return
  573.     }
  574.     if {$selTextList != ""} {
  575.         $selTextList deselectEntries
  576.     }
  577.     $this selTextList $newSelTextList
  578.     [$this menuHandler] selectionChanged
  579. }
  580.  
  581. method ClassBrowser::getSelTextListEntry {this} {
  582.     set selTextList [$this selTextList]
  583.     if {$selTextList == ""} {
  584.         return ""
  585.     }
  586.     return [$selTextList getSelTextListEntry]
  587. }
  588.  
  589.  
  590. # Used by Menu Customization Mechanism
  591. #
  592. method ClassBrowser::getSelectedSet {this} {
  593.     return [$this getSelTextListEntry]
  594. }
  595.  
  596. method ClassBrowser::getCBClass {this nameItem} {
  597.     [[$this classTL] textListEntrySet] foreach class {
  598.         if {[$nameItem isSame [$class getNameItem]]} {
  599.             return $class
  600.         }
  601.     }
  602.     return ""
  603. }
  604.  
  605. method ClassBrowser::getCurrentOpenedClassIndex {this} {
  606.     set currentClass [$this currentOpenedClass]
  607.     if {$currentClass == ""} {
  608.         return 0
  609.     }
  610.     set classList [[[$this classTL] textListEntrySet] contents]
  611.     set idx [lsearch -exact $classList $currentClass]
  612.     if {$idx == -1} {
  613.         return 0
  614.     }
  615.     return $idx
  616. }
  617.  
  618. method ClassBrowser::addFileHistory {this cbClass} {
  619.     set index [expr [[$this exitButton] index] - 1 - \
  620.             [[$this fileHistorySet] length]]
  621.     [$this fileHistorySet] foreach entry {
  622.         if {$cbClass != [$entry cbClass]} {
  623.             continue
  624.         }
  625.         [$this fileHistorySet] removeValue $entry
  626.         [$this fileHistorySet] insert $entry
  627.         $this renumberFileHistory
  628.         $entry index $index
  629.         return
  630.     }
  631.  
  632.     set latest [expr [$this historyCount] + 1]
  633.     HistMenuButton new [$this menuBar].file.menu.his$latest \
  634.         -label "1 [$cbClass name]" -mnemonic 1 -index $index \
  635.         -cbClass $cbClass -nameItem [$cbClass getNameItem] \
  636.         -hintText "Opens class [$cbClass name]." \
  637.         -activated "$cbClass open"
  638.     [$this fileHistorySet] insert [$this menuBar].file.menu.his$latest
  639.     $this historyCount $latest
  640.     $this renumberFileHistory
  641.  
  642.     if {[[$this fileHistorySet] length] > 5} {
  643.         [[$this fileHistorySet] index end] delete
  644.         [$this fileHistorySet] remove end
  645.     } elseif {[[$this fileHistorySet] length] == 1} {
  646.         CustMenuSeparator new [$this menuBar].file.menu.histsep \
  647.             -index $index
  648.     }
  649. }
  650.  
  651. method ClassBrowser::renumberFileHistory {this} {
  652.     set m 1
  653.     [$this fileHistorySet] foreach entry {
  654.         $entry config -mnemonic $m -label "$m [[$entry cbClass] name]"
  655.         incr m
  656.     }
  657. }
  658.  
  659. method ClassBrowser::updateFileHistory {this} {
  660.     [$this fileHistorySet] foreach entry {
  661.         set cbClass [$this getCBClass [$entry nameItem]]
  662.         if {$cbClass != ""} { 
  663.             $entry config -cbClass $cbClass \
  664.                 -activated "$cbClass open"
  665.         } else {
  666.             $entry delete
  667.             [$this fileHistorySet] removeValue $entry
  668.             if {[[$this fileHistorySet] length] == 0} {
  669.                 [$this menuBar].file.menu.histsep delete
  670.             } else {
  671.                 $this updateFileHistory
  672.             }
  673.             return
  674.         }
  675.     }
  676.     $this renumberFileHistory
  677. }
  678.  
  679. method ClassBrowser::setFileHistory {this} {
  680.     set history [m4_var get M4_file_history -context classbrowser]
  681.     if {"$history" == ""} {
  682.         return
  683.     }
  684.     foreach itemId $history {
  685.         set cbClass [$this getCBClass [Item new $itemId]]
  686.         if {$cbClass != ""} {
  687.             $this addFileHistory $cbClass
  688.         }
  689.     }
  690. }
  691.  
  692. method ClassBrowser::saveFileHistory {this} {
  693.     set history ""
  694.     [$this fileHistorySet] foreach entry {
  695.         set history [linsert $history 0 [[$entry nameItem] identity]]
  696.     }
  697.     if {$history != [m4_var get M4_file_history -context classbrowser]} {
  698.         m4_var set M4_file_history $history -context classbrowser
  699.     }
  700. }
  701.  
  702. method ClassBrowser::addContextArea {this} {
  703.     $this wmtArea [CBWmtArea new $this.c.wmtArea]
  704. }
  705.  
  706. method ClassBrowser::updateToolBar {this} {
  707.     [$this menuHandler] setCurrentContext
  708. }
  709.  
  710. method ClassBrowser::updateWmtArea {this} {
  711.     if {[$this wmtArea] != ""} {
  712.         [$this wmtArea] projectNm [$this projectName]
  713.         [$this wmtArea] configurationNm [$this configurationName]
  714.         [$this wmtArea] phaseNm [$this phaseName]
  715.         if {[$this systemName] != ""} {
  716.             [$this wmtArea] systemNm [$this systemName]
  717.         } else {
  718.             # Reserve some space for the 'System Version'
  719.             # and 'Class' fields
  720.             [$this wmtArea] systemNm "              "
  721.         }
  722.         [$this wmtArea] classNm [$this className]
  723.     }
  724. }
  725.  
  726. method ClassBrowser::updateTitle {this currentClass} {
  727.     set title [$this title]
  728.     set hyphen [string first "-" $title]
  729.     if {$hyphen < 0} {
  730.     append title " -"
  731.     } else {
  732.     set title [string range $title 0 $hyphen]
  733.     }
  734.     set iconTitle [$currentClass name]
  735.     append title " $iconTitle"
  736.     $this config \
  737.     -title $title \
  738.     -iconTitle $iconTitle
  739. }
  740.  
  741. method ClassBrowser::updateWmtAreaClass {this currentClass} {
  742.     if {$currentClass == ""} {
  743.         $this systemName ""
  744.         $this className ""
  745.     } else {
  746.         set systemV [$currentClass getDefiningSystemVersion]
  747.         if {[$systemV isNil]} {
  748.             $this systemName ""
  749.         } else {
  750.             $this systemName [[$systemV system] name]
  751.         }
  752.         $this className [$currentClass name]
  753.     }
  754.     $this updateWmtArea
  755. }
  756.  
  757. method ClassBrowser::popupCloseExit {this action} {
  758.     set closeExit [$this closeExit]
  759.     if {$closeExit == ""} {
  760.         set closeExit [CloseExitDialog new $this.closeExit]
  761.         $this closeExit $closeExit
  762.     }
  763.     $closeExit action $action
  764.     $closeExit popUp
  765. }
  766.  
  767. method ClassBrowser::doClose {this} {
  768.     busy {
  769.         set previousClass [[$this openHistory] pop]
  770.         if {$previousClass != ""} {
  771.             $previousClass doOpen
  772.         }
  773.     }
  774. }
  775.  
  776. method ClassBrowser::setFont {this newFont} {
  777.     [$this superClassTL] font $newFont
  778.     [$this subClassTL] font $newFont
  779.     [$this classTL] font $newFont
  780.     [$this featureTL] font $newFont
  781.     [$this assocTL] font $newFont
  782. }
  783.  
  784. method ClassBrowser::helpOnName {this name} {
  785.     global short2url
  786.     if [catch {set url $short2url($name)}] {
  787.         wmtkerror "Sorry, no help available for '$name'"
  788.     } else {
  789.         showHelp $url
  790.     }
  791. }
  792.  
  793. # Do not delete this line -- regeneration end marker
  794.  
  795. method ClassBrowser::classTL {this args} {
  796.     if {$args == ""} {
  797.         return [$this _classTL]
  798.     }
  799.     set ref [$this _classTL]
  800.     if {$ref != ""} {
  801.         $ref _browser ""
  802.     }
  803.     set obj [lindex $args 0]
  804.     if {$obj != ""} {
  805.         $obj _browser $this
  806.     }
  807.     $this _classTL $obj
  808. }
  809.  
  810. method ClassBrowser::superClassTL {this args} {
  811.     if {$args == ""} {
  812.         return [$this _superClassTL]
  813.     }
  814.     set ref [$this _superClassTL]
  815.     if {$ref != ""} {
  816.         $ref _browser ""
  817.     }
  818.     set obj [lindex $args 0]
  819.     if {$obj != ""} {
  820.         $obj _browser $this
  821.     }
  822.     $this _superClassTL $obj
  823. }
  824.  
  825. method ClassBrowser::subClassTL {this args} {
  826.     if {$args == ""} {
  827.         return [$this _subClassTL]
  828.     }
  829.     set ref [$this _subClassTL]
  830.     if {$ref != ""} {
  831.         $ref _browser ""
  832.     }
  833.     set obj [lindex $args 0]
  834.     if {$obj != ""} {
  835.         $obj _browser $this
  836.     }
  837.     $this _subClassTL $obj
  838. }
  839.  
  840. method ClassBrowser::featureTL {this args} {
  841.     if {$args == ""} {
  842.         return [$this _featureTL]
  843.     }
  844.     set ref [$this _featureTL]
  845.     if {$ref != ""} {
  846.         $ref _browser ""
  847.     }
  848.     set obj [lindex $args 0]
  849.     if {$obj != ""} {
  850.         $obj _browser $this
  851.     }
  852.     $this _featureTL $obj
  853. }
  854.  
  855. method ClassBrowser::assocTL {this args} {
  856.     if {$args == ""} {
  857.         return [$this _assocTL]
  858.     }
  859.     set ref [$this _assocTL]
  860.     if {$ref != ""} {
  861.         $ref _browser ""
  862.     }
  863.     set obj [lindex $args 0]
  864.     if {$obj != ""} {
  865.         $obj _browser $this
  866.     }
  867.     $this _assocTL $obj
  868. }
  869.  
  870. method ClassBrowser::startEditCADHandler {this args} {
  871.     if {$args == ""} {
  872.         return [$this _startEditCADHandler]
  873.     }
  874.     set ref [$this _startEditCADHandler]
  875.     if {$ref != ""} {
  876.         $ref _browser ""
  877.     }
  878.     set obj [lindex $args 0]
  879.     if {$obj != ""} {
  880.         $obj _browser $this
  881.     }
  882.     $this _startEditCADHandler $obj
  883. }
  884.  
  885.