author | Claus Gittinger <cg@exept.de> |
Wed, 23 Aug 2006 20:20:37 +0200 | |
changeset 6967 | ed49b45a3a7d |
parent 6966 | e1d23fbb51bd |
child 6968 | 37d120b69e7e |
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 |
||
6966 | 314 |
changedObject == ChangeSet ifTrue:[ |
6967 | 315 |
self halt. |
6966 | 316 |
self invalidateList. |
317 |
^ self |
|
318 |
]. |
|
319 |
||
5591 | 320 |
(organizerMode notNil |
321 |
and:[organizerMode value ~~ #project]) ifTrue:[ |
|
6923 | 322 |
self invalidateList. |
323 |
^ self |
|
5591 | 324 |
]. |
325 |
super delayedUpdate:something with:aParameter from:changedObject |
|
326 |
||
327 |
"Created: / 17.2.2000 / 23:41:02 / cg" |
|
328 |
"Modified: / 26.2.2000 / 01:21:49 / cg" |
|
329 |
! |
|
330 |
||
331 |
selectionChangedByClick |
|
332 |
"we are not interested in that - get another notification |
|
333 |
via the changed valueHolder" |
|
334 |
||
335 |
"Created: / 17.2.2000 / 23:41:17 / cg" |
|
336 |
! |
|
337 |
||
338 |
update:something with:aParameter from:changedObject |
|
339 |
changedObject == Smalltalk ifTrue:[ |
|
6923 | 340 |
something == #methodDictionary ifTrue:[ |
341 |
^ self |
|
342 |
]. |
|
343 |
something == #methodTrap ifTrue:[ |
|
344 |
^ self |
|
345 |
]. |
|
346 |
something == #methodInClass ifTrue:[ |
|
347 |
^ self |
|
348 |
]. |
|
349 |
something == #classVariables ifTrue:[ |
|
350 |
^ self |
|
351 |
]. |
|
352 |
something == #classComment ifTrue:[ |
|
353 |
^ self. |
|
354 |
]. |
|
355 |
something == #methodInClassRemoved ifTrue:[ |
|
356 |
^ self. |
|
357 |
]. |
|
5591 | 358 |
]. |
359 |
super update:something with:aParameter from:changedObject |
|
360 |
! ! |
|
361 |
||
362 |
!ProjectList methodsFor:'drag & drop'! |
|
363 |
||
6468 | 364 |
canDropContext:aDropContext |
5591 | 365 |
|methodsOrClasses package| |
366 |
||
367 |
methodsOrClasses := aDropContext dropObjects collect:[:obj | obj theObject]. |
|
368 |
||
369 |
(methodsOrClasses contains:[:aMethodOrClass | (aMethodOrClass isMethod or:[aMethodOrClass isClass]) not]) ifTrue:[^ false]. |
|
370 |
||
371 |
package := self packageAtTargetPointOf:aDropContext. |
|
372 |
package isNil ifTrue:[^ false]. |
|
373 |
||
374 |
(methodsOrClasses contains:[:aMethodOrClass | aMethodOrClass package ~= package]) ifFalse:[^ false]. |
|
375 |
^ true |
|
376 |
! |
|
377 |
||
6468 | 378 |
doDropContext:aDropContext |
5591 | 379 |
|package methodsOrClasses methods classes| |
380 |
||
381 |
methodsOrClasses := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject]. |
|
382 |
(methodsOrClasses contains:[:something | (something isMethod or:[something isClass]) not]) ifTrue:[^ self]. |
|
383 |
methods := methodsOrClasses select:[:something | something isMethod]. |
|
384 |
classes := methodsOrClasses select:[:something | something isClass]. |
|
385 |
||
386 |
package := self packageAtTargetPointOf:aDropContext. |
|
387 |
package notNil ifTrue:[ |
|
6468 | 388 |
methods notEmpty ifTrue:[ |
389 |
self masterApplication moveMethods:methods toProject:package. |
|
390 |
]. |
|
391 |
classes notEmpty ifTrue:[ |
|
392 |
self masterApplication moveClasses:classes toProject:package. |
|
393 |
] |
|
5591 | 394 |
]. |
395 |
! |
|
396 |
||
397 |
packageAtTargetPointOf:aDropContext |
|
398 |
|p packageListView lineNr item package dropInfo now |
|
399 |
overItem timeOverItem| |
|
400 |
||
401 |
p := aDropContext targetPoint. |
|
402 |
||
403 |
packageListView := aDropContext targetWidget. |
|
404 |
||
405 |
dropInfo := aDropContext dropInfo. |
|
406 |
||
407 |
lineNr := packageListView yVisibleToLineNr:p y. |
|
408 |
lineNr isNil ifTrue:[^ nil]. |
|
409 |
||
410 |
item := packageListView list value at:lineNr. |
|
411 |
item isNil ifTrue:[^ nil]. |
|
412 |
||
413 |
item canExpand ifTrue:[ |
|
5782
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
414 |
now := Timestamp now. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
415 |
overItem := dropInfo at:#overItem ifAbsentPut:[item]. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
416 |
timeOverItem := dropInfo at:#timeOverItem ifAbsentPut:[now]. |
5591 | 417 |
|
5782
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
418 |
overItem ~~ item ifTrue:[ |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
419 |
dropInfo at:#timeOverItem put:now. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
420 |
dropInfo at:#overItem put:item. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
421 |
aDropContext passiveAction:[ self packageAtTargetPointOf:aDropContext ]. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
422 |
] ifFalse:[ |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
423 |
(now millisecondDeltaFrom:timeOverItem) >= (UserPreferences current timeToAutoExpandItemsWhenDraggingOver) ifTrue:[ |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
424 |
aDropContext saveDraw:[ item expand. packageListView repairDamage ]. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
425 |
dropInfo removeKey:#timeOverItem. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
426 |
dropInfo removeKey:#overItem. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
427 |
] ifFalse:[ |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
428 |
aDropContext passiveAction:[ self packageAtTargetPointOf:aDropContext ]. |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
429 |
] |
ae4720e83b49
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
5592
diff
changeset
|
430 |
]. |
5591 | 431 |
]. |
432 |
||
433 |
package := item package. |
|
434 |
package = self class nameListEntryForALL ifTrue:[^ nil]. |
|
435 |
^ package. |
|
436 |
! ! |
|
437 |
||
438 |
!ProjectList methodsFor:'generators'! |
|
439 |
||
440 |
makeGenerator |
|
441 |
"return a generator which enumerates the classes from the selected project(s)." |
|
442 |
||
443 |
|selectedPackages thePackage hideUnloadedClasses| |
|
444 |
||
445 |
selectedPackages := self selectedProjects value. |
|
446 |
selectedPackages size == 0 ifTrue:[ |
|
6894 | 447 |
^ #() |
5591 | 448 |
]. |
6907 | 449 |
selectedPackages := selectedPackages collect:[:p | p string withoutSeparators]. |
5591 | 450 |
|
451 |
hideUnloadedClasses := self hideUnloadedClasses value. |
|
452 |
||
453 |
(selectedPackages includes:(self class nameListEntryForALL)) ifTrue:[ |
|
6894 | 454 |
hideUnloadedClasses ifTrue:[ |
455 |
^ Iterator on:[:whatToDo | |
|
456 |
Smalltalk allClassesDo:[:cls | |
|
457 |
cls isLoaded ifTrue:[ |
|
458 |
(cls isNameSpace not or:[cls == Smalltalk]) ifTrue:[ |
|
459 |
whatToDo value:cls |
|
460 |
] |
|
461 |
] |
|
462 |
] |
|
463 |
] |
|
464 |
]. |
|
465 |
^ Iterator on:[:whatToDo | |
|
466 |
Smalltalk allClassesDo:[:cls | |
|
467 |
(cls isNameSpace not or:[cls == Smalltalk]) ifTrue:[ |
|
468 |
whatToDo value:cls |
|
469 |
] |
|
470 |
] |
|
471 |
] |
|
5591 | 472 |
]. |
473 |
||
474 |
selectedPackages size == 1 ifTrue:[ |
|
6894 | 475 |
"/ faster common case |
476 |
thePackage := selectedPackages first. |
|
5591 | 477 |
|
6894 | 478 |
^ Iterator on:[:whatToDo | |doInclude| |
479 |
Smalltalk allClassesDo:[:cls | |
|
480 |
(hideUnloadedClasses not or:[cls isLoaded]) |
|
481 |
ifTrue:[ |
|
482 |
(cls isNameSpace not or:[cls == Smalltalk]) ifTrue:[ |
|
483 |
doInclude := (thePackage = cls package). |
|
484 |
doInclude ifFalse:[ |
|
485 |
cls isJavaClass ifFalse:[ |
|
486 |
doInclude := (cls methodDictionary contains:[:mthd | thePackage = mthd package]) |
|
487 |
or:[ cls class methodDictionary contains:[:mthd | thePackage = mthd package]]. |
|
488 |
] |
|
489 |
]. |
|
490 |
doInclude ifTrue:[ |
|
491 |
whatToDo value:cls |
|
492 |
] |
|
493 |
] |
|
494 |
] |
|
495 |
] |
|
496 |
] |
|
5591 | 497 |
]. |
498 |
||
499 |
^ Iterator on:[:whatToDo | |doInclude| |
|
6894 | 500 |
Smalltalk allClassesDo:[:cls | |
501 |
(hideUnloadedClasses not or:[cls isLoaded]) |
|
502 |
ifTrue:[ |
|
503 |
(cls isNameSpace not or:[cls == Smalltalk]) ifTrue:[ |
|
504 |
doInclude := (selectedPackages includes:cls package). |
|
505 |
doInclude ifFalse:[ |
|
506 |
cls isJavaClass ifFalse:[ |
|
507 |
doInclude := (cls methodDictionary contains:[:mthd | selectedPackages includes:mthd package]) |
|
508 |
or:[ cls class methodDictionary contains:[:mthd | selectedPackages includes:mthd package]]. |
|
509 |
] |
|
510 |
]. |
|
511 |
doInclude ifTrue:[ |
|
512 |
whatToDo value:cls |
|
513 |
] |
|
514 |
] |
|
515 |
] |
|
516 |
] |
|
517 |
] |
|
5591 | 518 |
|
6894 | 519 |
"Created: / 17-02-2000 / 23:49:37 / cg" |
6907 | 520 |
"Modified: / 17-08-2006 / 15:08:32 / cg" |
5591 | 521 |
! ! |
522 |
||
523 |
!ProjectList methodsFor:'private'! |
|
524 |
||
6923 | 525 |
allShownProjects |
6960 | 526 |
|hideUnloaded allProjects generator addWithAllParentPackages| |
5591 | 527 |
|
528 |
allProjects := IdentitySet new. |
|
529 |
||
530 |
inGeneratorHolder isNil ifTrue:[ |
|
6960 | 531 |
hideUnloaded := self hideUnloadedClasses value. |
532 |
||
533 |
addWithAllParentPackages := |
|
534 |
[:package | |
|
535 |
|p parent| |
|
5591 | 536 |
|
6960 | 537 |
(allProjects includes:package) ifFalse:[ |
538 |
allProjects add:package. |
|
539 |
||
540 |
p := package asPackageId. |
|
541 |
[(parent := p parentPackage) notNil] whileTrue:[ |
|
542 |
allProjects add:parent asSymbol. |
|
543 |
p := parent. |
|
6655 | 544 |
]. |
6960 | 545 |
]. |
546 |
]. |
|
547 |
||
548 |
Smalltalk allClassesDo:[:eachClass | |
|
549 |
|cls pkg p classPackage| |
|
550 |
||
6965 | 551 |
(eachClass isNameSpace not or:[eachClass == Smalltalk]) ifTrue:[ |
552 |
||
553 |
(hideUnloaded not or:[eachClass isLoaded]) ifTrue:[ |
|
554 |
cls := eachClass theNonMetaclass. |
|
555 |
cls isPrivate ifTrue:[ |
|
556 |
cls := cls topOwningClass |
|
557 |
]. |
|
6960 | 558 |
|
6965 | 559 |
classPackage := cls package ? #'__NoProject__'. |
560 |
classPackage size > 0 ifTrue:[ |
|
561 |
addWithAllParentPackages value:classPackage asSymbol. |
|
562 |
] ifFalse:[ |
|
563 |
"/ for now, nameSpaces are not in any package; |
|
564 |
"/ this might change. Then, 0-sized packages are |
|
565 |
"/ illegal, and the following should be enabled. |
|
566 |
"/ self halt |
|
567 |
]. |
|
568 |
cls isJavaClass ifFalse:[ |
|
569 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
570 |
|mpkg| |
|
571 |
||
572 |
mpkg := mthd package asSymbol. |
|
573 |
mpkg ~~ classPackage ifTrue:[ |
|
574 |
(allProjects includes:mpkg) ifFalse:[ |
|
575 |
addWithAllParentPackages value:mpkg. |
|
576 |
] |
|
577 |
]. |
|
6655 | 578 |
]. |
579 |
]. |
|
580 |
]. |
|
581 |
]. |
|
582 |
]. |
|
6960 | 583 |
allProjects := allProjects asOrderedCollection. |
5591 | 584 |
|
6655 | 585 |
"/ those are simulated - in ST/X, empty projects do not |
586 |
"/ really exist; however, during browsing, it makes sense. |
|
587 |
AdditionalEmptyProjects size > 0 ifTrue:[ |
|
588 |
"/ remove those that are present ... |
|
589 |
AdditionalEmptyProjects := AdditionalEmptyProjects select:[:pkg | (allProjects includes:pkg) not]. |
|
590 |
allProjects addAll:AdditionalEmptyProjects. |
|
591 |
]. |
|
5591 | 592 |
] ifFalse:[ |
6655 | 593 |
generator := inGeneratorHolder value. |
594 |
generator isNil ifTrue:[^ #() ]. |
|
595 |
generator do:[:prj | allProjects add:prj]. |
|
5591 | 596 |
]. |
6923 | 597 |
^ allProjects asOrderedCollection. |
598 |
! |
|
599 |
||
600 |
defaultSlaveModeValue |
|
601 |
|mode| |
|
602 |
||
603 |
mode := self topApplication perform:#initialOrganizerMode ifNotUnderstood:nil. |
|
604 |
mode == OrganizerCanvas organizerModeProject ifTrue:[^ false]. |
|
605 |
mode isNil ifTrue:[^ false]. |
|
606 |
^ true |
|
607 |
! |
|
608 |
||
609 |
initialOrganizerMode |
|
610 |
^ OrganizerCanvas organizerModeProject |
|
611 |
! |
|
612 |
||
613 |
listOfProjects |
|
614 |
|allProjects| |
|
615 |
||
616 |
allProjects := self allShownProjects. |
|
5591 | 617 |
|
618 |
allProjects sort. |
|
619 |
allProjects size == 1 ifTrue:[ |
|
6655 | 620 |
"/ self projectLabelHolder value:(allProjects first , ' [Project]'). |
621 |
self projectLabelHolder value:(LabelAndIcon icon:(self class packageIcon) string:allProjects first). |
|
5591 | 622 |
]. |
623 |
allProjects size > 1 ifTrue:[ |
|
6655 | 624 |
allProjects addFirst:(self class nameListEntryForALL). |
5591 | 625 |
]. |
6907 | 626 |
|
5591 | 627 |
^ allProjects |
628 |
||
6907 | 629 |
"Created: / 17-02-2000 / 23:43:05 / cg" |
630 |
"Modified: / 17-08-2006 / 15:08:42 / cg" |
|
5591 | 631 |
! |
632 |
||
633 |
makeDependent |
|
6967 | 634 |
Smalltalk addDependent:self. |
635 |
ChangeSet addDependent:self. |
|
5591 | 636 |
! |
637 |
||
638 |
makeIndependent |
|
639 |
Smalltalk removeDependent:self. |
|
640 |
! |
|
641 |
||
6923 | 642 |
nameListFor:aProjectList |
643 |
" |
|
644 |
self basicNew |
|
6951 | 645 |
nameListFor:#( |
6923 | 646 |
'bosch:dapasx' |
647 |
'bosch:dapasx/a' |
|
648 |
'bosch:dapasx/b' |
|
649 |
'bosch:dapasx/b/1' |
|
650 |
'bosch:dapasx/b/2' |
|
651 |
'bosch:dapasx/c/1' |
|
652 |
'bosch:dapasx/c/2' |
|
653 |
'bosch:dapasy/d/1' |
|
654 |
'bosch:dapasy/d/2' |
|
655 |
) |
|
656 |
" |
|
657 |
||
6951 | 658 |
|stack projectsWithExtensions projectsWithChangedCode classesInCangeSet projectNameList| |
6923 | 659 |
|
660 |
stack := OrderedCollection new. |
|
661 |
||
6951 | 662 |
projectsWithExtensions := Set new. |
663 |
projectsWithChangedCode := Set new. |
|
664 |
||
665 |
classesInCangeSet := ChangeSet current changedClasses. |
|
666 |
classesInCangeSet := classesInCangeSet collect:[:eachClass | eachClass theNonMetaclass]. |
|
667 |
||
668 |
projectNameList := OrderedCollection new. |
|
669 |
aProjectList do:[:this | |
|
6923 | 670 |
|thisC entry rawEntry prefix indent| |
671 |
||
6965 | 672 |
this = self class nameListEntryForALL ifTrue:[ |
673 |
entry := this |
|
674 |
] ifFalse:[ |
|
675 |
thisC := this asCollectionOfSubstringsSeparatedByAny:':/'. |
|
676 |
thisC isEmpty ifTrue:[ |
|
677 |
thisC := Array with:'<<NULL>>'. |
|
678 |
]. |
|
6923 | 679 |
|
6965 | 680 |
[ |
681 |
|stackTop| |
|
6923 | 682 |
|
6965 | 683 |
stack notEmpty |
684 |
and:[ |
|
685 |
stackTop := stack last. |
|
686 |
(thisC startsWith:stackTop) ifFalse:[ |
|
687 |
stack removeLast. |
|
688 |
true |
|
689 |
] ifTrue:[ |
|
690 |
false |
|
691 |
]] |
|
692 |
] whileTrue. |
|
693 |
prefix := stack notEmpty ifTrue:[ stack last ] ifFalse:[ #() ]. |
|
694 |
indent := stack size * 4. |
|
695 |
stack addLast:thisC. |
|
696 |
prefix isEmpty ifTrue:[ |
|
697 |
rawEntry := thisC first , ':' , ((thisC copyFrom:2) asStringWith:$/). |
|
698 |
] ifFalse:[ |
|
699 |
rawEntry := (thisC copyFrom:prefix size+1) asStringWith:$/. |
|
700 |
]. |
|
701 |
||
702 |
(classesInCangeSet contains:[:cls | cls package = this]) ifTrue:[ |
|
703 |
rawEntry := rawEntry , ' *'. |
|
704 |
rawEntry := self colorizeForChangedCode:rawEntry. |
|
705 |
]. |
|
706 |
entry := (String new:indent) , rawEntry. |
|
6923 | 707 |
]. |
6951 | 708 |
projectNameList add:entry. |
6923 | 709 |
]. |
6951 | 710 |
^ projectNameList. |
6923 | 711 |
|
712 |
"Created: / 17-02-2000 / 23:43:05 / cg" |
|
6951 | 713 |
"Modified: / 23-08-2006 / 11:43:11 / cg" |
6923 | 714 |
! |
715 |
||
5591 | 716 |
release |
717 |
super release. |
|
718 |
||
719 |
projectList removeDependent:self. |
|
720 |
! |
|
721 |
||
722 |
updateList |
|
6923 | 723 |
|newList oldList newNameList oldNameList oldSelection newSelection selectedProjectsHolder| |
5591 | 724 |
|
725 |
selectedProjectsHolder := self selectedProjects. |
|
726 |
oldSelection := selectedProjectsHolder value. |
|
727 |
newList := self listOfProjects. |
|
6923 | 728 |
oldList := projectList value. |
729 |
newNameList := self nameListFor:newList. |
|
730 |
oldNameList := self projectNameList value. |
|
731 |
(newList ~= oldList |
|
732 |
or:[ newNameList ~= oldNameList]) ifTrue:[ |
|
5591 | 733 |
"/ oldSelection size > 0 ifTrue:[ |
734 |
"/ selectedProjectsHolder removeDependent:self. |
|
735 |
"/ selectedProjectsHolder value:#(). |
|
736 |
"/ selectedProjectsHolder addDependent:self. |
|
737 |
"/ ]. |
|
738 |
||
6923 | 739 |
self projectList value:newList. |
740 |
listValid := true. |
|
741 |
self projectNameList value:newNameList. |
|
5591 | 742 |
|
6923 | 743 |
oldSelection size > 0 ifTrue:[ |
744 |
newSelection := oldSelection select:[:prj | newList includes:prj]. |
|
745 |
selectedProjectsHolder value:newSelection. |
|
746 |
] |
|
5591 | 747 |
]. |
748 |
listValid := true. |
|
749 |
||
750 |
"Modified: / 25.2.2000 / 23:10:01 / cg" |
|
751 |
! ! |
|
752 |
||
753 |
!ProjectList methodsFor:'special'! |
|
754 |
||
755 |
addAdditionalProject:aProject |
|
6923 | 756 |
"/ those are simulated - in ST/X, empty projects do not |
5591 | 757 |
"/ really exist; however, during browsing, it makes sense. |
758 |
AdditionalEmptyProjects isNil ifTrue:[ |
|
6923 | 759 |
AdditionalEmptyProjects := Set new. |
5591 | 760 |
]. |
761 |
AdditionalEmptyProjects add:aProject. |
|
762 |
||
763 |
Smalltalk changed:#projectOrganization "/ not really ... to force update |
|
764 |
||
765 |
"Created: / 17.2.2000 / 23:44:27 / cg" |
|
766 |
! |
|
767 |
||
768 |
removeAdditionalProjects:aListOfProjects |
|
769 |
"/ those are simulated - in ST/X, empty categories do not |
|
770 |
"/ really exist; however, during browsing, it makes sense. |
|
771 |
AdditionalEmptyProjects notNil ifTrue:[ |
|
772 |
aListOfProjects do:[:eachProject | |
|
773 |
AdditionalEmptyProjects remove:eachProject ifAbsent:nil. |
|
774 |
]. |
|
775 |
]. |
|
776 |
Smalltalk changed:#projectOrganization "/ not really ... to force update |
|
777 |
||
778 |
"Created: / 17.2.2000 / 23:45:24 / cg" |
|
779 |
! ! |
|
780 |
||
781 |
!ProjectList class methodsFor:'documentation'! |
|
782 |
||
783 |
version |
|
6967 | 784 |
^ '$Header: /cvs/stx/stx/libtool/Tools_ProjectList.st,v 1.18 2006-08-23 18:20:37 cg Exp $' |
5591 | 785 |
! ! |