36 documentation |
36 documentation |
37 " |
37 " |
38 ProjectViews basically offer two functionalities: |
38 ProjectViews basically offer two functionalities: |
39 |
39 |
40 - keep a group of windows in order to organize the desktop |
40 - keep a group of windows in order to organize the desktop |
41 (I am not sure, if this is really a useful feature, now that we |
41 (I am not sure, if this is really a useful feature, now that we |
42 have modern windowManagers which have multiple desktops as well). |
42 have modern windowManagers which have multiple desktops as well). |
43 |
43 |
44 All views as created while some project was active are remembered |
44 All views as created while a project is active are remembered |
45 and can be hidden/shown altogether. |
45 and can be hidden/shown altogether. |
46 (this has nothing to do with windowGroups) |
46 (this has nothing to do with windowGroups) |
47 |
47 |
48 Also, it is possible to close down all those windows (by destroying the project). |
48 Also, it is possible to close down all those windows (by destroying the project). |
49 |
49 |
50 - keep defaults for various system activities: |
50 - keep defaults for various system activities: |
51 - the fileOut directory (i.e. where the SystemBrowser creates fileOut sources) |
51 - the fileOut directory (i.e. where the SystemBrowser creates fileOut sources) |
52 |
52 |
53 - keep the source module/package |
53 - keep the source module/package |
54 thats the default offered when classes are checkedIn the very first time |
54 thats the default offered when classes are checkedIn the very first time |
55 |
55 |
56 - keep a default package-identifier assigned when classes/methods are created/modified. |
56 - keep a default package-identifier assigned when classes/methods are created/modified. |
57 thats mostly useful to browse all classes/methods that have been touched |
57 thats mostly useful to browse all classes/methods that have been touched |
58 in a projects context |
58 in a projects context |
59 |
59 |
60 - keep a per-project changeList |
60 - keep a per-project changeList |
|
61 |
|
62 - allow opening a browser on all classes/methods which were created or modified |
|
63 while a project was active. |
|
64 |
|
65 - allow opening a browser on this projects changeList (which contains the subset of changes |
|
66 which were done while this project was active) |
|
67 |
|
68 - allow removal of all classes/methods which have the current projects packageIdentifier |
61 " |
69 " |
62 ! ! |
70 ! ! |
63 |
71 |
64 !ProjectView class methodsFor:'instance creation'! |
72 !ProjectView class methodsFor:'instance creation'! |
65 |
73 |
104 |
112 |
105 initializeMenu |
113 initializeMenu |
106 |labels selectors| |
114 |labels selectors| |
107 |
115 |
108 SourceCodeManager isNil ifTrue:[ |
116 SourceCodeManager isNil ifTrue:[ |
109 labels := #( |
117 labels := #( |
110 'rename ...' |
118 'rename ...' |
111 '-' |
119 '-' |
112 'changes' |
120 'changes' |
113 'browse' |
121 'browse' |
114 '-' |
122 '-' |
115 'fileOut directory ...' |
123 'fileOut directory ...' |
116 'package name ...' |
124 'package name ...' |
117 '-' |
125 '-' |
118 'show' |
126 'show' |
119 'hide' |
127 'hide' |
120 '-' |
128 '-' |
121 'remove package classes/methods' |
129 'remove package classes/methods' |
122 'destroy' |
130 'remove project' |
123 ). |
131 ). |
124 |
132 |
125 selectors := #( |
133 selectors := #( |
126 renameProject |
134 renameProject |
127 nil |
135 nil |
128 browseChanges |
136 browseChanges |
129 browsePackage |
137 browsePackage |
130 nil |
138 nil |
131 projectDirectory |
139 projectDirectory |
132 projectPackage |
140 projectPackage |
133 nil |
141 nil |
134 showProject |
142 showProject |
135 hideProject |
143 hideProject |
136 nil |
144 nil |
137 removePackage |
145 removePackage |
138 destroy |
146 destroy |
139 ) |
147 ) |
140 ] ifFalse:[ |
148 ] ifFalse:[ |
141 labels := #( |
149 labels := #( |
142 'rename ...' |
150 'rename ...' |
143 '-' |
151 '-' |
144 'changes' |
152 'changes' |
145 'browse' |
153 'browse' |
146 '-' |
154 '-' |
147 'fileOut directory ...' |
155 'fileOut directory ...' |
148 'repository module ...' |
156 'repository module ...' |
149 'repository directory ...' |
157 'repository directory ...' |
150 'package name ...' |
158 'package name ...' |
151 "/ '-' |
159 "/ '-' |
152 "/ 'save project code' |
160 "/ 'save project code' |
153 "/ 'build' |
161 "/ 'build' |
154 '-' |
162 '-' |
155 'show' |
163 'show' |
156 'hide' |
164 'hide' |
157 '-' |
165 '-' |
158 'remove package code' |
166 'remove package code' |
159 'destroy' |
167 'remove project' |
160 ). |
168 ). |
161 |
169 |
162 selectors := #( |
170 selectors := #( |
163 renameProject |
171 renameProject |
164 nil |
172 nil |
165 browseChanges |
173 browseChanges |
166 browsePackage |
174 browsePackage |
167 nil |
175 nil |
168 projectDirectory |
176 projectDirectory |
169 projectModule |
177 projectModule |
170 projectRepository |
178 projectRepository |
171 projectPackage |
179 projectPackage |
172 "/ nil |
180 "/ nil |
173 "/ saveProjectFiles |
181 "/ saveProjectFiles |
174 "/ buildProject |
182 "/ buildProject |
175 nil |
183 nil |
176 showProject |
184 showProject |
177 hideProject |
185 hideProject |
178 nil |
186 nil |
179 removePackage |
187 removePackage |
180 destroy |
188 destroy |
181 ) |
189 ) |
182 ]. |
190 ]. |
183 |
191 |
184 toggle middleButtonMenu:( |
192 toggle middleButtonMenu:( |
185 PopUpMenu |
193 PopUpMenu |
186 labels:labels |
194 labels:(resources array:labels) |
187 selectors:selectors |
195 selectors:selectors |
188 receiver:self |
196 receiver:self |
189 ) |
197 ) |
190 |
198 |
191 "Created: 25.11.1995 / 18:06:32 / cg" |
199 "Created: 25.11.1995 / 18:06:32 / cg" |
192 "Modified: 10.12.1995 / 00:05:41 / cg" |
200 "Modified: 12.12.1995 / 16:48:31 / cg" |
193 ! ! |
201 ! ! |
194 |
202 |
195 !ProjectView methodsFor:'menu actions'! |
203 !ProjectView methodsFor:'menu actions'! |
196 |
204 |
197 browseChanges |
205 browseChanges |
198 |b| |
206 |b| |
199 |
207 |
200 b := ChangeSetBrowser openOn:(myProject changeSet). |
208 b := ChangeSetBrowser openOn:(myProject changeSet). |
201 b label:'Changes in ' , myProject name |
209 b label:(resources string:'Changes in %1' with:myProject name) |
202 ! |
210 ! |
203 |
211 |
204 browsePackage |
212 browsePackage |
205 "launch browsers for all classes/methods which are defined in this package" |
213 "launch browsers for all classes/methods which are defined in this package |
|
214 (i.e. whose packageIdentifier is the same as my Projects packageIdentifier)" |
206 |
215 |
207 self topView withWaitCursorDo:[ |
216 self topView withWaitCursorDo:[ |
208 |classes packageName methods methodList| |
217 |classes packageName methods methodList anyClasses anyMethods ignoredClasses| |
209 |
218 |
210 packageName := myProject packageName. |
219 anyMethods := anyClasses := false. |
211 classes := myProject classes. |
220 |
212 (classes notNil and:[classes notEmpty]) ifTrue:[ |
221 packageName := myProject packageName. |
213 SystemBrowser browseClasses:classes |
222 classes := myProject classes. |
214 title:'classes in package ' , packageName. |
223 (classes notNil and:[classes notEmpty]) ifTrue:[ |
215 |
224 anyClasses := true. |
216 classes := classes asIdentitySet. |
225 ]. |
217 classes addAll:(classes collect:[:c | c class]). |
226 |
218 ] ifFalse:[ |
227 methods := myProject individualMethods. |
219 classes := #() |
228 methods notEmpty ifTrue:[ |
220 ]. |
229 anyMethods := true. |
221 "/ SystemBrowser browseMethodsWhere:[:cls :mthd :sel | |
230 SystemBrowser browseMethods:methods |
222 "/ mthd package = packageName |
231 title:(resources string:'individual methods in package %1' with:packageName). |
223 "/ and:[(classes includes:cls) not] |
232 ]. |
224 "/ ] |
233 anyClasses ifTrue:[ |
225 "/ title:'individual methods in package ' , packageName. |
234 SystemBrowser browseClasses:classes |
226 |
235 title:(resources string:'classes in package %1' with:packageName). |
227 methods := myProject individualMethods. |
236 ]. |
228 methodList := methods collect:[:m | |
237 (anyClasses or:[anyMethods]) ifFalse:[ |
229 |who| |
238 self information:(resources string:'no classes or methods in this project (yet)') |
230 |
239 ] |
231 who := m who. |
|
232 (who at:1) name , ' ' , (who at:2) |
|
233 ]. |
|
234 methodList notEmpty ifTrue:[ |
|
235 SystemBrowser browseMethods:methodList |
|
236 title:'individual methods in package ' , packageName. |
|
237 ] |
|
238 ] |
240 ] |
239 |
241 |
240 "Created: 10.12.1995 / 00:08:58 / cg" |
242 "Created: 10.12.1995 / 00:08:58 / cg" |
|
243 "Modified: 12.12.1995 / 16:35:07 / cg" |
241 ! |
244 ! |
242 |
245 |
243 browseProps |
246 browseProps |
244 "will look better, once property inspector runs ..." |
247 "will look better, once property inspector runs ..." |
245 |
248 |
305 projectDirectory |
292 projectDirectory |
306 |box d| |
293 |box d| |
307 |
294 |
308 box := FilenameEnterBox new. |
295 box := FilenameEnterBox new. |
309 box directoriesOnly. |
296 box directoriesOnly. |
310 box title:(resources string:'Directory of project (fileOuts will go there):'). |
297 box title:(resources string:'PROJECT_DIRECTPORY') withCRs. |
311 (d := myProject directory) notNil ifTrue:[ |
298 (d := myProject directory) notNil ifTrue:[ |
312 box initialText:d |
299 box initialText:d |
313 ]. |
300 ]. |
314 box action:[:dirName | |
301 box action:[:dirName | |
315 (OperatingSystem isDirectory:dirName) ifFalse:[ |
302 (OperatingSystem isDirectory:dirName) ifFalse:[ |
316 (OperatingSystem isValidPath:dirName) ifTrue:[ |
303 (OperatingSystem isValidPath:dirName) ifTrue:[ |
317 self warn:(resources string:'%1 is not a valid directory' with:dirName). |
304 self warn:(resources string:'%1 is not a valid directory' with:dirName). |
318 ^ self |
305 ^ self |
319 ]. |
306 ]. |
320 (self confirm:(resources string:'%1 does not exist\\create ?' with:dirName) withCRs) ifTrue:[ |
307 (self confirm:(resources string:'%1 does not exist\\create ?' with:dirName) withCRs) ifTrue:[ |
321 (OperatingSystem recursiveCreateDirectory:dirName) ifFalse:[ |
308 (OperatingSystem recursiveCreateDirectory:dirName) ifFalse:[ |
322 self warn:(resources string:'cannot create %1' with:dirName) |
309 self warn:(resources string:'cannot create %1' with:dirName) |
323 ] |
310 ] |
324 ]. |
311 ]. |
325 ]. |
312 ]. |
326 "did it work ?" |
313 "did it work ?" |
327 (OperatingSystem isDirectory:dirName) ifTrue:[ |
314 (OperatingSystem isDirectory:dirName) ifTrue:[ |
328 myProject directory:dirName |
315 myProject directory:dirName |
329 ]. |
316 ]. |
330 ]. |
317 ]. |
331 box showAtPointer |
318 box showAtPointer |
332 ! |
319 ! |
333 |
320 |
334 projectModule |
321 projectModule |
335 |box d| |
322 |box d| |
336 |
323 |
337 box := FilenameEnterBox new. |
324 box := FilenameEnterBox new. |
338 box directoriesOnly. |
325 box directoriesOnly. |
339 box title:(resources string:'Module in repository (new source containers / packages will go there):'). |
326 box title:(resources string:'PROJECT_MODULEDIR') withCRs. |
340 (d := myProject repositoryModule) notNil ifTrue:[ |
327 (d := myProject repositoryModule) notNil ifTrue:[ |
341 box initialText:d |
328 box initialText:d |
342 ]. |
329 ]. |
343 box action:[:dirName | |
330 box action:[:dirName | |
344 myProject repositoryModule:dirName |
331 myProject repositoryModule:dirName |
345 ]. |
332 ]. |
346 box showAtPointer |
333 box showAtPointer |
347 |
334 |
348 "Created: 25.11.1995 / 18:07:51 / cg" |
335 "Created: 25.11.1995 / 18:07:51 / cg" |
349 "Modified: 10.12.1995 / 00:01:25 / cg" |
336 "Modified: 10.12.1995 / 00:01:25 / cg" |
350 ! |
337 ! |
351 |
338 |
352 projectPackage |
339 projectPackage |
353 self topView withWaitCursorDo:[ |
340 self topView withWaitCursorDo:[ |
354 |box p existingPackages allClasses| |
341 |box p existingPackages allClasses| |
355 |
342 |
356 existingPackages := Set new. |
343 existingPackages := Set new. |
357 (allClasses := Smalltalk allClasses) do:[:aClass | |
344 (allClasses := Smalltalk allClasses) do:[:aClass | |
358 |p| |
345 |p| |
359 |
346 |
360 (p := aClass package) notNil ifTrue:[ |
347 (p := aClass package) notNil ifTrue:[ |
361 existingPackages add:(p asString) |
348 existingPackages add:(p asString) |
362 ]. |
349 ]. |
363 aClass methodArray do:[:aMethod | |
350 aClass methodArray do:[:aMethod | |
364 (p := aMethod package) notNil ifTrue:[ |
351 (p := aMethod package) notNil ifTrue:[ |
365 existingPackages add:(p asString) |
352 existingPackages add:(p asString) |
366 ] |
353 ] |
367 ]. |
354 ]. |
368 aClass class methodArray do:[:aMethod | |
355 aClass class methodArray do:[:aMethod | |
369 (p := aMethod package) notNil ifTrue:[ |
356 (p := aMethod package) notNil ifTrue:[ |
370 existingPackages add:(p asString) |
357 existingPackages add:(p asString) |
371 ] |
358 ] |
372 ]. |
359 ]. |
373 ]. |
360 ]. |
374 |
361 |
375 box := ListSelectionBox title:'Package (new classes/methods will be put into that):'. |
362 box := ListSelectionBox title:(resources string:'PROJECT_PACKAGENAME') withCRs. |
376 box list:(existingPackages asOrderedCollection sort). |
363 box list:(existingPackages asOrderedCollection sort). |
377 (p := myProject packageName) notNil ifTrue:[ |
364 (p := myProject packageName) notNil ifTrue:[ |
378 box initialText:p |
365 box initialText:p |
379 ]. |
366 ]. |
380 box action:[:packageName | |
367 box action:[:packageName | |
381 |someClass module directory| |
368 |someClass module directory| |
382 |
369 |
383 "/ (try) to extract the module & repository directory from someClass which |
370 "/ (try) to extract the module & repository directory from someClass which |
384 "/ is already contained in that package |
371 "/ is already contained in that package |
385 |
372 |
386 Smalltalk allClasses |
373 Smalltalk allClasses |
387 detect:[:cls | |
374 detect:[:cls | |
388 |info| |
375 |info| |
389 |
376 |
390 (cls package = packageName) ifTrue:[ |
377 (cls package = packageName) ifTrue:[ |
391 (info := cls packageSourceCodeInfo) notNil ifTrue:[ |
378 (info := cls packageSourceCodeInfo) notNil ifTrue:[ |
392 module := info at:#module ifAbsent:nil. |
379 module := info at:#module ifAbsent:nil. |
393 directory := info at:#directory ifAbsent:nil. |
380 directory := info at:#directory ifAbsent:nil. |
394 ] |
381 ] |
395 ]. |
382 ]. |
396 module notNil and:[directory notNil]. |
383 module notNil and:[directory notNil]. |
397 ] |
384 ] |
398 ifNone:nil. |
385 ifNone:nil. |
399 |
386 |
400 module notNil ifTrue:[ |
387 module notNil ifTrue:[ |
401 myProject repositoryModule:module |
388 myProject repositoryModule:module |
402 ]. |
389 ]. |
403 directory notNil ifTrue:[ |
390 directory notNil ifTrue:[ |
404 myProject repositoryDirectory:directory |
391 myProject repositoryDirectory:directory |
405 ]. |
392 ]. |
406 myProject packageName:packageName. |
393 myProject packageName:packageName. |
407 |
394 |
408 ]. |
395 ]. |
409 box showAtPointer |
396 box showAtPointer |
410 ] |
397 ] |
411 |
398 |
412 "Created: 9.12.1995 / 16:50:45 / cg" |
399 "Created: 9.12.1995 / 16:50:45 / cg" |
413 "Modified: 10.12.1995 / 00:10:04 / cg" |
400 "Modified: 10.12.1995 / 00:10:04 / cg" |
414 ! |
401 ! |
440 |
427 |
441 |classesToRemove methodsToRemove theProject| |
428 |classesToRemove methodsToRemove theProject| |
442 |
429 |
443 (myProject isNil |
430 (myProject isNil |
444 or:[(theProject := myProject packageName) isNil]) ifTrue:[ |
431 or:[(theProject := myProject packageName) isNil]) ifTrue:[ |
445 self warn:'No current package'. |
432 self warn:(resources string:'No current package.'). |
446 ^ self |
433 ^ self |
447 ]. |
434 ]. |
448 |
435 |
449 classesToRemove := IdentitySet new. |
436 classesToRemove := IdentitySet new. |
450 methodsToRemove := IdentitySet new. |
437 methodsToRemove := IdentitySet new. |
451 |
438 |
452 Smalltalk allClassesDo:[:aClass | |
439 Smalltalk allClassesDo:[:aClass | |
453 |p| |
440 |p| |
454 |
441 |
455 (p := aClass package) notNil ifTrue:[ |
442 (p := aClass package) notNil ifTrue:[ |
456 p = theProject ifTrue:[ |
443 p = theProject ifTrue:[ |
457 classesToRemove add:aClass |
444 classesToRemove add:aClass |
458 ] |
445 ] |
459 ]. |
446 ]. |
460 ]. |
447 ]. |
461 Smalltalk allClassesDo:[:aClass | |
448 Smalltalk allClassesDo:[:aClass | |
462 |p| |
449 |p| |
463 |
450 |
464 (classesToRemove includes:aClass) ifFalse:[ |
451 (classesToRemove includes:aClass) ifFalse:[ |
465 aClass methodArray do:[:aMethod | |
452 aClass methodArray do:[:aMethod | |
466 (p := aMethod package) notNil ifTrue:[ |
453 (p := aMethod package) notNil ifTrue:[ |
467 p = theProject ifTrue:[ |
454 p = theProject ifTrue:[ |
468 methodsToRemove add:aMethod |
455 methodsToRemove add:aMethod |
469 ] |
456 ] |
470 ] |
457 ] |
471 ]. |
458 ]. |
472 aClass class methodArray do:[:aMethod | |
459 aClass class methodArray do:[:aMethod | |
473 (p := aMethod package) notNil ifTrue:[ |
460 (p := aMethod package) notNil ifTrue:[ |
474 p = theProject ifTrue:[ |
461 p = theProject ifTrue:[ |
475 methodsToRemove add:aMethod |
462 methodsToRemove add:aMethod |
476 ] |
463 ] |
477 ] |
464 ] |
478 ]. |
465 ]. |
479 ]. |
466 ]. |
480 ]. |
467 ]. |
481 |
468 |
482 (classesToRemove isEmpty |
469 (classesToRemove isEmpty |
483 and:[methodsToRemove isEmpty]) ifTrue:[ |
470 and:[methodsToRemove isEmpty]) ifTrue:[ |
484 self warn:('Nothing found in ' , theProject). |
471 self warn:(resources string:'No classes or methods found in %1' with:theProject). |
485 ^ self |
472 ^ self |
486 ]. |
473 ]. |
487 |
474 |
488 (self confirm:('About to remove ' |
475 (self confirm:(resources |
489 , classesToRemove size printString |
476 string:'About to remove %1 classes and %2 additional methods.\\Are you certain you want this ?' |
490 , ' classes and ' |
477 with:classesToRemove size printString |
491 , methodsToRemove size printString |
478 with:methodsToRemove size printString) withCRs) |
492 , ' additional methods.\\Are you certain you want this ?') withCRs) |
479 ifTrue:[ |
493 ifTrue:[ |
480 classesToRemove do:[:aClass | |
494 classesToRemove do:[:aClass | |
481 ('PROJECT: removing ' , aClass name) infoPrintNL. |
495 ('PROJECT: removing ' , aClass name) infoPrintNL. |
482 Smalltalk removeClass:aClass. |
496 Smalltalk removeClass:aClass. |
483 ]. |
497 ]. |
484 methodsToRemove do:[:aMethod | |
498 methodsToRemove do:[:aMethod | |
485 |where| |
499 |where| |
486 |
500 |
487 ('PROJECT: removing ' , aMethod displayString) infoPrintNL. |
501 ('PROJECT: removing ' , aMethod displayString) infoPrintNL. |
488 where := aMethod who. |
502 where := aMethod who. |
489 where isNil ifTrue:[ |
503 where isNil ifTrue:[ |
490 'PROJECT: oops, some method is gone' infoPrintNL. |
504 'PROJECT: oops, some method is gone' infoPrintNL. |
491 ] ifFalse:[ |
505 ] ifFalse:[ |
492 (where at:1) removeSelector:(where at:2) |
506 (where at:1) removeSelector:(where at:2) |
493 ] |
507 ] |
494 ] |
508 ] |
|
509 ]. |
495 ]. |
510 ! |
496 ! |
511 |
497 |
512 renameProject |
498 renameProject |
513 |box| |
499 |box| |
514 |
500 |
515 box := EnterBox new. |
501 box := EnterBox new. |
516 box title:'new name of project:'. |
502 box title:(resources string:'new name of project:'). |
517 box okText:'rename'. |
503 box okText:(resources string:'rename'). |
518 box initialText:(myProject name). |
504 box initialText:(myProject name). |
519 box action:[:newName | |
505 box action:[:newName | |
520 myProject name:newName. |
506 myProject name:newName. |
521 self setProject:myProject. |
507 self setProject:myProject. |
522 self windowGroup process name:'Project: ' , newName. |
508 self windowGroup process name:'Project: ' , newName. |
523 ]. |
509 ]. |
524 box showAtPointer |
510 box showAtPointer |
|
511 |
|
512 "Modified: 12.12.1995 / 16:22:48 / cg" |
525 ! |
513 ! |
526 |
514 |
527 saveProjectFiles |
515 saveProjectFiles |
528 self topView withWaitCursorDo:[ |
516 self topView withWaitCursorDo:[ |
529 |dir| |
517 |dir| |