author | Claus Gittinger <cg@exept.de> |
Mon, 21 Aug 2006 18:37:14 +0200 | |
changeset 6934 | 4bbf39bf4538 |
parent 6930 | abe5e981e9d1 |
child 6951 | a089896c6970 |
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 |
520 |
|allProjects generator| |
|
5591 | 521 |
|
522 |
allProjects := IdentitySet new. |
|
523 |
||
524 |
inGeneratorHolder isNil ifTrue:[ |
|
6655 | 525 |
(self hideUnloadedClasses value) ifTrue:[ |
526 |
Smalltalk allClassesDo:[:eachClass | |
|
527 |
|cls pkg| |
|
5591 | 528 |
|
6655 | 529 |
eachClass isLoaded ifTrue:[ |
530 |
cls := eachClass theNonMetaclass. |
|
531 |
cls isPrivate ifTrue:[ |
|
532 |
cls := cls topOwningClass |
|
533 |
]. |
|
6923 | 534 |
pkg := cls package ? '__NoProject__'. |
6655 | 535 |
pkg withoutSeparators size > 0 ifTrue:[ |
536 |
allProjects add:pkg asSymbol. |
|
537 |
] ifFalse:[ |
|
538 |
"/ for now, nameSpaces are not in any package; |
|
539 |
"/ this might change. Then, 0-sized packages are |
|
540 |
"/ illegal, and the following should be enabled. |
|
541 |
"/ self halt |
|
542 |
]. |
|
543 |
cls isJavaClass ifFalse:[ |
|
544 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
545 |
allProjects add:mthd package asSymbol. |
|
546 |
]. |
|
547 |
]. |
|
548 |
]. |
|
549 |
]. |
|
550 |
allProjects := allProjects asOrderedCollection. |
|
551 |
] ifFalse:[ |
|
552 |
allProjects := Smalltalk allProjectIDs. |
|
553 |
]. |
|
5591 | 554 |
|
6655 | 555 |
"/ those are simulated - in ST/X, empty projects do not |
556 |
"/ really exist; however, during browsing, it makes sense. |
|
557 |
AdditionalEmptyProjects size > 0 ifTrue:[ |
|
558 |
"/ remove those that are present ... |
|
559 |
AdditionalEmptyProjects := AdditionalEmptyProjects select:[:pkg | (allProjects includes:pkg) not]. |
|
560 |
allProjects addAll:AdditionalEmptyProjects. |
|
561 |
]. |
|
5591 | 562 |
] ifFalse:[ |
6655 | 563 |
generator := inGeneratorHolder value. |
564 |
generator isNil ifTrue:[^ #() ]. |
|
565 |
generator do:[:prj | allProjects add:prj]. |
|
5591 | 566 |
]. |
6923 | 567 |
^ allProjects asOrderedCollection. |
568 |
! |
|
569 |
||
570 |
defaultSlaveModeValue |
|
571 |
|mode| |
|
572 |
||
573 |
mode := self topApplication perform:#initialOrganizerMode ifNotUnderstood:nil. |
|
574 |
mode == OrganizerCanvas organizerModeProject ifTrue:[^ false]. |
|
575 |
mode isNil ifTrue:[^ false]. |
|
576 |
^ true |
|
577 |
! |
|
578 |
||
579 |
initialOrganizerMode |
|
580 |
^ OrganizerCanvas organizerModeProject |
|
581 |
! |
|
582 |
||
583 |
listOfProjects |
|
584 |
|allProjects| |
|
585 |
||
586 |
allProjects := self allShownProjects. |
|
5591 | 587 |
|
588 |
allProjects sort. |
|
589 |
allProjects size == 1 ifTrue:[ |
|
6655 | 590 |
"/ self projectLabelHolder value:(allProjects first , ' [Project]'). |
591 |
self projectLabelHolder value:(LabelAndIcon icon:(self class packageIcon) string:allProjects first). |
|
5591 | 592 |
]. |
593 |
allProjects size > 1 ifTrue:[ |
|
6655 | 594 |
allProjects addFirst:(self class nameListEntryForALL). |
5591 | 595 |
]. |
6907 | 596 |
|
597 |
"/ indent := 0. |
|
598 |
"/ 1 to:allProjects size do:[:idx | |
|
599 |
"/ |this thisC| |
|
600 |
"/ |
|
601 |
"/ this := allProjects at:idx. |
|
602 |
"/ thisC := this asCollectionOfSubstringsSeparatedByAny:':/'. |
|
603 |
"/ |
|
604 |
"/ prevC notNil ifTrue:[ |
|
605 |
"/ (thisC startsWith:prevC) ifTrue:[ |
|
606 |
"/ indent := indent + 4. |
|
607 |
"/ ] ifFalse:[ |
|
608 |
"/ (thisC copyWithoutLast:1) = (prevC copyWithoutLast:1) ifTrue:[ |
|
609 |
"/ ] ifFalse:[ |
|
610 |
"/ indent := (indent - 4) max:0. |
|
611 |
"/ ]. |
|
612 |
"/ ]. |
|
613 |
"/ ]. |
|
614 |
"/ allProjects at:idx put:(String new:indent),this. |
|
615 |
"/ prevC := thisC. |
|
616 |
"/ ]. |
|
617 |
||
5591 | 618 |
^ allProjects |
619 |
||
6907 | 620 |
"Created: / 17-02-2000 / 23:43:05 / cg" |
621 |
"Modified: / 17-08-2006 / 15:08:42 / cg" |
|
5591 | 622 |
! |
623 |
||
624 |
makeDependent |
|
625 |
Smalltalk addDependent:self |
|
626 |
||
627 |
"Created: / 17.2.2000 / 23:43:13 / cg" |
|
628 |
! |
|
629 |
||
630 |
makeIndependent |
|
631 |
Smalltalk removeDependent:self. |
|
632 |
! |
|
633 |
||
6923 | 634 |
nameListFor:aProjectList |
635 |
" |
|
636 |
self basicNew |
|
637 |
nnameListFor:#( |
|
638 |
'bosch:dapasx' |
|
639 |
'bosch:dapasx/a' |
|
640 |
'bosch:dapasx/b' |
|
641 |
'bosch:dapasx/b/1' |
|
642 |
'bosch:dapasx/b/2' |
|
643 |
'bosch:dapasx/c/1' |
|
644 |
'bosch:dapasx/c/2' |
|
645 |
'bosch:dapasy/d/1' |
|
646 |
'bosch:dapasy/d/2' |
|
647 |
) |
|
648 |
" |
|
649 |
||
650 |
|stack| |
|
651 |
||
652 |
stack := OrderedCollection new. |
|
653 |
||
654 |
^ aProjectList collect:[:this | |
|
655 |
|thisC entry rawEntry prefix indent| |
|
656 |
||
657 |
thisC := this asCollectionOfSubstringsSeparatedByAny:':/'. |
|
6930 | 658 |
thisC isEmpty ifTrue:[ |
6934 | 659 |
thisC := Array with:'<<NULL>>'. |
6930 | 660 |
]. |
6923 | 661 |
|
662 |
[ |
|
663 |
|stackTop| |
|
664 |
||
665 |
stack notEmpty |
|
666 |
and:[ |
|
667 |
stackTop := stack last. |
|
668 |
(thisC startsWith:stackTop) ifFalse:[ |
|
669 |
stack removeLast. |
|
670 |
true |
|
671 |
] ifTrue:[ |
|
672 |
false |
|
673 |
]] |
|
674 |
] whileTrue. |
|
675 |
prefix := stack notEmpty ifTrue:[ stack last ] ifFalse:[ #() ]. |
|
676 |
indent := stack size * 4. |
|
677 |
stack addLast:thisC. |
|
678 |
prefix isEmpty ifTrue:[ |
|
679 |
rawEntry := thisC first , ':' , ((thisC copyFrom:2) asStringWith:$/). |
|
680 |
] ifFalse:[ |
|
681 |
rawEntry := (thisC copyFrom:prefix size+1) asStringWith:$/. |
|
682 |
]. |
|
683 |
entry := (String new:indent) , rawEntry. |
|
684 |
entry. |
|
685 |
]. |
|
686 |
||
687 |
"Created: / 17-02-2000 / 23:43:05 / cg" |
|
6934 | 688 |
"Modified: / 21-08-2006 / 18:35:55 / cg" |
6923 | 689 |
! |
690 |
||
5591 | 691 |
release |
692 |
super release. |
|
693 |
||
694 |
projectList removeDependent:self. |
|
695 |
! |
|
696 |
||
697 |
updateList |
|
6923 | 698 |
|newList oldList newNameList oldNameList oldSelection newSelection selectedProjectsHolder| |
5591 | 699 |
|
700 |
selectedProjectsHolder := self selectedProjects. |
|
701 |
oldSelection := selectedProjectsHolder value. |
|
702 |
newList := self listOfProjects. |
|
6923 | 703 |
oldList := projectList value. |
704 |
newNameList := self nameListFor:newList. |
|
705 |
oldNameList := self projectNameList value. |
|
706 |
(newList ~= oldList |
|
707 |
or:[ newNameList ~= oldNameList]) ifTrue:[ |
|
5591 | 708 |
"/ oldSelection size > 0 ifTrue:[ |
709 |
"/ selectedProjectsHolder removeDependent:self. |
|
710 |
"/ selectedProjectsHolder value:#(). |
|
711 |
"/ selectedProjectsHolder addDependent:self. |
|
712 |
"/ ]. |
|
713 |
||
6923 | 714 |
self projectList value:newList. |
715 |
listValid := true. |
|
716 |
self projectNameList value:newNameList. |
|
5591 | 717 |
|
6923 | 718 |
oldSelection size > 0 ifTrue:[ |
719 |
newSelection := oldSelection select:[:prj | newList includes:prj]. |
|
720 |
selectedProjectsHolder value:newSelection. |
|
721 |
] |
|
5591 | 722 |
]. |
723 |
listValid := true. |
|
724 |
||
725 |
"Modified: / 25.2.2000 / 23:10:01 / cg" |
|
726 |
! ! |
|
727 |
||
728 |
!ProjectList methodsFor:'special'! |
|
729 |
||
730 |
addAdditionalProject:aProject |
|
6923 | 731 |
"/ those are simulated - in ST/X, empty projects do not |
5591 | 732 |
"/ really exist; however, during browsing, it makes sense. |
733 |
AdditionalEmptyProjects isNil ifTrue:[ |
|
6923 | 734 |
AdditionalEmptyProjects := Set new. |
5591 | 735 |
]. |
736 |
AdditionalEmptyProjects add:aProject. |
|
737 |
||
738 |
Smalltalk changed:#projectOrganization "/ not really ... to force update |
|
739 |
||
740 |
"Created: / 17.2.2000 / 23:44:27 / cg" |
|
741 |
! |
|
742 |
||
743 |
removeAdditionalProjects:aListOfProjects |
|
744 |
"/ those are simulated - in ST/X, empty categories do not |
|
745 |
"/ really exist; however, during browsing, it makes sense. |
|
746 |
AdditionalEmptyProjects notNil ifTrue:[ |
|
747 |
aListOfProjects do:[:eachProject | |
|
748 |
AdditionalEmptyProjects remove:eachProject ifAbsent:nil. |
|
749 |
]. |
|
750 |
]. |
|
751 |
Smalltalk changed:#projectOrganization "/ not really ... to force update |
|
752 |
||
753 |
"Created: / 17.2.2000 / 23:45:24 / cg" |
|
754 |
! ! |
|
755 |
||
756 |
!ProjectList class methodsFor:'documentation'! |
|
757 |
||
758 |
version |
|
6934 | 759 |
^ '$Header: /cvs/stx/stx/libtool/Tools_ProjectList.st,v 1.13 2006-08-21 16:37:14 cg Exp $' |
5591 | 760 |
! ! |