ClassRevisionTree.st
author ps
Wed, 29 Dec 1999 16:32:17 +0100
changeset 2520 36b0b3f51128
child 2521 0865a2bcec81
permissions -rw-r--r--
initial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2520
36b0b3f51128 initial checkin
ps
parents:
diff changeset
     1
ApplicationModel subclass:#ClassRevisionTree
36b0b3f51128 initial checkin
ps
parents:
diff changeset
     2
	instanceVariableNames:'selectionHolder semaphoreCritical revisionInfoList revisionTask
36b0b3f51128 initial checkin
ps
parents:
diff changeset
     3
		currentClassItemInTask'
36b0b3f51128 initial checkin
ps
parents:
diff changeset
     4
	classVariableNames:''
36b0b3f51128 initial checkin
ps
parents:
diff changeset
     5
	poolDictionaries:''
36b0b3f51128 initial checkin
ps
parents:
diff changeset
     6
	category:'Interface-Browsers'
36b0b3f51128 initial checkin
ps
parents:
diff changeset
     7
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
     8
36b0b3f51128 initial checkin
ps
parents:
diff changeset
     9
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    10
!ClassRevisionTree class methodsFor:'interface spec'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    11
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    12
windowSpec
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    13
    "This resource specification was automatically generated
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    14
     by the UIPainter of ST/X."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    15
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    16
    "Do not manually edit this!! If it is corrupted,
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    17
     the UIPainter may not be able to read the specification."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    18
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    19
    "
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    20
     UIPainter new openOnClass:ClassRevisionTree andSelector:#windowSpec
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    21
     ClassRevisionTree new openInterface:#windowSpec
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    22
     ClassRevisionTree open
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    23
    "
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    24
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    25
    <resource: #canvas>
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    26
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    27
    ^ 
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    28
     #(#FullSpec
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    29
        #name: #windowSpec
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    30
        #window: 
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    31
       #(#WindowSpec
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    32
          #label: 'ClassVersionTree'
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    33
          #name: 'ClassVersionTree'
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    34
          #min: #(#Point 10 10)
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    35
          #max: #(#Point 9999 9999)
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    36
          #bounds: #(#Rectangle 16 51 881 580)
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    37
        )
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    38
        #component: 
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    39
       #(#SpecCollection
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    40
          #collection: #(
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    41
           #(#HierarchicalListViewSpec
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    42
              #name: 'HierarchicalItemListView'
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    43
              #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    44
              #model: #hierarchicalItemSelectionAspect
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    45
              #menu: #selectHierarchicalItemMenu
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    46
              #hasHorizontalScrollBar: true
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    47
              #hasVerticalScrollBar: true
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    48
              #listModel: #hierarchicalItemListModel
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    49
              #multipleSelectOk: true
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    50
              #highlightMode: #label
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    51
              #doubleClickSelector: #doubleClick:
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    52
              #selectConditionSelector: #isHierarchicalItemSelectable:
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    53
              #indicatorSelector: #doubleClick:
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    54
              #retrieveIconsSelector: #icons
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    55
            )
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    56
           )
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    57
         
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    58
        )
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    59
      )
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    60
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    61
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    62
!ClassRevisionTree class methodsFor:'menu specs'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    63
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    64
resourceItemMenu
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    65
    "This resource specification was automatically generated
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    66
     by the MenuEditor of ST/X."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    67
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    68
    "Do not manually edit this!! If it is corrupted,
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    69
     the MenuEditor may not be able to read the specification."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    70
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    71
    "
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    72
     MenuEditor new openOnClass:ClassRevisionTree andSelector:#resourceItemMenu
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    73
     (Menu new fromLiteralArrayEncoding:(ClassRevisionTree resourceItemMenu)) startUp
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    74
    "
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    75
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    76
    <resource: #menu>
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    77
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    78
    ^ 
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    79
     #(#Menu
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    80
	#(
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    81
	 #(#MenuItem
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    82
	    #label: 'Compare Changes'
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    83
	    #translateLabel: true
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    84
	    #value: #menuActionCompareChanges
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    85
	  )
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    86
	 )
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    87
	nil
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    88
	nil
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    89
      )
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    90
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    91
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    92
!ClassRevisionTree class methodsFor:'startup'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    93
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    94
openOnClasses:aClassColl withSelectionHolder:aValueHolder
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    95
    |theTree theClassItemColl|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    96
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    97
    theTree := self new.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    98
    theTree allButOpen.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
    99
    theClassItemColl := aClassColl collect:[:eachClass |
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   100
        |theClassItem theClass|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   101
        theClassItem := ClassItem new.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   102
        theClass := Smalltalk resolveName:eachClass inClass:self.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   103
        theClassItem myClass:theClass.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   104
        theClassItem].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   105
     theTree hierarchicalItemList addAll: theClassItemColl.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   106
     theTree selectionHolder:aValueHolder.   
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   107
     theTree openWindow.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   108
     ^theTree
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   109
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   110
"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   111
|theSelectionHolder|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   112
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   113
theSelectionHolder := ValueHolder new.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   114
theSelectionHolder compute:[:el |
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   115
                Transcript showCR: el first revisionString.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   116
                Transcript showCR: el second revisionString].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   117
