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