2626
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2000 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
2516
|
15 |
AbstractVersionDiffBrowserItem subclass:#ClassItem
|
2538
|
16 |
instanceVariableNames:'myClass isRegistered revisonColl revisionInfo'
|
2516
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
2547
|
19 |
category:'Interface-Browsers-Support'
|
2516
|
20 |
!
|
|
21 |
|
2547
|
22 |
!ClassItem class methodsFor:'documentation'!
|
|
23 |
|
2626
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 2000 by eXept Software AG
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
|
|
37 |
|
|
38 |
!
|
|
39 |
|
2547
|
40 |
documentation
|
|
41 |
"
|
2625
|
42 |
This is not yet finished (work in progress) - do not use.
|
2547
|
43 |
|
|
44 |
[author:]
|
|
45 |
Pierre Schwarz (ps@exept.de)
|
|
46 |
|
|
47 |
[see also:]
|
|
48 |
|
|
49 |
[instance variables:]
|
|
50 |
|
|
51 |
[class variables:]
|
|
52 |
"
|
|
53 |
|
|
54 |
! !
|
2516
|
55 |
|
2538
|
56 |
!ClassItem class methodsFor:'protocol'!
|
|
57 |
|
|
58 |
expandableRevisionItemClass
|
|
59 |
|
|
60 |
^ExpandableRevisionItem
|
|
61 |
!
|
|
62 |
|
|
63 |
sourceRevisonItemClass
|
|
64 |
|
|
65 |
^SourceRevisionItem
|
|
66 |
!
|
|
67 |
|
|
68 |
versionRevisionItemClass
|
|
69 |
|
|
70 |
^VersionRevisionItem
|
|
71 |
! !
|
|
72 |
|
2516
|
73 |
!ClassItem methodsFor:'accessing'!
|
|
74 |
|
2538
|
75 |
loadedRevisionItem
|
|
76 |
|
|
77 |
^children detect:[:eachRevision | eachRevision isLoadedRevision]
|
|
78 |
!
|
|
79 |
|
2516
|
80 |
myClass
|
|
81 |
"return the value of the instance variable 'myClass' (automatically generated)"
|
|
82 |
|
|
83 |
^ myClass!
|
|
84 |
|
|
85 |
myClass:something
|
|
86 |
"set the value of the instance variable 'myClass' (automatically generated)"
|
|
87 |
|
|
88 |
myClass := something.!
|
|
89 |
|
2538
|
90 |
needsChildren
|
|
91 |
"return the value of the instance variable 'isRegistered' (automatically generated)"
|
2516
|
92 |
|
2538
|
93 |
^ children size == 0
|
|
94 |
!
|
2516
|
95 |
|
2538
|
96 |
revisonColl
|
|
97 |
"return the value of the instance variable 'revisonColl' (automatically generated)"
|
|
98 |
|
|
99 |
^ revisonColl!
|
|
100 |
|
|
101 |
revisonColl:something
|
|
102 |
"set the value of the instance variable 'revisonColl' (automatically generated)"
|
|
103 |
|
|
104 |
revisonColl := something.! !
|
2516
|
105 |
|
|
106 |
!ClassItem methodsFor:'initialization'!
|
|
107 |
|
|
108 |
initialize
|
2517
|
109 |
"
|
|
110 |
initialize necessary things
|
2516
|
111 |
|
2517
|
112 |
<return: self>
|
|
113 |
"
|
2538
|
114 |
super initialize.
|
|
115 |
isRegistered := false
|
|
116 |
! !
|
|
117 |
|
|
118 |
!ClassItem methodsFor:'private'!
|
|
119 |
|
|
120 |
addAllRevisionsBefore:anExpandableRevisonItem
|
|
121 |
|
|
122 |
|
|
123 |
|theChildrens theStartIndex theStopIndex theRevisionSize|
|
|
124 |
|
|
125 |
(theStartIndex := children size) <= (theRevisionSize := revisonColl size) ifTrue:[
|
|
126 |
theStopIndex := theRevisionSize.
|
|
127 |
theChildrens := revisonColl copyFrom:theStartIndex to:theStopIndex.
|
|
128 |
"remove expandable item"
|
|
129 |
self remove:anExpandableRevisonItem.
|
|
130 |
"add items"
|
|
131 |
self addAll:theChildrens.
|
|
132 |
]
|
|
133 |
!
|
|
134 |
|
|
135 |
addNewRevisionsBefore:anExpandableRevisonItem
|
|
136 |
|
|
137 |
|
|
138 |
|theChildrens theStartIndex theStopIndex|
|
|
139 |
|
|
140 |
(theStartIndex := children size) <= revisonColl size ifTrue:[
|
|
141 |
theStopIndex := (theStartIndex-1) * 2 + (theStartIndex-1).
|
|
142 |
theStopIndex := theStopIndex min:revisonColl size.
|
|
143 |
theChildrens := revisonColl copyFrom:theStartIndex to:theStopIndex.
|
|
144 |
"add items"
|
|
145 |
self addAll:theChildrens before:anExpandableRevisonItem.
|
|
146 |
"check if all revisions are shown, if true remove expandable item"
|
|
147 |
(theStopIndex = revisonColl size) ifTrue:[self remove:anExpandableRevisonItem].
|
|
148 |
]
|
|
149 |
!
|
|
150 |
|
|
151 |
setRevisionInfo:aRevisionInfo
|
|
152 |
|
|
153 |
aRevisionInfo removeKey:#revisions.
|
|
154 |
revisionInfo := aRevisionInfo
|
2516
|
155 |
! !
|
|
156 |
|
|
157 |
!ClassItem methodsFor:'protocol'!
|
|
158 |
|
|
159 |
children
|
|
160 |
"returns list of children. The revision for the class myClass
|
|
161 |
are computed via the sourcecode manager. Only when the childrens
|
|
162 |
are needed, they are calculated.
|
|
163 |
|
|
164 |
<return: nil|List>
|
|
165 |
"
|
2538
|
166 |
|
|
167 |
isRegistered ifFalse:[
|
|
168 |
isRegistered := true.
|
2516
|
169 |
self application getRevisionInfoForClassItem:self.
|
2538
|
170 |
self changed:#icon
|
2516
|
171 |
].
|
|
172 |
^children
|
|
173 |
|
|
174 |
!
|
|
175 |
|
2538
|
176 |
computeRevisions
|
|
177 |
|
2542
|
178 |
|theClass theSourceCodeManager theRevisionLog|
|
2538
|
179 |
|
|
180 |
theClass := self myClass.
|
2542
|
181 |
(theSourceCodeManager := theClass sourceCodeManager) isNil
|
|
182 |
ifFalse:[theRevisionLog := theSourceCodeManager revisionLogOf:theClass].
|
|
183 |
self setRevisions:theRevisionLog
|
2538
|
184 |
!
|
|
185 |
|
2516
|
186 |
hasChildren
|
|
187 |
"a class items has always childs
|
|
188 |
|
|
189 |
<return: Boolean>
|
|
190 |
"
|
|
191 |
|
|
192 |
^true
|
|
193 |
!
|
|
194 |
|
2538
|
195 |
icon
|
|
196 |
isRegistered ifFalse:[^#unloadedClassItem].
|
|
197 |
(isRegistered and:[children size ~~ 0]) ifTrue:[
|
|
198 |
^#loadedClassItem
|
|
199 |
].
|
|
200 |
^#loadingClassItem
|
|
201 |
!
|
|
202 |
|
2516
|
203 |
label
|
|
204 |
|
|
205 |
^myClass name
|
|
206 |
|
|
207 |
|
2538
|
208 |
!
|
|
209 |
|
|
210 |
newestRevision
|
|
211 |
|
|
212 |
revisionInfo ifNil:[^''].
|
|
213 |
^revisionInfo at:#newestRevision
|
|
214 |
|
|
215 |
|
|
216 |
!
|
|
217 |
|
|
218 |
setChildrensFromRevisionColl
|
|
219 |
|
|
220 |
|theChildrens|
|
|
221 |
|
|
222 |
revisonColl size > 5
|
|
223 |
ifTrue:[
|
|
224 |
theChildrens := revisonColl copyFrom:1 to:5.
|
|
225 |
theChildrens add:self class expandableRevisionItemClass new.
|
|
226 |
]
|
|
227 |
ifFalse:[theChildrens:=revisonColl].
|
|
228 |
self addAll:theChildrens
|
|
229 |
!
|
|
230 |
|
|
231 |
setRevisions:aRevisionInfo
|
|
232 |
|
|
233 |
aRevisionInfo isNil
|
|
234 |
ifTrue: [revisonColl := Array with:(self class sourceRevisonItemClass newForRevision:nil)]
|
|
235 |
ifFalse:[revisonColl := (aRevisionInfo at:#revisions) collect:[:eachRevision|
|
|
236 |
self class versionRevisionItemClass newForRevision:eachRevision].
|
|
237 |
self isMyClassChanged
|
|
238 |
ifTrue:[revisonColl addFirst:(self class sourceRevisonItemClass newForRevision:myClass revisionInfo)].
|
|
239 |
self setRevisionInfo:aRevisionInfo].
|
|
240 |
self setChildrensFromRevisionColl.
|
2516
|
241 |
! !
|
|
242 |
|
|
243 |
!ClassItem methodsFor:'testing'!
|
|
244 |
|
|
245 |
isClassItem
|
2538
|
246 |
"
|
|
247 |
Used for testing tree items. Define correct behaviour in subclasses
|
|
248 |
|
|
249 |
<return: Boolean>
|
|
250 |
"
|
2516
|
251 |
|
|
252 |
^true
|
|
253 |
|
|
254 |
|
|
255 |
!
|
|
256 |
|
|
257 |
isMyClassChanged
|
|
258 |
|
|
259 |
^Project isClassChanged: myClass
|
|
260 |
! !
|
|
261 |
|
|
262 |
!ClassItem class methodsFor:'documentation'!
|
|
263 |
|
|
264 |
version
|
2626
|
265 |
^ '$Header: /cvs/stx/stx/libtool/ClassItem.st,v 1.8 2000-02-18 14:09:35 cg Exp $'
|
2516
|
266 |
! !
|