author | Claus Gittinger <cg@exept.de> |
Wed, 23 Aug 2006 17:36:13 +0200 | |
changeset 6960 | aa7f999ae458 |
parent 6951 | a089896c6970 |
child 6965 | de49c9a12837 |
permissions | -rw-r--r-- |
5591 | 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 |
||
5592 | 13 |
"{ Package: 'stx:libtool' }" |
5591 | 14 |
|
15 |
"{ NameSpace: Tools }" |
|
16 |
||
17 |
BrowserList subclass:#ProjectList |
|
6923 | 18 |
instanceVariableNames:'projectList projectNameList selectionIndexHolder' |
5591 | 19 |
classVariableNames:'AdditionalEmptyProjects' |
20 |
poolDictionaries:'' |
|
21 |
category:'Interface-Browsers-New' |
|
22 |
! |
|
23 |
||
24 |
!ProjectList class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! ! |
|
39 |
||
40 |
!ProjectList class methodsFor:'interface specs'! |
|
41 |
||
42 |
singleProjectWindowSpec |
|
43 |
"This resource specification was automatically generated |
|
44 |
by the UIPainter of ST/X." |
|
45 |
||
46 |
"Do not manually edit this!! If it is corrupted, |
|
47 |
the UIPainter may not be able to read the specification." |
|
48 |
||
49 |
" |
|
50 |
UIPainter new openOnClass:ClassCategoryList andSelector:#singleCategoryWindowSpec |
|
51 |
ClassCategoryList new openInterface:#singleCategoryWindowSpec |
|
52 |
" |
|
53 |
||
54 |
<resource: #canvas> |
|
55 |
||
56 |
^ |
|
57 |
#(#FullSpec |
|
5592 | 58 |
#name: #singleProjectWindowSpec |
59 |
#window: |
|
5591 | 60 |
#(#WindowSpec |
5592 | 61 |
#label: 'ProjectList' |
62 |
#name: 'ProjectList' |
|
63 |
#min: #(#Point 0 0) |
|
64 |
#max: #(#Point 1024 721) |
|
65 |
#bounds: #(#Rectangle 218 175 518 475) |
|
66 |
) |
|
67 |
#component: |
|
5591 | 68 |
#(#SpecCollection |
5592 | 69 |
#collection: #( |
70 |
#(#LabelSpec |
|
71 |
#label: 'ProjectName' |
|
72 |
#name: 'ProjectLabel' |
|
73 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0) |
|
74 |
#translateLabel: true |
|
75 |
#labelChannel: #projectLabelHolder |
|
76 |
#menu: #menuHolder |
|
77 |
) |
|
78 |
) |
|
5591 | 79 |
|
5592 | 80 |
) |
5591 | 81 |
) |
82 |
! |
|
83 |
||
84 |
windowSpec |
|
85 |
"This resource specification was automatically generated |
|
86 |
by the UIPainter of ST/X." |
|
87 |
||
88 |
"Do not manually edit this!! If it is corrupted, |
|
89 |
the UIPainter may not be able to read the specification." |
|
90 |
||
91 |
" |
|
92 |
UIPainter new openOnClass:ProjectList andSelector:#windowSpec |
|
93 |
ProjectList new openInterface:#windowSpec |
|
94 |
ProjectList open |
|
95 |
" |
|
96 |
||
97 |
<resource: #canvas> |
|
98 |
||
99 |
^ |
|
100 |
#(#FullSpec |
|
6468 | 101 |
#name: #windowSpec |
102 |
#window: |
|
5591 | 103 |
#(#WindowSpec |
6468 | 104 |
#label: 'ProjectList' |
105 |
#name: 'ProjectList' |
|
106 |
#min: #(#Point 0 0) |
|
107 |
#max: #(#Point 1024 721) |
|
108 |
#bounds: #(#Rectangle 13 23 313 323) |
|
109 |
) |
|
110 |
#component: |
|
5591 | 111 |
#(#SpecCollection |
6468 | 112 |
#collection: #( |
113 |
#(#SequenceViewSpec |
|
114 |
#name: 'List' |
|
115 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
116 |
#tabable: true |
|
6923 | 117 |
#model: #selectionIndexHolder |
6468 | 118 |
#menu: #menuHolder |
119 |
#hasHorizontalScrollBar: true |
|
120 |
#hasVerticalScrollBar: true |
|
121 |
#miniScrollerHorizontal: true |
|
122 |
#isMultiSelect: true |
|
123 |
#valueChangeSelector: #selectionChangedByClick |
|
6923 | 124 |
#useIndex: true |
125 |
#sequenceList: #projectNameList |
|
6468 | 126 |
#doubleClickChannel: #doubleClickChannel |
127 |
#properties: |
|
128 |
#(#PropertyListDictionary |
|
129 |
#dragArgument: nil |
|
130 |
#dropArgument: nil |
|
131 |
#canDropSelector: #canDropContext: |
|
132 |
#dropSelector: #doDropContext: |
|
133 |
) |
|
134 |
) |
|
135 |
) |
|
5591 | 136 |
|
6468 | 137 |
) |
5591 | 138 |
) |
139 |
||
140 |
"Created: / 17.2.2000 / 23:45:47 / cg" |
|
141 |
"Modified: / 17.2.2000 / 23:47:53 / cg" |
|
142 |
! ! |
|
143 |
||
144 |
!ProjectList class methodsFor:'queries-plugin'! |
|
145 |
||
146 |
aspectSelectors |
|
147 |
^ #( |
|
148 |
#(#doubleClickChannel #action ) |
|
149 |
immediateUpdate |
|
150 |
selectedProjects |
|
151 |
menuHolder |
|
152 |
outGeneratorHolder |
|
153 |
inGeneratorHolder |
|
154 |
selectionChangeCondition |
|
155 |
updateTrigger |
|
156 |
forceGeneratorTrigger |
|
157 |
hideUnloadedClasses |
|
158 |
organizerMode |
|
159 |
slaveMode |
|
160 |
) |
|
161 |
||
162 |
"Created: / 17.2.2000 / 23:46:18 / cg" |
|
163 |
"Modified: / 25.2.2000 / 22:32:10 / cg" |
|
164 |
! ! |
|
165 |
||
166 |
!ProjectList methodsFor:'aspects'! |
|
167 |
||
168 |
projectLabelHolder |
|
169 |
^ self pseudoListLabelHolder |
|
170 |
! |
|
171 |
||
172 |
projectList |
|
173 |
projectList isNil ifTrue:[ |
|
174 |
projectList := ValueHolder new. |
|
175 |
projectList addDependent:self. |
|
176 |
]. |
|
177 |
^ projectList |
|
178 |
||
179 |
"Created: / 17.2.2000 / 23:39:32 / cg" |
|
180 |
! |
|
181 |
||
6923 | 182 |
projectNameList |
183 |
projectNameList isNil ifTrue:[ |
|
184 |
projectNameList := ValueHolder new. |
|
185 |
"/ projectNameList addDependent:self. |
|
186 |
]. |
|
187 |
^ projectNameList |
|
188 |
||
189 |
"Created: / 17.2.2000 / 23:39:32 / cg" |
|
190 |
! |
|
191 |
||
5591 | 192 |
selectedProjects |
193 |
^ self selectionHolder |
|
194 |
||
195 |
"Created: / 17.2.2000 / 23:39:57 / cg" |
|
196 |
! |
|
197 |
||
198 |
selectedProjects:aValueHolder |
|
199 |
^ self selectionHolder:aValueHolder |
|
6923 | 200 |
! |
201 |
||
202 |
selectionIndexHolder |
|
203 |
selectionIndexHolder isNil ifTrue:[ |
|
204 |
selectionIndexHolder := 0 asValue. |
|
205 |
selectionIndexHolder addDependent:self. |
|
206 |
]. |
|
207 |
^ selectionIndexHolder |
|
208 |
||
209 |
"Created: / 17.2.2000 / 23:39:32 / cg" |
|
5591 | 210 |
! ! |
211 |
||
212 |
!ProjectList methodsFor:'change & update'! |
|
213 |
||
214 |
delayedUpdate:something with:aParameter from:changedObject |
|
6923 | 215 |
|cls sel pkg mthd newSel| |
5591 | 216 |
|
217 |
self inSlaveModeOrInvisible |
|
218 |
"/ (self slaveMode value == true) |
|
219 |
ifTrue:[ |
|
6923 | 220 |
(changedObject == Smalltalk |
221 |
or:[ something == #projectOrganization ]) ifTrue:[ |
|
222 |
listValid := false |
|
223 |
]. |
|
224 |
^ self |
|
225 |
]. |
|
226 |
||
227 |
changedObject == self selectionIndexHolder ifTrue:[ |
|
228 |
listValid ifFalse:[ |
|
229 |
self updateList. |
|
230 |
]. |
|
231 |
newSel := changedObject value collect:[:idx | projectList value at:idx]. |
|
232 |
newSel ~= self selectedProjects value ifTrue:[ |
|
233 |
self selectedProjects value:newSel. |
|
234 |
]. |
|
235 |
^ self. |
|
236 |
]. |
|
237 |
changedObject == self selectionHolder ifTrue:[ |
|
238 |
listValid == true ifFalse:[ |
|
239 |
self updateList. |
|
240 |
]. |
|
241 |
newSel := changedObject value collect:[:val | projectList value indexOf:val]. |
|
242 |
newSel ~= self selectionIndexHolder value ifTrue:[ |
|
243 |
self selectionIndexHolder value:newSel |
|
244 |
]. |
|
5591 | 245 |
]. |
246 |
||
247 |
changedObject == slaveMode ifTrue:[ |
|
6923 | 248 |
listValid ~~ true ifTrue:[ |
249 |
self enqueueDelayedUpdateList |
|
250 |
]. |
|
251 |
"/ self invalidateList. |
|
252 |
^ self |
|
5591 | 253 |
]. |
254 |
||
6923 | 255 |
changedObject == self projectList ifTrue:[ |
256 |
^ self |
|
257 |
]. |
|
5591 | 258 |
|
259 |
changedObject == Smalltalk ifTrue:[ |
|
6923 | 260 |
something == #projectOrganization ifTrue:[ |
261 |
self invalidateList. |
|
262 |
self enqueueDelayedUpdateOutputGenerator. |
|
263 |
^ self. |
|
264 |
]. |
|
265 |
something == #methodInClass ifTrue:[ |
|
266 |
listValid == true ifTrue:[ |
|
267 |
cls := aParameter at:1. |
|
268 |
sel := aParameter at:2. |
|
269 |
mthd := cls compiledMethodAt:sel. |
|
270 |
mthd notNil ifTrue:[ |
|
271 |
pkg := mthd package. |
|
272 |
(projectList value includes:pkg) ifFalse:[ |
|
273 |
self invalidateList. |
|
274 |
] |
|
275 |
]. |
|
276 |
]. |
|
277 |
^ self |
|
278 |
]. |
|
5591 | 279 |
|
6923 | 280 |
(something == #classDefinition |
281 |
or:[something == #newClass]) ifTrue:[ |
|
282 |
listValid == true ifTrue:[ |
|
283 |
cls := aParameter. |
|
284 |
pkg := cls package. |
|
285 |
(projectList value includes:pkg) ifFalse:[ |
|
286 |
self invalidateList. |
|
287 |
] ifTrue:[ |
|
288 |
self enqueueDelayedUpdateOutputGenerator |
|
289 |
]. |
|
290 |
] ifFalse:[ |
|
291 |
self invalidateList |
|
292 |
]. |
|
293 |
^ self |
|
294 |
]. |
|
295 |
(something == #classRemove) ifTrue:[ |
|
296 |
listValid == true ifTrue:[ |
|
297 |
cls := aParameter. |
|
298 |
pkg := cls package. |
|
299 |
]. |
|
300 |
]. |
|
301 |
^ self |
|
5591 | 302 |
]. |
303 |
||
304 |
"/ something == #projectOrganization ifTrue:[ |
|
305 |
"/ aParameter isSymbol ifTrue:[ |
|
306 |
"/ "/ a single method has changed |
|
307 |
"/"/ sel := aParameter. |
|
308 |
"/"/ mthd := changedObject compiledMethodAt:sel. |
|
309 |
"/ self enqueueDelayedUpdateOutputGenerator. |
|
310 |
"/ ]. |
|
311 |
"/ ^ self |
|
312 |
"/ ]. |
|
313 |
||
314 |
(organizerMode notNil |
|
315 |
and:[organizerMode value ~~ #project]) ifTrue:[ |
|
6923 | 316 |
self invalidateList. |
317 |
^ self |
|
5591 | 318 |
]. |
319 |
super delayedUpdate:something with:aParameter from:changedObject |
|
320 |
||
321 |
"Created: / 17.2.2000 / 23:41:02 / cg" |
|
322 |
"Modified: / 26.2.2000 / 01:21:49 / cg" |
|
323 |
! |
|
324 |
||
325 |
selectionChangedByClick |
|
326 |
"we are not interested in that - get another notification |
|
327 |
via the changed valueHolder" |
|
328 |
||
329 |
"Created: / 17.2.2000 / 23:41:17 / cg" |
|
330 |
! |
|
331 |
||
332 |
update:something with:aParameter from:changedObject |
|
333 |
changedObject == Smalltalk ifTrue:[ |
|
6923 | 334 |
something == #methodDictionary ifTrue:[ |
335 |
^ self |
|
336 |
]. |
|
337 |
something == #methodTrap ifTrue:[ |
|
338 |
^ self |
|
339 |
]. |
|
340 |
something == #methodInClass ifTrue:[ |
|
341 |
^ self |
|
342 |
]. |
|
343 |
something == #classVariables ifTrue:[ |
|
344 |
^ self |
|
345 |
]. |
|
346 |
something == #classComment ifTrue:[ |
|
347 |
^ self. |
|
348 |
]. |
|
349 |
something == #methodInClassRemoved ifTrue:[ |
|
350 |
^ self. |
|
351 |
]. |
|
5591 | 352 |
]. |
353 |
super update:something with:aParameter from:changedObject |
|
354 |
! ! |
|
355 |
||
356 |
!ProjectList methodsFor:'drag & drop'! |
|
357 |
||
6468 | 358 |
canDropContext:aDropContext |
5591 | 359 |
|methodsOrClasses package| |
360 |
||
361 |
methodsOrClasses := aDropContext dropObjects collect:[:obj | obj theObject]. |
|
362 |
||
363 |
(methodsOrClasses contains:[:aMethodOrClass | (aMethodOrClass isMethod or:[aMethodOrClass isClass]) not]) ifTrue:[^ false]. |
|
364 |
||
365 |
package := self packageAtTargetPointOf:aDropContext. |
|
366 |
package isNil ifTrue:[^ false]. |
|
367 |
||
368 |
(methodsOrClasses contains:[:aMethodOrClass | aMethodOrClass package ~= package]) ifFalse:[^ false]. |
|
369 |
^ true |
|
370 |
! |
|
371 |
||
6468 | 372 |
doDropContext:aDropContext |
5591 | 373 |
|package methodsOrClasses methods classes| |
374 |
||
375 |
methodsOrClasses := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject]. |
|
376 |
(methodsOrClasses contains:[:something | (something isMethod or:[something isClass]) not]) ifTrue:[^ self]. |
|
377 |
methods := methodsOrClasses select:[:something | something isMethod]. |
|
378 |
classes := methodsOrClasses select:[:something | something isClass]. |
|
379 |
||
380 |
package := self packageAtTargetPointOf:aDropContext. |
|
381 |
package notNil ifTrue:[ |
|
6468 | 382 |
methods notEmpty ifTrue:[ |
383 |
self masterApplication moveMethods:methods toProject:package. |
|
384 |
]. |
|
385 |
classes notEmpty ifTrue:[ |
|
386 |
self masterApplication moveClasses:classes toProject:package. |
|
387 |
] |
|
5591 | 388 |
]. |
389 |
! |
|
390 |
||
391 |
packageAtTargetPointOf:aDropContext |
|
392 |
|p packageListView lineNr item package dropInfo now |
|
393 |
overItem timeOverItem| |
|
394 |
||
395 |
p := aDropContext targetPoint. |
|
396 |
||
397 |
packageListView := aDropContext targetWidget. |
|
398 |
||
399 |
dropInfo := aDropContext dropInfo. |
|
400 |
||
401 |
lineNr := packageListView yVisibleToLineNr:p y. |
|
402 |
lineNr isNil ifTrue:[^ nil]. |
|
403 |
||
404 |
item := packageListView list value at:lineNr. |
|
405 |
item isNil ifTrue:[^ nil]. |
|
406 |
||
407 |
item canExpand ifTrue:[ |
|
5782
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
408 |
now := Timestamp now. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
409 |
overItem := dropInfo at:#overItem ifAbsentPut:[item]. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
410 |
timeOverItem := dropInfo at:#timeOverItem ifAbsentPut:[now]. |
5591 | 411 |
|
5782
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
412 |
overItem ~~ item ifTrue:[ |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
413 |
dropInfo at:#timeOverItem put:now. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
414 |
dropInfo at:#overItem put:item. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
415 |
aDropContext passiveAction:[ self packageAtTargetPointOf:aDropContext ]. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
416 |
] ifFalse:[ |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
417 |
(now millisecondDeltaFrom:timeOverItem) >= (UserPreferences current timeToAutoExpandItemsWhenDraggingOver) ifTrue:[ |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
418 |
aDropContext saveDraw:[ item expand. packageListView repairDamage ]. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
419 |
dropInfo removeKey:#timeOverItem. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
420 |
dropInfo removeKey:#overItem. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
421 |
] ifFalse:[ |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
422 |
aDropContext passiveAction:[ self packageAtTargetPointOf:aDropContext ]. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
423 |
] |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
424 |
]. |
5591 | 425 |
]. |
426 |
||
427 |
package := item package. |
|
428 |
package = self class nameListEntryForALL ifTrue:[^ nil]. |
|
429 |
^ package. |
|
430 |
! ! |
|
431 |
||
432 |
!ProjectList methodsFor:'generators'! |
|
433 |
||
434 |
makeGenerator |
|
435 |
"return a generator which enumerates the classes from the selected project(s)." |
|
436 |
||
437 |
|selectedPackages thePackage hideUnloadedClasses| |
|
438 |
||
439 |
selectedPackages := self selectedProjects value. |
|
440 |
selectedPackages size == 0 ifTrue:[ |
|
6894 | 441 |
^ #() |
5591 | 442 |
]. |
6907 | 443 |
selectedPackages := selectedPackages collect:[:p | p string withoutSeparators]. |
5591 | 444 |
|
445 |
hideUnloadedClasses := self hideUnloadedClasses value. |
|
446 |
||
447 |
(selectedPackages includes:(self class nameListEntryForALL)) ifTrue:[ |
|
6894 | 448 |
hideUnloadedClasses ifTrue:[ |
449 |
^ Iterator on:[:whatToDo | |
|
450 |
Smalltalk allClassesDo:[:cls | |
|
451 |
cls isLoaded ifTrue:[ |
|
452 |
(cls isNameSpace not or:[cls == Smalltalk]) ifTrue:[ |
|
453 |
whatToDo value:cls |
|
454 |
] |
|
455 |
] |
|
456 |
] |
|
457 |
] |
|
458 |
]. |
|
459 |
^ Iterator on:[:whatToDo | |
|
460 |
Smalltalk allClassesDo:[:cls | |
|
461 |
(cls isNameSpace not or:[cls == Smalltalk]) ifTrue:[ |
|
462 |
whatToDo value:cls |
|
463 |
] |
|
464 |
] |
|
465 |
] |
|
5591 | 466 |
]. |
467 |
||
468 |
selectedPackages size == 1 ifTrue:[ |
|
6894 | 469 |
"/ faster common case |
470 |
thePackage := selectedPackages first. |
|
5591 | 471 |
|
6894 | 472 |
^ Iterator on:[:whatToDo | |doInclude| |
473 |
Smalltalk allClassesDo:[:cls | |
|
474 |
(hideUnloadedClasses not or:[cls isLoaded]) |
|
475 |
ifTrue:[ |
|
476 |
(cls isNameSpace not or:[cls == Smalltalk]) ifTrue:[ |
|
477 |
doInclude := (thePackage = cls package). |
|
478 |
doInclude ifFalse:[ |
|
479 |
cls isJavaClass ifFalse:[ |
|
480 |
doInclude := (cls methodDictionary contains:[:mthd | thePackage = mthd package]) |
|
481 |
or:[ cls class methodDictionary contains:[:mthd | thePackage = mthd package]]. |
|
482 |
] |
|
483 |
]. |
|
484 |
doInclude ifTrue:[ |
|
485 |
whatToDo value:cls |
|
486 |
] |
|
487 |
] |
|
488 |
] |
|
489 |
] |
|
490 |
] |
|
5591 | 491 |
]. |
492 |
||
493 |
^ Iterator on:[:whatToDo | |doInclude| |
|
6894 | 494 |
Smalltalk allClassesDo:[:cls | |
495 |
(hideUnloadedClasses not or:[cls isLoaded]) |
|
496 |
ifTrue:[ |
|
497 |
(cls isNameSpace not or:[cls == Smalltalk]) ifTrue:[ |
|
498 |
doInclude := (selectedPackages includes:cls package). |
|
499 |
doInclude ifFalse:[ |
|
500 |
cls isJavaClass ifFalse:[ |
|
501 |
doInclude := (cls methodDictionary contains:[:mthd | selectedPackages includes:mthd package]) |
|
502 |
or:[ cls class methodDictionary contains:[:mthd | selectedPackages includes:mthd package]]. |
|
503 |
] |
|
504 |
]. |
|
505 |
doInclude ifTrue:[ |
|
506 |
whatToDo value:cls |
|
507 |
] |
|
508 |
] |
|
509 |
] |
|
510 |
] |
|
511 |
] |
|
5591 | 512 |
|
6894 | 513 |
"Created: / 17-02-2000 / 23:49:37 / cg" |
6907 | 514 |
"Modified: / 17-08-2006 / 15:08:32 / cg" |
5591 | 515 |
! ! |
516 |
||
517 |
!ProjectList methodsFor:'private'! |
|
518 |
||
6923 | 519 |
allShownProjects |
6960 | 520 |
|hideUnloaded allProjects generator addWithAllParentPackages| |
5591 | 521 |
|
522 |
allProjects := IdentitySet new. |
|
523 |
||
524 |
inGeneratorHolder isNil ifTrue:[ |
|
6960 | 525 |
hideUnloaded := self hideUnloadedClasses value. |
526 |
||
527 |
addWithAllParentPackages := |
|
528 |
[:package | |
|
529 |
|p parent| |
|
5591 | 530 |
|
6960 | 531 |
(allProjects includes:package) ifFalse:[ |
532 |
allProjects add:package. |
|
533 |
||
534 |
p := package asPackageId. |
|
535 |
[(parent := p parentPackage) notNil] whileTrue:[ |
|
536 |
allProjects add:parent asSymbol. |
|
537 |
p := parent. |
|
6655 | 538 |
]. |
6960 | 539 |
]. |
540 |
]. |
|
541 |
||
542 |
Smalltalk allClassesDo:[:eachClass | |
|
543 |
|cls pkg p classPackage| |
|
544 |
||
545 |
(hideUnloaded not or:[eachClass isLoaded]) ifTrue:[ |
|
546 |
cls := eachClass theNonMetaclass. |
|
547 |
cls isPrivate ifTrue:[ |
|
548 |
cls := cls topOwningClass |
|
549 |
]. |
|
550 |
classPackage := cls package ? #'__NoProject__'. |
|
551 |
classPackage size > 0 ifTrue:[ |
|
552 |
addWithAllParentPackages value:classPackage asSymbol. |
|
553 |
] ifFalse:[ |
|
554 |
"/ for now, nameSpaces are not in any package; |
|
555 |
"/ this might change. Then, 0-sized packages are |
|
556 |
"/ illegal, and the following should be enabled. |
|
557 |
"/ self halt |
|
558 |
]. |
|
559 |
cls isJavaClass ifFalse:[ |
|
560 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
561 |
|mpkg| |
|
562 |
||
563 |
mpkg := mthd package asSymbol. |
|
564 |
mpkg ~~ classPackage ifTrue:[ |
|
565 |
(allProjects includes:mpkg) ifFalse:[ |
|
566 |
addWithAllParentPackages value:mpkg. |
|
567 |
] |
|
6655 | 568 |
]. |
569 |
]. |
|
570 |
]. |
|
571 |
]. |
|
572 |
]. |
|
6960 | 573 |
allProjects := allProjects asOrderedCollection. |
5591 | 574 |
|
6655 | 575 |
"/ those are simulated - in ST/X, empty projects do not |
576 |
"/ really exist; however, during browsing, it makes sense. |
|
577 |
AdditionalEmptyProjects size > 0 ifTrue:[ |
|
578 |
"/ remove those that are present ... |
|
579 |
AdditionalEmptyProjects := AdditionalEmptyProjects select:[:pkg | (allProjects includes:pkg) not]. |
|
580 |
allProjects addAll:AdditionalEmptyProjects. |
|
581 |
]. |
|
5591 | 582 |
] ifFalse:[ |
6655 | 583 |
generator := inGeneratorHolder value. |
584 |
generator isNil ifTrue:[^ #() ]. |
|
585 |
generator do:[:prj | allProjects add:prj]. |
|
5591 | 586 |
]. |
6923 | 587 |
^ allProjects asOrderedCollection. |
588 |
! |
|
589 |
||
590 |
defaultSlaveModeValue |
|
591 |
|mode| |
|
592 |
||
593 |
mode := self topApplication perform:#initialOrganizerMode ifNotUnderstood:nil. |
|
594 |
mode == OrganizerCanvas organizerModeProject ifTrue:[^ false]. |
|
595 |
mode isNil ifTrue:[^ false]. |
|
596 |
^ true |
|
597 |
! |
|
598 |
||
599 |
initialOrganizerMode |
|
600 |
^ OrganizerCanvas organizerModeProject |
|
601 |
! |
|
602 |
||
603 |
listOfProjects |
|
604 |
|allProjects| |
|
605 |
||
606 |
allProjects := self allShownProjects. |
|
5591 | 607 |
|
608 |
allProjects sort. |
|
609 |
allProjects size == 1 ifTrue:[ |
|
6655 | 610 |
"/ self projectLabelHolder value:(allProjects first , ' [Project]'). |
611 |
self projectLabelHolder value:(LabelAndIcon icon:(self class packageIcon) string:allProjects first). |
|
5591 | 612 |
]. |
613 |
allProjects size > 1 ifTrue:[ |
|
6655 | 614 |
allProjects addFirst:(self class nameListEntryForALL). |
5591 | 615 |
]. |
6907 | 616 |
|
617 |
"/ indent := 0. |
|
618 |
"/ 1 to:allProjects size do:[:idx | |
|
619 |
"/ |this thisC| |
|
620 |
"/ |
|
621 |
"/ this := allProjects at:idx. |
|
622 |
"/ thisC := this asCollectionOfSubstringsSeparatedByAny:':/'. |
|
623 |
"/ |
|
624 |
"/ prevC notNil ifTrue:[ |
|
625 |
"/ (thisC startsWith:prevC) ifTrue:[ |
|
626 |
"/ indent := indent + 4. |
|
627 |
"/ ] ifFalse:[ |
|
628 |
"/ (thisC copyWithoutLast:1) = (prevC copyWithoutLast:1) ifTrue:[ |
|
629 |
"/ ] ifFalse:[ |
|
630 |
"/ indent := (indent - 4) max:0. |
|
631 |
"/ ]. |
|
632 |
"/ ]. |
|
633 |
"/ ]. |
|
634 |
"/ allProjects at:idx put:(String new:indent),this. |
|
635 |
"/ prevC := thisC. |
|
636 |
"/ ]. |
|
637 |
||
5591 | 638 |
^ allProjects |
639 |
||
6907 | 640 |
"Created: / 17-02-2000 / 23:43:05 / cg" |
641 |
"Modified: / 17-08-2006 / 15:08:42 / cg" |
|
5591 | 642 |
! |
643 |
||
644 |
makeDependent |
|
645 |
Smalltalk addDependent:self |
|
646 |
||
647 |
"Created: / 17.2.2000 / 23:43:13 / cg" |
|
648 |
! |
|
649 |
||
650 |
makeIndependent |
|
651 |
Smalltalk removeDependent:self. |
|
652 |
! |
|
653 |
||
6923 | 654 |
nameListFor:aProjectList |
655 |
" |
|
656 |
self basicNew |
|
6951 | 657 |
nameListFor:#( |
6923 | 658 |
'bosch:dapasx' |
659 |
'bosch:dapasx/a' |
|
660 |
'bosch:dapasx/b' |
|
661 |
'bosch:dapasx/b/1' |
|
662 |
'bosch:dapasx/b/2' |
|
663 |
'bosch:dapasx/c/1' |
|
664 |
'bosch:dapasx/c/2' |
|
665 |
'bosch:dapasy/d/1' |
|
666 |
'bosch:dapasy/d/2' |
|
667 |
) |
|
668 |
" |
|
669 |
||
6951 | 670 |
|stack projectsWithExtensions projectsWithChangedCode classesInCangeSet projectNameList| |
6923 | 671 |
|
672 |
stack := OrderedCollection new. |
|
673 |
||
6951 | 674 |
projectsWithExtensions := Set new. |
675 |
projectsWithChangedCode := Set new. |
|
676 |
||
677 |
classesInCangeSet := ChangeSet current changedClasses. |
|
678 |
classesInCangeSet := classesInCangeSet collect:[:eachClass | eachClass theNonMetaclass]. |
|
679 |
||
680 |
projectNameList := OrderedCollection new. |
|
681 |
aProjectList do:[:this | |
|
6923 | 682 |
|thisC entry rawEntry prefix indent| |
683 |
||
684 |
thisC := this asCollectionOfSubstringsSeparatedByAny:':/'. |
|
6930 | 685 |
thisC isEmpty ifTrue:[ |
6934 | 686 |
thisC := Array with:'<<NULL>>'. |
6930 | 687 |
]. |
6923 | 688 |
|
689 |
[ |
|
690 |
|stackTop| |
|
691 |
||
692 |
stack notEmpty |
|
693 |
and:[ |
|
694 |
stackTop := stack last. |
|
695 |
(thisC startsWith:stackTop) ifFalse:[ |
|
696 |
stack removeLast. |
|
697 |
true |
|
698 |
] ifTrue:[ |
|
699 |
false |
|
700 |
]] |
|
701 |
] whileTrue. |
|
702 |
prefix := stack notEmpty ifTrue:[ stack last ] ifFalse:[ #() ]. |
|
703 |
indent := stack size * 4. |
|
704 |
stack addLast:thisC. |
|
705 |
prefix isEmpty ifTrue:[ |
|
706 |
rawEntry := thisC first , ':' , ((thisC copyFrom:2) asStringWith:$/). |
|
707 |
] ifFalse:[ |
|
708 |
rawEntry := (thisC copyFrom:prefix size+1) asStringWith:$/. |
|
709 |
]. |
|
6951 | 710 |
|
711 |
(classesInCangeSet contains:[:cls | cls package = this]) ifTrue:[ |
|
712 |
rawEntry := rawEntry , ' *'. |
|
713 |
rawEntry := self colorizeForChangedCode:rawEntry. |
|
714 |
]. |
|
6923 | 715 |
entry := (String new:indent) , rawEntry. |
6951 | 716 |
projectNameList add:entry. |
6923 | 717 |
]. |
6951 | 718 |
^ projectNameList. |
6923 | 719 |
|
720 |
"Created: / 17-02-2000 / 23:43:05 / cg" |
|
6951 | 721 |
"Modified: / 23-08-2006 / 11:43:11 / cg" |
6923 | 722 |
! |
723 |
||
5591 | 724 |
release |
725 |
super release. |
|
726 |
||
727 |
projectList removeDependent:self. |
|
728 |
! |
|
729 |
||
730 |
updateList |
|
6923 | 731 |
|newList oldList newNameList oldNameList oldSelection newSelection selectedProjectsHolder| |
5591 | 732 |
|
733 |
selectedProjectsHolder := self selectedProjects. |
|
734 |
oldSelection := selectedProjectsHolder value. |
|
735 |
newList := self listOfProjects. |
|
6923 | 736 |
oldList := projectList value. |
737 |
newNameList := self nameListFor:newList. |
|
738 |
oldNameList := self projectNameList value. |
|
739 |
(newList ~= oldList |
|
740 |
or:[ newNameList ~= oldNameList]) ifTrue:[ |
|
5591 | 741 |
"/ oldSelection size > 0 ifTrue:[ |
742 |
"/ selectedProjectsHolder removeDependent:self. |
|
743 |
"/ selectedProjectsHolder value:#(). |
|
744 |
"/ selectedProjectsHolder addDependent:self. |
|
745 |
"/ ]. |
|
746 |
||
6923 | 747 |
self projectList value:newList. |
748 |
listValid := true. |
|
749 |
self projectNameList value:newNameList. |
|
5591 | 750 |
|
6923 | 751 |
oldSelection size > 0 ifTrue:[ |
752 |
newSelection := oldSelection select:[:prj | newList includes:prj]. |
|
753 |
selectedProjectsHolder value:newSelection. |
|
754 |
] |
|
5591 | 755 |
]. |
756 |
listValid := true. |
|
757 |
||
758 |
"Modified: / 25.2.2000 / 23:10:01 / cg" |
|
759 |
! ! |
|
760 |
||
761 |
!ProjectList methodsFor:'special'! |
|
762 |
||
763 |
addAdditionalProject:aProject |
|
6923 | 764 |
"/ those are simulated - in ST/X, empty projects do not |
5591 | 765 |
"/ really exist; however, during browsing, it makes sense. |
766 |
AdditionalEmptyProjects isNil ifTrue:[ |
|
6923 | 767 |
AdditionalEmptyProjects := Set new. |
5591 | 768 |
]. |
769 |
AdditionalEmptyProjects add:aProject. |
|
770 |
||
771 |
Smalltalk changed:#projectOrganization "/ not really ... to force update |
|
772 |
||
773 |
"Created: / 17.2.2000 / 23:44:27 / cg" |
|
774 |
! |
|
775 |
||
776 |
removeAdditionalProjects:aListOfProjects |
|
777 |
"/ those are simulated - in ST/X, empty categories do not |
|
778 |
"/ really exist; however, during browsing, it makes sense. |
|
779 |
AdditionalEmptyProjects notNil ifTrue:[ |
|
780 |
aListOfProjects do:[:eachProject | |
|
781 |
AdditionalEmptyProjects remove:eachProject ifAbsent:nil. |
|
782 |
]. |
|
783 |
]. |
|
784 |
Smalltalk changed:#projectOrganization "/ not really ... to force update |
|
785 |
||
786 |
"Created: / 17.2.2000 / 23:45:24 / cg" |
|
787 |
! ! |
|
788 |
||
789 |
!ProjectList class methodsFor:'documentation'! |
|
790 |
||
791 |
version |
|
6960 | 792 |
^ '$Header: /cvs/stx/stx/libtool/Tools_ProjectList.st,v 1.15 2006-08-23 15:36:13 cg Exp $' |
5591 | 793 |
! ! |