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