ClassRevisionTree openOnClasses:(Smalltalk allClasses asOrderedCollection sort:[:x : y|x name < y name]) 
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   118
                  withSelectionHolder:theSelectionHolder.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   119
"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   120
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   121
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   122
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   123
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   124
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   125
!ClassRevisionTree methodsFor:'accessing'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   126
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   127
hierarchicalListItemForSelectionIndex: anIndex
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   128
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   129
    ^self hierarchicalItemListModel at:anIndex ifAbsent:nil
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   130
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   131
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   132
hierarchicalListSelectionIndexColl
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   133
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   134
    ^self hierarchicalItemSelectionAspect value
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   135
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   136
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   137
hierarchicalListSelectionIndexColl:anArray
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   138
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   139
    ^self hierarchicalItemSelectionAspect value:anArray
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   140
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   141
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   142
revisionInfoList
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   143
    "return the value of the instance variable 'revisionInfoList' (automatically generated)"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   144
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   145
    ^ revisionInfoList ifNil:[revisionInfoList := IdentitySet new]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   146
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   147
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   148
selectionHolder
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   149
    "return the value of the instance variable 'selectionHolder' (automatically generated)"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   150
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   151
    ^ selectionHolder!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   152
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   153
selectionHolder:something
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   154
    "set the value of the instance variable 'revisionItemSelection' (automatically generated)"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   155
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   156
    selectionHolder := something.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   157
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   158
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   159
semaphoreCritical
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   160
    "return the value of the instance variable 'semaphoreCritical' (automatically generated)"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   161
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   162
    ^ semaphoreCritical ifNil:[semaphoreCritical := RecursionLock new]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   163
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   164
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   165
!ClassRevisionTree methodsFor:'actions'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   166
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   167
doubleClick: anIndex
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   168
    "automatically generated by UIPainter ..."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   169
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   170
    "*** the code below performs no action"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   171
    "*** (except for some feedback on the Transcript)"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   172
    "*** Please change as required and accept in the browser."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   173
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   174
    "action to be added ..."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   175
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   176
    (self hierarchicalItemListModel at: anIndex) toggleExpand  
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   177
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   178
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   179
getRevisionInfoForClassItem: aClassItem
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   180
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   181
    self semaphoreCritical critical:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   182
        |theList|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   183
        currentClassItemInTask == aClassItem ifTrue:[^self].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   184
        (theList := self revisionInfoList) removeIdentical:aClassItem ifAbsent:[nil].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   185
        theList add:aClassItem.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   186
        Transcript showCR:theList.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   187
        self startRevisionTask]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   188
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   189
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   190
isHierarchicalItemSelectable: anIndex
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   191
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   192
    |theSelectionIndexColl theSelectionIndexSize theSelectedItem|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   193
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   194
    "nur eine Revision kann selektiert werden"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   195
    (theSelectedItem := self hierarchicalListItemForSelectionIndex: anIndex) isRevisionItem
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   196
	ifFalse:[^false].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   197
    "ist keine selektiert ist alles ok -> mit true zurueck"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   198
    (theSelectionIndexColl := self hierarchicalListSelectionIndexColl) size == 0
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   199
	 ifTrue:[^true].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   200
    "wurde deselektiert"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   201
    (self window sensor ctrlDown)
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   202
	ifTrue: [
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   203
		"ist eine Rev selektiert und die Klassen sind nicht gleich, dann falsch"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   204
		(self hierarchicalListItemForSelectionIndex:theSelectionIndexColl first) parent myClass == theSelectedItem parent myClass
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   205
		     ifFalse:[^false].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   206
		theSelectionIndexColl size ~~ 2
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   207
		     ifTrue:[^true].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   208
		(theSelectionIndexColl includes:anIndex)
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   209
			ifTrue: [^true]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   210
			ifFalse:[self hierarchicalListSelectionIndexColl:(Array with:theSelectionIndexColl first).
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   211
				^true]]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   212
	ifFalse:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   213
		(theSelectionIndexColl size == 2)
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   214
		    ifTrue:[self hierarchicalListSelectionIndexColl:(Array with:anIndex)].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   215
		^true]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   216
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   217
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   218
menuActionCompareChanges
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   219
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   220
    |theSelectionIndexColl theFirstRevisionItem theSecondRevisionItem|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   221
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   222
    theSelectionIndexColl := self hierarchicalListSelectionIndexColl.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   223
    theFirstRevisionItem := self hierarchicalListItemForSelectionIndex:theSelectionIndexColl first.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   224
    theSecondRevisionItem := self hierarchicalListItemForSelectionIndex:theSelectionIndexColl last.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   225
    self selectionHolder notNil
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   226
        ifTrue:[self selectionHolder value:(Array with:theFirstRevisionItem with:theSecondRevisionItem)]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   227
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   228
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   229
selectHierarchicalItemMenu
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   230
"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   231
<return: Block>
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   232
"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   233
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   234
    ^[|menu|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   235
      self checkIfTwoResourceItemsSelected
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   236
	ifFalse:[menu := nil] 
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   237
	ifTrue: [menu := Menu new fromLiteralArrayEncoding:(self class resourceItemMenu).
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   238
		menu receiver:self].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   239
      menu
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   240
    ]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   241
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   242
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   243
!ClassRevisionTree methodsFor:'aspects'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   244
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   245
hierarchicalItemList
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   246
    "automatically generated by UIPainter ..."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   247
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   248
    "*** the code below creates a default model when invoked."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   249
    "*** (which may not be the one you wanted)"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   250
    "*** Please change as required and accept it in the browser."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   251
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   252
    ^ self hierarchicalItemListModel root
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   253
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   254
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   255
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   256
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   257
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   258
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   259
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   260
hierarchicalItemListModel
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   261
    "automatically generated by UIPainter ..."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   262
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   263
    "*** the code below creates a default model when invoked."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   264
    "*** (which may not be the one you wanted)"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   265
    "*** Please change as required and accept it in the browser."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   266
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   267
    |holder|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   268
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   269
    (holder := builder bindingAt:#hierarchicalItemListModel) isNil ifTrue:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   270
	holder := HierarchicalList new.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   271
	holder root:(ClassItemRoot new).
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   272
	holder showRoot:false.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   273
	builder aspectAt:#hierarchicalItemListModel put:holder.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   274
	holder application:self.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   275
    ].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   276
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   277
    ^ holder.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   278
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   279
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   280
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   281
hierarchicalItemSelectionAspect
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   282
    "automatically generated by UIPainter ..."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   283
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   284
    "*** the code below creates a default model when invoked."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   285
    "*** (which may not be the one you wanted)"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   286
    "*** Please change as required and accept it in the browser."
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   287
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   288
    |holder|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   289
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   290
    (holder := builder bindingAt:#hierarchicalItemSelectionAspect) isNil ifTrue:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   291
	holder := ValueHolder new.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   292
	builder aspectAt:#hierarchicalItemSelectionAspect put:holder.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   293
	holder addDependent: self.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   294
    ].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   295
    ^ holder.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   296
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   297
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   298
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   299
icons
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   300
   |icons|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   301
    icons := Dictionary new.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   302
    icons at:#loadedRevision put:Icon leftIcon.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   303
    icons at:#notLoadedRevision put:Icon rightIcon.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   304
    ^icons
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   305
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   306
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   307
!ClassRevisionTree methodsFor:'interface opening'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   308
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   309
postOpenWith: aBuilder
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   310
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   311
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   312
    super postOpenWith: aBuilder.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   313
    self hierarchicalItemList expand.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   314
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   315
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   316
release
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   317
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   318
    self stopRevisionTask.    
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   319
    ^super release
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   320
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   321
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   322
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   323
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   324
!ClassRevisionTree methodsFor:'private'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   325
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   326
computeChildrenForClassItem:aClassItem
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   327
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   328
     |theRevisionLog|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   329
     theRevisionLog := self computeRevisionInfoForClassItem:aClassItem.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   330
     aClassItem setChildrensForRevisionInfo:theRevisionLog
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   331
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   332
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   333
computeRevisionInfoForClassItem:aClassItem
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   334
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   335
    |theClass theSourceCodeManager|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   336
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   337
    theClass := aClassItem myClass. 
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   338
    theSourceCodeManager:=theClass sourceCodeManager.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   339
    ^theSourceCodeManager revisionLogOf:theClass.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   340
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   341
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   342
revisionTaskCycle
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   343
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   344
    |theClassItem|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   345
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   346
    [
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   347
        theClassItem := nil.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   348
        self semaphoreCritical critical:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   349
            self revisionInfoList notEmpty
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   350
                ifTrue:[theClassItem := self revisionInfoList remove:(self revisionInfoList last) ifAbsent:[nil]]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   351
        ].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   352
        theClassItem notNil ifTrue:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   353
            theClassItem isExpanded
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   354
                ifTrue: [currentClassItemInTask:=theClassItem.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   355
                        self computeChildrenForClassItem:theClassItem]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   356
                ifFalse:[currentClassItemInTask:=nil]    
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   357
        ].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   358
        theClassItem notNil
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   359
    ] whileTrue.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   360
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   361
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   362
startRevisionTask
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   363
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   364
    self semaphoreCritical critical:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   365
        revisionTask ifNil:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   366
            revisionTask := Process for:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   367
                                            self revisionTaskCycle
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   368
                                        ]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   369
                               priority:(Processor userBackgroundPriority).
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   370
            revisionTask addExitAction:[revisionTask := nil].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   371
            revisionTask resume.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   372
        ].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   373
    ].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   374
