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