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