!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   375
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   376
stopRevisionTask
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   377
    |task|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   378
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   379
    self semaphoreCritical critical:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   380
        (task := revisionTask) notNil ifTrue:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   381
            revisionTask := nil.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   382
            Exception handle:[:ex|] do:[
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   383
                task terminateWithAllSubprocesses.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   384
                task waitUntilTerminated.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   385
            ]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   386
        ]
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   387
    ].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   388
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   389
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   390
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   391
!ClassRevisionTree methodsFor:'setup'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   392
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   393
setupOnClasses:aClassColl withSelectionHolder:aValueHolder
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   394
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   395
    |theClassItemColl|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   396
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   397
    theClassItemColl := aClassColl collect:[:eachClass |
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   398
        |theClassItem theClass|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   399
        theClassItem := ClassItem new.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   400
        theClass := Smalltalk resolveName:eachClass inClass:Smalltalk.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   401
        theClassItem myClass:theClass.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   402
        theClassItem].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   403
     self hierarchicalItemList addAll: theClassItemColl.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   404
     self selectionHolder:aValueHolder.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   405
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   406
"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   407
|theTree|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   408
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   409
theTree := ClassRevisionTree new.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   410
theTree open.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   411
theTree setupOnClasses:#(VersionDiffBrowser HierarchicalVersionDiffBrowser SourceRevisionItem Project) withSelectionHolder:nil.
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   412
"
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   413
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   414
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   415
!ClassRevisionTree methodsFor:'testing'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   416
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   417
checkIfTwoResourceItemsSelected
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   418
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   419
    |theSelectionIndexColl|
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   420
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   421
    ((theSelectionIndexColl := self hierarchicalListSelectionIndexColl) isNil or:
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   422
	[theSelectionIndexColl size ~~ 2])
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   423
	    ifTrue:[^false].
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   424
    ^((self hierarchicalListItemForSelectionIndex:theSelectionIndexColl first) isRevisionItem
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   425
	and:[(self hierarchicalListItemForSelectionIndex:theSelectionIndexColl last) isRevisionItem])
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   426
! !
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   427
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   428
!ClassRevisionTree class methodsFor:'documentation'!
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   429
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   430
version
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   431
    ^ '$Header: /cvs/stx/stx/libtool/ClassRevisionTree.st,v 1.1 1999-12-29 15:32:17 ps Exp $'
36b0b3f51128 initial checkin
ps
parents:
diff changeset
   432
! !