author | Claus Gittinger <cg@exept.de> |
Tue, 05 Sep 2006 18:45:29 +0200 | |
changeset 7089 | d42742476329 |
parent 2653 | c8b1c4d0b9af |
child 7603 | b4ae9e305bb7 |
permissions | -rw-r--r-- |
88 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
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 |
||
7089 | 13 |
"{ Package: 'stx:libtool' }" |
14 |
||
0 | 15 |
StandardSystemView subclass:#ProjectView |
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
16 |
instanceVariableNames:'myProject toggle' |
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
17 |
classVariableNames:'ActiveProjectView' |
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
18 |
poolDictionaries:'' |
7089 | 19 |
category:'Interface-Tools' |
0 | 20 |
! |
21 |
||
796
b8edcbceaa18
XtHTML is no longer there ...
Claus Gittinger <cg@exept.de>
parents:
692
diff
changeset
|
22 |
!ProjectView class methodsFor:'documentation'! |
88 | 23 |
|
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
272 | 36 |
! |
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
ProjectViews basically offer two functionalities: |
|
41 |
||
42 |
- keep a group of windows in order to organize the desktop |
|
1348 | 43 |
(I am not sure, if this is really a useful feature, now that we |
44 |
have modern windowManagers which have multiple desktops as well). |
|
272 | 45 |
|
1348 | 46 |
All views as created while a project is active are remembered |
47 |
and can be hidden/shown altogether. |
|
48 |
(this has nothing to do with windowGroups) |
|
272 | 49 |
|
1348 | 50 |
Also, it is possible to close down all those windows (by destroying the project). |
272 | 51 |
|
52 |
- keep defaults for various system activities: |
|
1348 | 53 |
- the fileOut directory (i.e. where the SystemBrowser creates fileOut sources) |
272 | 54 |
|
1348 | 55 |
- keep the source module/package |
56 |
thats the default offered when classes are checkedIn the very first time |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
57 |
|
1348 | 58 |
- keep a default package-identifier assigned when classes/methods are created/modified. |
59 |
thats mostly useful to browse all classes/methods that have been touched |
|
60 |
in a projects context |
|
272 | 61 |
|
1348 | 62 |
- keep a per-project changeList |
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
63 |
|
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
64 |
- allow opening a browser on all classes/methods which were created or modified |
1348 | 65 |
while a project was active. |
272 | 66 |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
67 |
- allow opening a browser on this projects changeList (which contains the subset of changes |
1348 | 68 |
which were done while this project was active) |
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
69 |
|
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
70 |
- allow removal of all classes/methods which have the current projects packageIdentifier |
955 | 71 |
|
72 |
[author:] |
|
1348 | 73 |
Claus Gittinger |
955 | 74 |
|
75 |
[see also:] |
|
1348 | 76 |
Project |
2653 | 77 |
NameSpace |
1348 | 78 |
CVSSourceCodemanager |
272 | 79 |
" |
955 | 80 |
|
88 | 81 |
! ! |
82 |
||
796
b8edcbceaa18
XtHTML is no longer there ...
Claus Gittinger <cg@exept.de>
parents:
692
diff
changeset
|
83 |
!ProjectView class methodsFor:'instance creation'! |
0 | 84 |
|
85 |
for:aProject |
|
955 | 86 |
"create & open a new projectView on some project" |
87 |
||
0 | 88 |
|newView| |
89 |
||
90 |
newView := super new. |
|
91 |
newView setProject:aProject. |
|
92 |
^ newView |
|
93 |
||
955 | 94 |
" |
95 |
ProjectView for:(Project new) |
|
96 |
" |
|
97 |
||
98 |
"Modified: 14.2.1997 / 13:46:07 / cg" |
|
0 | 99 |
! ! |
100 |
||
2118 | 101 |
!ProjectView methodsFor:'initialize / release'! |
217 | 102 |
|
103 |
addToCurrentProject |
|
955 | 104 |
"add this view to the current projects set of views. |
105 |
Ignored here - ProjectViews are global." |
|
217 | 106 |
|
107 |
^ self |
|
955 | 108 |
|
109 |
"Modified: 14.2.1997 / 13:35:58 / cg" |
|
217 | 110 |
! |
111 |
||
2118 | 112 |
destroy |
113 |
"Let user confirm, then close all of my views, and get rid of the changeList. |
|
114 |
However, methods and classes are not restored to their |
|
115 |
previous state." |
|
116 |
||
117 |
|views| |
|
118 |
||
119 |
myProject notNil ifTrue:[ |
|
120 |
views := myProject views. |
|
121 |
(views size > 0) ifTrue:[ |
|
122 |
|box| |
|
123 |
||
124 |
box := YesNoBox new. |
|
125 |
box title:(resources string:'PROJECT_DESTROY') withCRs. |
|
126 |
box okText:(resources string:'yes'). |
|
127 |
(box confirm) ifFalse:[^ self] |
|
128 |
]. |
|
129 |
]. |
|
130 |
self doDestroy |
|
131 |
||
132 |
"Modified: 14.2.1997 / 13:39:03 / cg" |
|
133 |
! |
|
134 |
||
217 | 135 |
initialize |
136 |
super initialize. |
|
137 |
||
138 |
"/ |
|
139 |
"/ create the toggle ... |
|
140 |
"/ |
|
141 |
toggle := Toggle in:self. |
|
142 |
toggle borderWidth:0. |
|
143 |
toggle pressAction:[self showProject]. |
|
144 |
toggle releaseAction:[self hideProject]. |
|
145 |
||
146 |
"/ |
|
147 |
"/ and give it a menu |
|
148 |
"/ |
|
149 |
||
1001 | 150 |
toggle menuHolder:self; menuMessage:#projectMenu. |
217 | 151 |
|
152 |
"Created: 25.11.1995 / 18:06:32 / cg" |
|
1001 | 153 |
"Modified: 27.1.1997 / 11:53:18 / cg" |
217 | 154 |
! |
155 |
||
1001 | 156 |
projectMenu |
157 |
"return a popUpMenu" |
|
158 |
||
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
159 |
|labels selectors m| |
217 | 160 |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
161 |
labels := #( |
1468 | 162 |
'class documentation' |
163 |
'-' |
|
164 |
'show' |
|
165 |
'hide' |
|
166 |
'-' |
|
167 |
'changes' |
|
168 |
'browse' |
|
169 |
'browse redefined' |
|
170 |
'fileOut classes' |
|
171 |
'-' |
|
172 |
'fileOut directory ...' |
|
173 |
'repository defaults ...' |
|
174 |
'package name ...' |
|
175 |
'default nameSpace for fileIn ...' |
|
217 | 176 |
"/ '-' |
177 |
"/ 'save project code' |
|
178 |
"/ 'build' |
|
1468 | 179 |
'-' |
180 |
'remove package code' |
|
181 |
'remove project' |
|
182 |
'-' |
|
183 |
'rename ...' |
|
184 |
). |
|
217 | 185 |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
186 |
selectors := #( |
1468 | 187 |
showClassDocumentation |
188 |
nil |
|
189 |
showProject |
|
190 |
hideProject |
|
191 |
nil |
|
192 |
browseChanges |
|
193 |
browsePackage |
|
194 |
browseRedefined |
|
195 |
fileOutClasses |
|
196 |
nil |
|
197 |
projectDirectory |
|
198 |
projectRepositoryAndModule |
|
199 |
projectPackage |
|
200 |
projectNameSpace |
|
217 | 201 |
"/ nil |
202 |
"/ saveProjectFiles |
|
203 |
"/ buildProject |
|
1468 | 204 |
nil |
205 |
removePackage |
|
206 |
destroy |
|
207 |
nil |
|
208 |
renameProject |
|
209 |
). |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
210 |
|
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
211 |
m := PopUpMenu |
1468 | 212 |
labels:(resources array:labels) |
213 |
selectors:selectors |
|
214 |
receiver:self. |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
215 |
|
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
216 |
SourceCodeManager isNil ifTrue:[ |
1468 | 217 |
m disableAll:#(#projectRepository #projectRepositoryAndModule). |
217 | 218 |
]. |
219 |
||
1001 | 220 |
^ m |
217 | 221 |
|
1468 | 222 |
"Created: / 27.1.1997 / 11:53:30 / cg" |
223 |
"Modified: / 6.2.1998 / 12:57:21 / cg" |
|
217 | 224 |
! ! |
225 |
||
57 | 226 |
!ProjectView methodsFor:'menu actions'! |
227 |
||
228 |
browseChanges |
|
955 | 229 |
"open a changeBrowser showing all changes made in this project |
230 |
(i.e. while this project was the active project)" |
|
231 |
||
232 |
|changes b| |
|
233 |
||
234 |
changes := myProject changeSet. |
|
235 |
changes size == 0 ifTrue:[ |
|
1348 | 236 |
self warn:(resources string:'no changes made in this project (yet)'). |
237 |
^ self |
|
955 | 238 |
]. |
57 | 239 |
|
240 |
b := ChangeSetBrowser openOn:(myProject changeSet). |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
241 |
b label:(resources string:'Changes in %1' with:myProject name) |
955 | 242 |
|
243 |
"Modified: 14.2.1997 / 13:36:40 / cg" |
|
57 | 244 |
! |
245 |
||
246 |
browsePackage |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
247 |
"launch browsers for all classes/methods which are defined in this package |
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
248 |
(i.e. whose packageIdentifier is the same as my Projects packageIdentifier)" |
57 | 249 |
|
250 |
self topView withWaitCursorDo:[ |
|
2575 | 251 |
|classes packageName methods methodList anyClasses anyMethods ignoredClasses| |
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
252 |
|
2575 | 253 |
anyMethods := anyClasses := false. |
57 | 254 |
|
2575 | 255 |
packageName := myProject package. |
256 |
classes := myProject classes. |
|
257 |
(classes notNil and:[classes notEmpty]) ifTrue:[ |
|
258 |
anyClasses := true. |
|
259 |
]. |
|
57 | 260 |
|
2575 | 261 |
methods := myProject individualMethods. |
262 |
methods notEmpty ifTrue:[ |
|
263 |
anyMethods := true. |
|
264 |
SystemBrowser browseMethods:methods |
|
265 |
title:(resources string:'individual methods in package %1' with:packageName). |
|
266 |
]. |
|
267 |
anyClasses ifTrue:[ |
|
268 |
SystemBrowser browseClasses:classes |
|
269 |
title:(resources string:'classes in package %1' with:packageName). |
|
270 |
]. |
|
271 |
(anyClasses or:[anyMethods]) ifFalse:[ |
|
272 |
self information:(resources string:'no classes or methods in this project (yet)') |
|
273 |
] |
|
57 | 274 |
] |
265 | 275 |
|
276 |
"Created: 10.12.1995 / 00:08:58 / cg" |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
277 |
"Modified: 12.12.1995 / 16:35:07 / cg" |
57 | 278 |
! |
279 |
||
217 | 280 |
browseProps |
955 | 281 |
"show the projects properties. |
282 |
This is not yet finished ... |
|
283 |
... and will look better, once property inspector runs ..." |
|
217 | 284 |
|
285 |
myProject properties inspect |
|
955 | 286 |
|
287 |
"Modified: 14.2.1997 / 13:37:15 / cg" |
|
217 | 288 |
! |
289 |
||
1001 | 290 |
browseRedefined |
291 |
"launch browsers for all redefined methods. |
|
292 |
Thats methods which existed before and were redefined by package methods" |
|
293 |
||
294 |
self topView withWaitCursorDo:[ |
|
1348 | 295 |
|redefined methods| |
1001 | 296 |
|
1348 | 297 |
redefined := myProject overwrittenMethods. |
298 |
redefined notNil ifTrue:[ |
|
299 |
methods := redefined values. |
|
300 |
]. |
|
301 |
methods size > 0 ifTrue:[ |
|
302 |
SystemBrowser browseMethods:methods |
|
303 |
title:(resources string:'redefined methods in package %1' with:myProject packageName). |
|
304 |
] ifFalse:[ |
|
305 |
self information:(resources string:'no redefined methods in this project (yet)') |
|
306 |
] |
|
1001 | 307 |
] |
308 |
||
309 |
"Created: 27.1.1997 / 11:57:03 / cg" |
|
310 |
"Modified: 27.1.1997 / 11:58:06 / cg" |
|
311 |
! |
|
312 |
||
217 | 313 |
buildProject |
955 | 314 |
"build the project; this is not yet finished ... |
315 |
... and will eventually create all sources, makefile and |
|
316 |
build what is to be built: either a classLibrary or an application" |
|
317 |
||
217 | 318 |
self topView withWaitCursorDo:[ |
1348 | 319 |
|dir| |
217 | 320 |
|
1348 | 321 |
self saveProjectFiles. |
322 |
(self confirm:'make object files in: ' , dir , ' ?') ifTrue:[ |
|
323 |
myProject buildProject. |
|
324 |
] |
|
217 | 325 |
]. |
955 | 326 |
|
327 |
"Modified: 14.2.1997 / 13:38:06 / cg" |
|
217 | 328 |
! |
329 |
||
330 |
doDestroy |
|
955 | 331 |
"close all of my views, and get rid of the changeList. |
332 |
However, methods and classes are not restored to their |
|
333 |
previous state. |
|
334 |
No confiramtion here." |
|
335 |
||
217 | 336 |
self hideProject. |
337 |
myProject := nil. |
|
338 |
super destroy |
|
955 | 339 |
|
340 |
"Modified: 14.2.1997 / 13:39:18 / cg" |
|
217 | 341 |
! |
342 |
||
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
343 |
fileOutClasses |
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
344 |
"fileout all classes belonging to that package. |
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
345 |
CAVEAT: individual methods are not yet supported." |
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
346 |
|
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
347 |
self topView withWaitCursorDo:[ |
1348 | 348 |
|classes packageName methods methodList anyClasses anyMethods ignoredClasses| |
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
349 |
|
1348 | 350 |
anyMethods := anyClasses := false. |
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
351 |
|
1348 | 352 |
packageName := myProject packageName. |
353 |
classes := myProject classes. |
|
354 |
(classes notNil and:[classes notEmpty]) ifTrue:[ |
|
355 |
anyClasses := true. |
|
356 |
]. |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
357 |
|
1348 | 358 |
methods := myProject individualMethods. |
359 |
methods notEmpty ifTrue:[ |
|
360 |
anyMethods := true. |
|
361 |
self warn:'individual methods are currently not handled' |
|
362 |
]. |
|
363 |
anyClasses ifTrue:[ |
|
364 |
classes do:[:aClass | |
|
365 |
Transcript showCR:'fileOut: ' , aClass name , ' ...'. |
|
366 |
aClass fileOut |
|
367 |
]. |
|
368 |
]. |
|
369 |
(anyClasses or:[anyMethods]) ifFalse:[ |
|
370 |
self information:(resources string:'no classes or methods in this project (yet)') |
|
371 |
] |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
372 |
] |
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
373 |
|
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
374 |
"Created: 11.4.1996 / 19:29:50 / cg" |
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
375 |
! |
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
376 |
|
217 | 377 |
hideProject |
955 | 378 |
"hide all views belonging to that project and switch |
379 |
to the default project" |
|
380 |
||
1980 | 381 |
myProject notNil ifTrue:[ |
382 |
myProject hideViews. |
|
383 |
]. |
|
217 | 384 |
ActiveProjectView := nil. |
385 |
toggle turnOff. |
|
386 |
Project setDefaultProject. |
|
955 | 387 |
|
388 |
"Modified: 14.2.1997 / 13:39:43 / cg" |
|
217 | 389 |
! |
390 |
||
57 | 391 |
projectDirectory |
955 | 392 |
"ask for the default directory, where fileOut will write |
393 |
its files. Will eventually also be the place, where makefiles |
|
394 |
and additional stuff is saved, for project building." |
|
395 |
||
57 | 396 |
|box d| |
397 |
||
398 |
box := FilenameEnterBox new. |
|
85 | 399 |
box directoriesOnly. |
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
400 |
box title:(resources string:'PROJECT_DIRECTPORY') withCRs. |
57 | 401 |
(d := myProject directory) notNil ifTrue:[ |
1348 | 402 |
box initialText:d |
57 | 403 |
]. |
404 |
box action:[:dirName | |
|
1348 | 405 |
(OperatingSystem isDirectory:dirName) ifFalse:[ |
406 |
(OperatingSystem isValidPath:dirName) ifTrue:[ |
|
407 |
self warn:(resources string:'%1 is not a valid directory' with:dirName). |
|
408 |
^ self |
|
409 |
]. |
|
410 |
(self confirm:(resources string:'%1 does not exist\\create ?' with:dirName) withCRs) ifTrue:[ |
|
411 |
(OperatingSystem recursiveCreateDirectory:dirName) ifFalse:[ |
|
412 |
self warn:(resources string:'cannot create %1' with:dirName) |
|
413 |
] |
|
414 |
]. |
|
415 |
]. |
|
416 |
"did it work ?" |
|
417 |
(OperatingSystem isDirectory:dirName) ifTrue:[ |
|
418 |
myProject directory:dirName |
|
419 |
]. |
|
57 | 420 |
]. |
421 |
box showAtPointer |
|
422 |
||
955 | 423 |
"Modified: 14.2.1997 / 13:44:59 / cg" |
265 | 424 |
! |
425 |
||
893 | 426 |
projectNameSpace |
955 | 427 |
"ask for the default nameSpace, into which new classes |
428 |
are loaded while this project is active. |
|
429 |
Useful before filing in alien code, to make certain that loaded |
|
430 |
classes do not conflict with existing ones ..." |
|
431 |
||
893 | 432 |
self topView withWaitCursorDo:[ |
2302 | 433 |
|box allNameSpaces| |
893 | 434 |
|
2653 | 435 |
allNameSpaces := (NameSpace allNamespaces |
2302 | 436 |
select:[:ns | ns isTopLevelNamespace]) |
437 |
collect:[:ns | ns name]. |
|
438 |
||
439 |
box := ListSelectionBox title:(resources string:'default nameSpace:') withCRs. |
|
440 |
box list:(allNameSpaces asOrderedCollection sort). |
|
441 |
box action:[:nsName | |
|
442 |
|ns| |
|
893 | 443 |
|
2302 | 444 |
"/ only create topLevel nameSpaces here |
963
3d9083fde09f
provide Smalltalk as homeNameSpace, when defining the projects
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
445 |
|
2302 | 446 |
Class nameSpaceQuerySignal |
447 |
answer:Smalltalk |
|
448 |
do:[ |
|
2653 | 449 |
ns := NameSpace name:nsName. |
2302 | 450 |
]. |
451 |
myProject defaultNameSpace:ns |
|
452 |
]. |
|
453 |
box showAtPointer |
|
893 | 454 |
] |
455 |
||
456 |
"Created: 9.12.1995 / 16:50:45 / cg" |
|
963
3d9083fde09f
provide Smalltalk as homeNameSpace, when defining the projects
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
457 |
"Modified: 16.1.1997 / 01:00:06 / cg" |
893 | 458 |
! |
459 |
||
57 | 460 |
projectPackage |
955 | 461 |
"ask for the package identifier of this project. |
462 |
New classes and methods get this identifier, to find them |
|
463 |
quickly later." |
|
464 |
||
57 | 465 |
self topView withWaitCursorDo:[ |
2108 | 466 |
|box p existingPackages allClasses| |
467 |
||
468 |
existingPackages := Set new. |
|
469 |
(allClasses := Smalltalk allClasses) do:[:aClass | |
|
470 |
|p| |
|
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
471 |
|
2653 | 472 |
(aClass isNameSpace |
2109 | 473 |
"/ or:[aClass isLoaded not] |
474 |
) ifFalse:[ |
|
2108 | 475 |
p := aClass package. |
476 |
p size == 0 ifTrue:[ |
|
477 |
p := 'no package'. |
|
478 |
]. |
|
479 |
existingPackages add:(p asString). |
|
57 | 480 |
|
2108 | 481 |
aClass methodDictionary do:[:aMethod | |
482 |
p := aMethod package. |
|
483 |
p size == 0 ifTrue:[ |
|
484 |
p := 'no package'. |
|
485 |
]. |
|
486 |
existingPackages add:(p asString). |
|
487 |
]. |
|
488 |
aClass class methodDictionary do:[:aMethod | |
|
489 |
p := aMethod package. |
|
490 |
p size == 0 ifTrue:[ |
|
491 |
p := 'no package'. |
|
492 |
]. |
|
493 |
existingPackages add:(p asString). |
|
494 |
]. |
|
2109 | 495 |
]. |
2108 | 496 |
]. |
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
497 |
|
2108 | 498 |
box := ListSelectionBox title:(resources string:'PROJECT_PACKAGENAME') withCRs. |
499 |
box list:(existingPackages asOrderedCollection sort). |
|
2533 | 500 |
(p := myProject package) notNil ifTrue:[ |
2108 | 501 |
box initialText:p |
502 |
]. |
|
503 |
box action:[:packageName | |
|
504 |
|someClass module directory| |
|
57 | 505 |
|
2108 | 506 |
"/ (try) to extract the module & repository directory from someClass which |
507 |
"/ is already contained in that package |
|
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
508 |
|
2108 | 509 |
Smalltalk allClasses |
510 |
detect:[:cls | |
|
511 |
|info| |
|
57 | 512 |
|
2108 | 513 |
(cls package = packageName) ifTrue:[ |
514 |
(info := cls packageSourceCodeInfo) notNil ifTrue:[ |
|
515 |
module := info at:#module ifAbsent:nil. |
|
516 |
directory := info at:#directory ifAbsent:nil. |
|
517 |
] |
|
518 |
]. |
|
519 |
module notNil and:[directory notNil]. |
|
520 |
] |
|
521 |
ifNone:nil. |
|
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
522 |
|
2108 | 523 |
module notNil ifTrue:[ |
524 |
myProject repositoryModule:module |
|
525 |
]. |
|
526 |
directory notNil ifTrue:[ |
|
527 |
myProject repositoryDirectory:directory |
|
528 |
]. |
|
529 |
myProject packageName:packageName. |
|
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
530 |
|
2108 | 531 |
]. |
532 |
box showAtPointer |
|
57 | 533 |
] |
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
534 |
|
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
535 |
"Created: 9.12.1995 / 16:50:45 / cg" |
1326 | 536 |
"Modified: 19.9.1997 / 10:55:19 / cg" |
110 | 537 |
! |
57 | 538 |
|
955 | 539 |
projectRepositoryAndModule |
540 |
"ask for a default module and package directory. |
|
541 |
This is offered as default, when new containers are |
|
542 |
created. However, when creating, these can still be changed" |
|
543 |
||
1490 | 544 |
|box moduleHolder dirHolder| |
955 | 545 |
|
546 |
box := DialogBox new. |
|
547 |
(box addTextLabel:(resources string:'PROJECT_MODULEANDDIR') withCRs) |
|
1348 | 548 |
adjust:#left. |
955 | 549 |
box addHorizontalLine. |
550 |
||
551 |
moduleHolder := myProject repositoryModule asValue. |
|
552 |
dirHolder := myProject repositoryDirectory asValue. |
|
553 |
||
554 |
(box addTextLabel:(resources string:'PROJECT_MODULEDIR') withCRs) |
|
1348 | 555 |
adjust:#left. |
955 | 556 |
box addFilenameInputFieldOn:moduleHolder in:nil tabable:true. |
217 | 557 |
|
1490 | 558 |
box addVerticalSpace; addHorizontalLine; addVerticalSpace. |
955 | 559 |
|
560 |
(box addTextLabel:(resources string:'PROJECT_PACKAGEDIR') withCRs) |
|
1348 | 561 |
adjust:#left. |
955 | 562 |
box addFilenameInputFieldOn:dirHolder in:nil tabable:true. |
563 |
||
564 |
box addAbortButton; addOkButton. |
|
565 |
box showAtPointer. |
|
566 |
||
567 |
box accepted ifTrue:[ |
|
1348 | 568 |
myProject repositoryModule:moduleHolder value. |
569 |
myProject repositoryDirectory:dirHolder value. |
|
217 | 570 |
]. |
571 |
||
955 | 572 |
box destroy. |
573 |
||
574 |
"Modified: 14.2.1997 / 13:42:05 / cg" |
|
217 | 575 |
! |
576 |
||
110 | 577 |
removePackage |
578 |
"remove all classes and individual methods from the system. |
|
579 |
Currently, this cannot fully restore the state to before |
|
580 |
the time the package was loaded (redefined methods are lost). |
|
581 |
In the future, we may keep a backref of overwritten methods |
|
582 |
and restore them from their source ..." |
|
57 | 583 |
|
110 | 584 |
|classesToRemove methodsToRemove theProject| |
585 |
||
586 |
(myProject isNil |
|
587 |
or:[(theProject := myProject packageName) isNil]) ifTrue:[ |
|
1348 | 588 |
self warn:(resources string:'No current package.'). |
589 |
^ self |
|
110 | 590 |
]. |
591 |
||
592 |
classesToRemove := IdentitySet new. |
|
593 |
methodsToRemove := IdentitySet new. |
|
594 |
||
595 |
Smalltalk allClassesDo:[:aClass | |
|
1348 | 596 |
|p| |
110 | 597 |
|
1348 | 598 |
(p := aClass package) notNil ifTrue:[ |
599 |
p = theProject ifTrue:[ |
|
600 |
classesToRemove add:aClass |
|
601 |
] |
|
602 |
]. |
|
110 | 603 |
]. |
604 |
Smalltalk allClassesDo:[:aClass | |
|
1348 | 605 |
|p| |
110 | 606 |
|
1348 | 607 |
(classesToRemove includes:aClass) ifFalse:[ |
608 |
aClass methodDictionary keysAndValuesDo:[:sel :aMethod | |
|
609 |
(p := aMethod package) notNil ifTrue:[ |
|
610 |
p = theProject ifTrue:[ |
|
611 |
methodsToRemove add:aMethod |
|
612 |
] |
|
613 |
] |
|
614 |
]. |
|
615 |
aClass class methodDictionary keysAndValuesDo:[:sel :aMethod | |
|
616 |
(p := aMethod package) notNil ifTrue:[ |
|
617 |
p = theProject ifTrue:[ |
|
618 |
methodsToRemove add:aMethod |
|
619 |
] |
|
620 |
] |
|
621 |
]. |
|
622 |
]. |
|
110 | 623 |
]. |
624 |
||
625 |
(classesToRemove isEmpty |
|
626 |
and:[methodsToRemove isEmpty]) ifTrue:[ |
|
1348 | 627 |
self warn:(resources string:'No classes or methods found in %1' with:theProject). |
628 |
^ self |
|
110 | 629 |
]. |
630 |
||
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
631 |
(self confirm:(resources |
1348 | 632 |
string:'About to remove %1 classes and %2 additional methods.\\Are you certain you want this ?' |
633 |
with:classesToRemove size |
|
634 |
with:methodsToRemove size) withCRs) |
|
635 |
ifTrue:[ |
|
636 |
classesToRemove do:[:aClass | |
|
637 |
('PROJECT: removing ' , aClass name) infoPrintNL. |
|
638 |
Smalltalk removeClass:aClass. |
|
639 |
]. |
|
640 |
methodsToRemove do:[:aMethod | |
|
641 |
|where| |
|
110 | 642 |
|
1348 | 643 |
('PROJECT: removing ' , aMethod displayString) infoPrintNL. |
644 |
where := aMethod who. |
|
645 |
where isNil ifTrue:[ |
|
646 |
'PROJECT: oops, some method is gone' infoPrintNL. |
|
647 |
] ifFalse:[ |
|
648 |
(where at:1) removeSelector:(where at:2) |
|
649 |
] |
|
650 |
] |
|
110 | 651 |
]. |
57 | 652 |
! |
653 |
||
654 |
renameProject |
|
955 | 655 |
"give that project another name - has no semantic meaning, |
656 |
and does not affect any class/method" |
|
657 |
||
57 | 658 |
|box| |
659 |
||
660 |
box := EnterBox new. |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
661 |
box title:(resources string:'new name of project:'). |
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
662 |
box okText:(resources string:'rename'). |
57 | 663 |
box initialText:(myProject name). |
664 |
box action:[:newName | |
|
1348 | 665 |
myProject name:newName. |
666 |
self setProject:myProject. |
|
667 |
self windowGroup process name:'Project: ' , newName. |
|
57 | 668 |
]. |
669 |
box showAtPointer |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
670 |
|
955 | 671 |
"Modified: 14.2.1997 / 13:41:15 / cg" |
57 | 672 |
! |
673 |
||
217 | 674 |
saveProjectFiles |
955 | 675 |
"create the projects files. |
676 |
This is not yet finished." |
|
677 |
||
57 | 678 |
self topView withWaitCursorDo:[ |
1348 | 679 |
|dir| |
57 | 680 |
|
1348 | 681 |
dir := myProject directory. |
682 |
(self confirm:'create source files in: ' , dir , ' ?') ifTrue:[ |
|
683 |
myProject createProjectFiles. |
|
684 |
] |
|
57 | 685 |
]. |
955 | 686 |
|
687 |
"Modified: 14.2.1997 / 13:40:40 / cg" |
|
57 | 688 |
! |
689 |
||
513 | 690 |
showClassDocumentation |
691 |
"open a documentViewer on the projects classes documentation only" |
|
692 |
||
693 |
self topView withWaitCursorDo:[ |
|
1348 | 694 |
|classes packageName methods methodList anyClasses anyMethods |
695 |
html| |
|
513 | 696 |
|
1348 | 697 |
anyMethods := anyClasses := false. |
513 | 698 |
|
1348 | 699 |
packageName := myProject packageName. |
700 |
classes := myProject classes. |
|
701 |
(classes notNil and:[classes notEmpty]) ifTrue:[ |
|
702 |
anyClasses := true. |
|
703 |
]. |
|
704 |
(anyClasses or:[anyMethods]) ifFalse:[ |
|
705 |
self information:(resources string:'no classes or methods in this project (yet)'). |
|
706 |
^ self. |
|
707 |
]. |
|
513 | 708 |
|
1348 | 709 |
methods := myProject individualMethods. |
710 |
methods notEmpty ifTrue:[ |
|
711 |
anyMethods := true. |
|
712 |
"/ not yet shown ... |
|
713 |
]. |
|
513 | 714 |
|
1348 | 715 |
anyClasses ifFalse:[ ^ self]. |
513 | 716 |
|
1348 | 717 |
html := HTMLDocGenerator |
718 |
htmlClasses:classes |
|
719 |
title:'project classes' |
|
720 |
backTo:#none. |
|
513 | 721 |
|
1348 | 722 |
HTMLDocumentView openFullOnText:html |
513 | 723 |
] |
724 |
||
725 |
"Created: 11.4.1996 / 19:29:50 / cg" |
|
515 | 726 |
"Modified: 26.4.1996 / 17:48:33 / cg" |
513 | 727 |
! |
728 |
||
217 | 729 |
showProject |
955 | 730 |
"show all views belonging to that project and hide |
731 |
the active projects views (except for those opened before)" |
|
732 |
||
217 | 733 |
ActiveProjectView notNil ifTrue:[ |
1348 | 734 |
ActiveProjectView hideProject |
57 | 735 |
]. |
217 | 736 |
ActiveProjectView := self. |
110 | 737 |
|
217 | 738 |
myProject showViews. |
739 |
Project current:myProject. |
|
740 |
toggle turnOn |
|
955 | 741 |
|
742 |
"Modified: 14.2.1997 / 13:40:10 / cg" |
|
57 | 743 |
! ! |
744 |
||
0 | 745 |
!ProjectView methodsFor:'private accessing'! |
746 |
||
747 |
setProject:aProject |
|
748 |
|name e| |
|
749 |
||
750 |
name := aProject name. |
|
751 |
self label:name. |
|
17 | 752 |
self iconLabel:name. |
0 | 753 |
toggle label:'Project: ' , name. |
754 |
toggle resize. |
|
755 |
myProject := aProject. |
|
756 |
e := (toggle width @ toggle height). |
|
29 | 757 |
drawableId isNil ifTrue:[ |
1348 | 758 |
self minExtent:e. |
759 |
self maxExtent:e. |
|
760 |
self open |
|
29 | 761 |
] ifFalse:[ |
1348 | 762 |
self unmap. |
763 |
self minExtent:e. |
|
764 |
self maxExtent:e. |
|
765 |
self extent:e. |
|
766 |
self remap |
|
29 | 767 |
] |
0 | 768 |
! ! |
217 | 769 |
|
796
b8edcbceaa18
XtHTML is no longer there ...
Claus Gittinger <cg@exept.de>
parents:
692
diff
changeset
|
770 |
!ProjectView class methodsFor:'documentation'! |
217 | 771 |
|
772 |
version |
|
7089 | 773 |
^ '$Header: /cvs/stx/stx/libtool/ProjectView.st,v 1.51 2006-09-05 16:45:29 cg Exp $' |
515 | 774 |
! ! |