author | Claus Gittinger <cg@exept.de> |
Thu, 22 Apr 1999 16:09:57 +0200 | |
changeset 2108 | bb5caa5f014a |
parent 1980 | e7719fbe4293 |
child 2109 | a0fe5f821c3a |
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 |
75 |
Namespace |
|
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 |
||
217 | 99 |
!ProjectView methodsFor:'initialization'! |
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 |
||
110 |
initialize |
|
111 |
super initialize. |
|
112 |
||
113 |
"/ |
|
114 |
"/ create the toggle ... |
|
115 |
"/ |
|
116 |
toggle := Toggle in:self. |
|
117 |
toggle borderWidth:0. |
|
118 |
toggle pressAction:[self showProject]. |
|
119 |
toggle releaseAction:[self hideProject]. |
|
120 |
||
121 |
"/ |
|
122 |
"/ and give it a menu |
|
123 |
"/ |
|
124 |
||
1001 | 125 |
toggle menuHolder:self; menuMessage:#projectMenu. |
217 | 126 |
|
127 |
"Created: 25.11.1995 / 18:06:32 / cg" |
|
1001 | 128 |
"Modified: 27.1.1997 / 11:53:18 / cg" |
217 | 129 |
! |
130 |
||
1001 | 131 |
projectMenu |
132 |
"return a popUpMenu" |
|
133 |
||
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
134 |
|labels selectors m| |
217 | 135 |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
136 |
labels := #( |
1468 | 137 |
'class documentation' |
138 |
'-' |
|
139 |
'show' |
|
140 |
'hide' |
|
141 |
'-' |
|
142 |
'changes' |
|
143 |
'browse' |
|
144 |
'browse redefined' |
|
145 |
'fileOut classes' |
|
146 |
'-' |
|
147 |
'fileOut directory ...' |
|
148 |
'repository defaults ...' |
|
149 |
'package name ...' |
|
150 |
'default nameSpace for fileIn ...' |
|
217 | 151 |
"/ '-' |
152 |
"/ 'save project code' |
|
153 |
"/ 'build' |
|
1468 | 154 |
'-' |
155 |
'remove package code' |
|
156 |
'remove project' |
|
157 |
'-' |
|
158 |
'rename ...' |
|
159 |
). |
|
217 | 160 |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
161 |
selectors := #( |
1468 | 162 |
showClassDocumentation |
163 |
nil |
|
164 |
showProject |
|
165 |
hideProject |
|
166 |
nil |
|
167 |
browseChanges |
|
168 |
browsePackage |
|
169 |
browseRedefined |
|
170 |
fileOutClasses |
|
171 |
nil |
|
172 |
projectDirectory |
|
173 |
projectRepositoryAndModule |
|
174 |
projectPackage |
|
175 |
projectNameSpace |
|
217 | 176 |
"/ nil |
177 |
"/ saveProjectFiles |
|
178 |
"/ buildProject |
|
1468 | 179 |
nil |
180 |
removePackage |
|
181 |
destroy |
|
182 |
nil |
|
183 |
renameProject |
|
184 |
). |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
185 |
|
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
186 |
m := PopUpMenu |
1468 | 187 |
labels:(resources array:labels) |
188 |
selectors:selectors |
|
189 |
receiver:self. |
|
468
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
190 |
|
66637cf315a5
added fileOutClasses menu entry
Claus Gittinger <cg@exept.de>
parents:
278
diff
changeset
|
191 |
SourceCodeManager isNil ifTrue:[ |
1468 | 192 |
m disableAll:#(#projectRepository #projectRepositoryAndModule). |
217 | 193 |
]. |
194 |
||
1001 | 195 |
^ m |
217 | 196 |
|
1468 | 197 |
"Created: / 27.1.1997 / 11:53:30 / cg" |
198 |
"Modified: / 6.2.1998 / 12:57:21 / cg" |
|
217 | 199 |
! ! |
200 |
||
57 | 201 |
!ProjectView methodsFor:'menu actions'! |
202 |
||
203 |
browseChanges |
|
955 | 204 |
"open a changeBrowser showing all changes made in this project |
205 |
(i.e. while this project was the active project)" |
|
206 |
||
207 |
|changes b| |
|
208 |
||
209 |
changes := myProject changeSet. |
|
210 |
changes size == 0 ifTrue:[ |
|
1348 | 211 |
self warn:(resources string:'no changes made in this project (yet)'). |
212 |
^ self |
|
955 | 213 |
]. |
57 | 214 |
|
215 |
b := ChangeSetBrowser openOn:(myProject changeSet). |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
216 |
b label:(resources string:'Changes in %1' with:myProject name) |
955 | 217 |
|
218 |
"Modified: 14.2.1997 / 13:36:40 / cg" |
|
57 | 219 |
! |
220 |
||
221 |
browsePackage |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
222 |
"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
|
223 |
(i.e. whose packageIdentifier is the same as my Projects packageIdentifier)" |
57 | 224 |
|
225 |
self topView withWaitCursorDo:[ |
|
1348 | 226 |
|classes packageName methods methodList anyClasses anyMethods ignoredClasses| |
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
227 |
|
1348 | 228 |
anyMethods := anyClasses := false. |
57 | 229 |
|
1348 | 230 |
packageName := myProject packageName. |
231 |
classes := myProject classes. |
|
232 |
(classes notNil and:[classes notEmpty]) ifTrue:[ |
|
233 |
anyClasses := true. |
|
234 |
]. |
|
57 | 235 |
|
1348 | 236 |
methods := myProject individualMethods. |
237 |
methods notEmpty ifTrue:[ |
|
238 |
anyMethods := true. |
|
239 |
SystemBrowser browseMethods:methods |
|
240 |
title:(resources string:'individual methods in package %1' with:packageName). |
|
241 |
]. |
|
242 |
anyClasses ifTrue:[ |
|
243 |
SystemBrowser browseClasses:classes |
|
244 |
title:(resources string:'classes in package %1' with:packageName). |
|
245 |
]. |
|
246 |
(anyClasses or:[anyMethods]) ifFalse:[ |
|
247 |
self information:(resources string:'no classes or methods in this project (yet)') |
|
248 |
] |
|
57 | 249 |
] |
265 | 250 |
|
251 |
"Created: 10.12.1995 / 00:08:58 / cg" |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
252 |
"Modified: 12.12.1995 / 16:35:07 / cg" |
57 | 253 |
! |
254 |
||
217 | 255 |
browseProps |
955 | 256 |
"show the projects properties. |
257 |
This is not yet finished ... |
|
258 |
... and will look better, once property inspector runs ..." |
|
217 | 259 |
|
260 |
myProject properties inspect |
|
955 | 261 |
|
262 |
"Modified: 14.2.1997 / 13:37:15 / cg" |
|
217 | 263 |
! |
264 |
||
1001 | 265 |
browseRedefined |
266 |
"launch browsers for all redefined methods. |
|
267 |
Thats methods which existed before and were redefined by package methods" |
|
268 |
||
269 |
self topView withWaitCursorDo:[ |
|
1348 | 270 |
|redefined methods| |
1001 | 271 |
|
1348 | 272 |
redefined := myProject overwrittenMethods. |
273 |
redefined notNil ifTrue:[ |
|
274 |
methods := redefined values. |
|
275 |
]. |
|
276 |
methods size > 0 ifTrue:[ |
|
277 |
SystemBrowser browseMethods:methods |
|
278 |
title:(resources string:'redefined methods in package %1' with:myProject packageName). |
|
279 |
] ifFalse:[ |
|
280 |
self information:(resources string:'no redefined methods in this project (yet)') |
|
281 |
] |
|
1001 | 282 |
] |
283 |
||
284 |
"Created: 27.1.1997 / 11:57:03 / cg" |
|
285 |
"Modified: 27.1.1997 / 11:58:06 / cg" |
|
286 |
! |
|
287 |
||
217 | 288 |
buildProject |
955 | 289 |
"build the project; this is not yet finished ... |
290 |
... and will eventually create all sources, makefile and |
|
291 |
build what is to be built: either a classLibrary or an application" |
|
292 |
||
217 | 293 |
self topView withWaitCursorDo:[ |
1348 | 294 |
|dir| |
217 | 295 |
|
1348 | 296 |
self saveProjectFiles. |
297 |
(self confirm:'make object files in: ' , dir , ' ?') ifTrue:[ |
|
298 |
myProject buildProject. |
|
299 |
] |
|
217 | 300 |
]. |
955 | 301 |
|
302 |
"Modified: 14.2.1997 / 13:38:06 / cg" |
|
217 | 303 |
! |
304 |
||
305 |
destroy |
|
955 | 306 |
"Let user confirm, then close all of my views, and get rid of the changeList. |
307 |
However, methods and classes are not restored to their |
|
308 |
previous state." |
|
309 |
||
1980 | 310 |
|views| |
311 |
||
312 |
myProject notNil ifTrue:[ |
|
313 |
views := myProject views. |
|
314 |
(views size > 0) ifTrue:[ |
|
315 |
|box| |
|
217 | 316 |
|
1980 | 317 |
box := YesNoBox new. |
318 |
box title:(resources string:'PROJECT_DESTROY') withCRs. |
|
319 |
box okText:(resources string:'yes'). |
|
320 |
(box confirm) ifFalse:[^ self] |
|
321 |
]. |
|
217 | 322 |
]. |
323 |
self doDestroy |
|
324 |
||
955 | 325 |
"Modified: 14.2.1997 / 13:39:03 / 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:[ |
1348 | 431 |
|box allNameSpaces| |
893 | 432 |
|
1348 | 433 |
allNameSpaces := Namespace allNamespaces collect:[:ns | ns name]. |
893 | 434 |
|
1348 | 435 |
box := ListSelectionBox title:(resources string:'default nameSpace:') withCRs. |
436 |
box list:(allNameSpaces asOrderedCollection sort). |
|
437 |
box action:[:nsName | |
|
438 |
|ns| |
|
893 | 439 |
|
1348 | 440 |
"/ only create topLevel nameSpaces here |
963
3d9083fde09f
provide Smalltalk as homeNameSpace, when defining the projects
Claus Gittinger <cg@exept.de>
parents:
955
diff
changeset
|
441 |
|
1348 | 442 |
Class nameSpaceQuerySignal |
443 |
answer:Smalltalk |
|
444 |
do:[ |
|
445 |
ns := Namespace name:nsName. |
|
446 |
]. |
|
447 |
myProject defaultNameSpace:ns |
|
448 |
]. |
|
449 |
box showAtPointer |
|
893 | 450 |
] |
451 |
||
452 |
"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
|
453 |
"Modified: 16.1.1997 / 01:00:06 / cg" |
893 | 454 |
! |
455 |
||
57 | 456 |
projectPackage |
955 | 457 |
"ask for the package identifier of this project. |
458 |
New classes and methods get this identifier, to find them |
|
459 |
quickly later." |
|
460 |
||
57 | 461 |
self topView withWaitCursorDo:[ |
2108 | 462 |
|box p existingPackages allClasses| |
463 |
||
464 |
existingPackages := Set new. |
|
465 |
(allClasses := Smalltalk allClasses) do:[:aClass | |
|
466 |
|p| |
|
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
467 |
|
2108 | 468 |
"/ aClass isLoaded ifTrue:[ |
469 |
p := aClass package. |
|
470 |
p size == 0 ifTrue:[ |
|
471 |
p := 'no package'. |
|
472 |
]. |
|
473 |
existingPackages add:(p asString). |
|
57 | 474 |
|
2108 | 475 |
aClass methodDictionary do:[:aMethod | |
476 |
p := aMethod package. |
|
477 |
p size == 0 ifTrue:[ |
|
478 |
p := 'no package'. |
|
479 |
]. |
|
480 |
existingPackages add:(p asString). |
|
481 |
]. |
|
482 |
aClass class methodDictionary do:[:aMethod | |
|
483 |
p := aMethod package. |
|
484 |
p size == 0 ifTrue:[ |
|
485 |
p := 'no package'. |
|
486 |
]. |
|
487 |
existingPackages add:(p asString). |
|
488 |
]. |
|
489 |
"/ ] |
|
490 |
]. |
|
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
491 |
|
2108 | 492 |
box := ListSelectionBox title:(resources string:'PROJECT_PACKAGENAME') withCRs. |
493 |
box list:(existingPackages asOrderedCollection sort). |
|
494 |
(p := myProject packageName) notNil ifTrue:[ |
|
495 |
box initialText:p |
|
496 |
]. |
|
497 |
box action:[:packageName | |
|
498 |
|someClass module directory| |
|
57 | 499 |
|
2108 | 500 |
"/ (try) to extract the module & repository directory from someClass which |
501 |
"/ is already contained in that package |
|
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
502 |
|
2108 | 503 |
Smalltalk allClasses |
504 |
detect:[:cls | |
|
505 |
|info| |
|
57 | 506 |
|
2108 | 507 |
(cls package = packageName) ifTrue:[ |
508 |
(info := cls packageSourceCodeInfo) notNil ifTrue:[ |
|
509 |
module := info at:#module ifAbsent:nil. |
|
510 |
directory := info at:#directory ifAbsent:nil. |
|
511 |
] |
|
512 |
]. |
|
513 |
module notNil and:[directory notNil]. |
|
514 |
] |
|
515 |
ifNone:nil. |
|
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
516 |
|
2108 | 517 |
module notNil ifTrue:[ |
518 |
myProject repositoryModule:module |
|
519 |
]. |
|
520 |
directory notNil ifTrue:[ |
|
521 |
myProject repositoryDirectory:directory |
|
522 |
]. |
|
523 |
myProject packageName:packageName. |
|
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
524 |
|
2108 | 525 |
]. |
526 |
box showAtPointer |
|
57 | 527 |
] |
259
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
528 |
|
c651fecef457
better defaults when creating a container
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
529 |
"Created: 9.12.1995 / 16:50:45 / cg" |
1326 | 530 |
"Modified: 19.9.1997 / 10:55:19 / cg" |
110 | 531 |
! |
57 | 532 |
|
955 | 533 |
projectRepositoryAndModule |
534 |
"ask for a default module and package directory. |
|
535 |
This is offered as default, when new containers are |
|
536 |
created. However, when creating, these can still be changed" |
|
537 |
||
1490 | 538 |
|box moduleHolder dirHolder| |
955 | 539 |
|
540 |
box := DialogBox new. |
|
541 |
(box addTextLabel:(resources string:'PROJECT_MODULEANDDIR') withCRs) |
|
1348 | 542 |
adjust:#left. |
955 | 543 |
box addHorizontalLine. |
544 |
||
545 |
moduleHolder := myProject repositoryModule asValue. |
|
546 |
dirHolder := myProject repositoryDirectory asValue. |
|
547 |
||
548 |
(box addTextLabel:(resources string:'PROJECT_MODULEDIR') withCRs) |
|
1348 | 549 |
adjust:#left. |
955 | 550 |
box addFilenameInputFieldOn:moduleHolder in:nil tabable:true. |
217 | 551 |
|
1490 | 552 |
box addVerticalSpace; addHorizontalLine; addVerticalSpace. |
955 | 553 |
|
554 |
(box addTextLabel:(resources string:'PROJECT_PACKAGEDIR') withCRs) |
|
1348 | 555 |
adjust:#left. |
955 | 556 |
box addFilenameInputFieldOn:dirHolder in:nil tabable:true. |
557 |
||
558 |
box addAbortButton; addOkButton. |
|
559 |
box showAtPointer. |
|
560 |
||
561 |
box accepted ifTrue:[ |
|
1348 | 562 |
myProject repositoryModule:moduleHolder value. |
563 |
myProject repositoryDirectory:dirHolder value. |
|
217 | 564 |
]. |
565 |
||
955 | 566 |
box destroy. |
567 |
||
568 |
"Modified: 14.2.1997 / 13:42:05 / cg" |
|
217 | 569 |
! |
570 |
||
110 | 571 |
removePackage |
572 |
"remove all classes and individual methods from the system. |
|
573 |
Currently, this cannot fully restore the state to before |
|
574 |
the time the package was loaded (redefined methods are lost). |
|
575 |
In the future, we may keep a backref of overwritten methods |
|
576 |
and restore them from their source ..." |
|
57 | 577 |
|
110 | 578 |
|classesToRemove methodsToRemove theProject| |
579 |
||
580 |
(myProject isNil |
|
581 |
or:[(theProject := myProject packageName) isNil]) ifTrue:[ |
|
1348 | 582 |
self warn:(resources string:'No current package.'). |
583 |
^ self |
|
110 | 584 |
]. |
585 |
||
586 |
classesToRemove := IdentitySet new. |
|
587 |
methodsToRemove := IdentitySet new. |
|
588 |
||
589 |
Smalltalk allClassesDo:[:aClass | |
|
1348 | 590 |
|p| |
110 | 591 |
|
1348 | 592 |
(p := aClass package) notNil ifTrue:[ |
593 |
p = theProject ifTrue:[ |
|
594 |
classesToRemove add:aClass |
|
595 |
] |
|
596 |
]. |
|
110 | 597 |
]. |
598 |
Smalltalk allClassesDo:[:aClass | |
|
1348 | 599 |
|p| |
110 | 600 |
|
1348 | 601 |
(classesToRemove includes:aClass) ifFalse:[ |
602 |
aClass methodDictionary keysAndValuesDo:[:sel :aMethod | |
|
603 |
(p := aMethod package) notNil ifTrue:[ |
|
604 |
p = theProject ifTrue:[ |
|
605 |
methodsToRemove add:aMethod |
|
606 |
] |
|
607 |
] |
|
608 |
]. |
|
609 |
aClass class methodDictionary keysAndValuesDo:[:sel :aMethod | |
|
610 |
(p := aMethod package) notNil ifTrue:[ |
|
611 |
p = theProject ifTrue:[ |
|
612 |
methodsToRemove add:aMethod |
|
613 |
] |
|
614 |
] |
|
615 |
]. |
|
616 |
]. |
|
110 | 617 |
]. |
618 |
||
619 |
(classesToRemove isEmpty |
|
620 |
and:[methodsToRemove isEmpty]) ifTrue:[ |
|
1348 | 621 |
self warn:(resources string:'No classes or methods found in %1' with:theProject). |
622 |
^ self |
|
110 | 623 |
]. |
624 |
||
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
625 |
(self confirm:(resources |
1348 | 626 |
string:'About to remove %1 classes and %2 additional methods.\\Are you certain you want this ?' |
627 |
with:classesToRemove size |
|
628 |
with:methodsToRemove size) withCRs) |
|
629 |
ifTrue:[ |
|
630 |
classesToRemove do:[:aClass | |
|
631 |
('PROJECT: removing ' , aClass name) infoPrintNL. |
|
632 |
Smalltalk removeClass:aClass. |
|
633 |
]. |
|
634 |
methodsToRemove do:[:aMethod | |
|
635 |
|where| |
|
110 | 636 |
|
1348 | 637 |
('PROJECT: removing ' , aMethod displayString) infoPrintNL. |
638 |
where := aMethod who. |
|
639 |
where isNil ifTrue:[ |
|
640 |
'PROJECT: oops, some method is gone' infoPrintNL. |
|
641 |
] ifFalse:[ |
|
642 |
(where at:1) removeSelector:(where at:2) |
|
643 |
] |
|
644 |
] |
|
110 | 645 |
]. |
57 | 646 |
! |
647 |
||
648 |
renameProject |
|
955 | 649 |
"give that project another name - has no semantic meaning, |
650 |
and does not affect any class/method" |
|
651 |
||
57 | 652 |
|box| |
653 |
||
654 |
box := EnterBox new. |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
655 |
box title:(resources string:'new name of project:'). |
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
656 |
box okText:(resources string:'rename'). |
57 | 657 |
box initialText:(myProject name). |
658 |
box action:[:newName | |
|
1348 | 659 |
myProject name:newName. |
660 |
self setProject:myProject. |
|
661 |
self windowGroup process name:'Project: ' , newName. |
|
57 | 662 |
]. |
663 |
box showAtPointer |
|
278
9d33deca396c
better message (nationalized)
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
664 |
|
955 | 665 |
"Modified: 14.2.1997 / 13:41:15 / cg" |
57 | 666 |
! |
667 |
||
217 | 668 |
saveProjectFiles |
955 | 669 |
"create the projects files. |
670 |
This is not yet finished." |
|
671 |
||
57 | 672 |
self topView withWaitCursorDo:[ |
1348 | 673 |
|dir| |
57 | 674 |
|
1348 | 675 |
dir := myProject directory. |
676 |
(self confirm:'create source files in: ' , dir , ' ?') ifTrue:[ |
|
677 |
myProject createProjectFiles. |
|
678 |
] |
|
57 | 679 |
]. |
955 | 680 |
|
681 |
"Modified: 14.2.1997 / 13:40:40 / cg" |
|
57 | 682 |
! |
683 |
||
513 | 684 |
showClassDocumentation |
685 |
"open a documentViewer on the projects classes documentation only" |
|
686 |
||
687 |
self topView withWaitCursorDo:[ |
|
1348 | 688 |
|classes packageName methods methodList anyClasses anyMethods |
689 |
html| |
|
513 | 690 |
|
1348 | 691 |
anyMethods := anyClasses := false. |
513 | 692 |
|
1348 | 693 |
packageName := myProject packageName. |
694 |
classes := myProject classes. |
|
695 |
(classes notNil and:[classes notEmpty]) ifTrue:[ |
|
696 |
anyClasses := true. |
|
697 |
]. |
|
698 |
(anyClasses or:[anyMethods]) ifFalse:[ |
|
699 |
self information:(resources string:'no classes or methods in this project (yet)'). |
|
700 |
^ self. |
|
701 |
]. |
|
513 | 702 |
|
1348 | 703 |
methods := myProject individualMethods. |
704 |
methods notEmpty ifTrue:[ |
|
705 |
anyMethods := true. |
|
706 |
"/ not yet shown ... |
|
707 |
]. |
|
513 | 708 |
|
1348 | 709 |
anyClasses ifFalse:[ ^ self]. |
513 | 710 |
|
1348 | 711 |
html := HTMLDocGenerator |
712 |
htmlClasses:classes |
|
713 |
title:'project classes' |
|
714 |
backTo:#none. |
|
513 | 715 |
|
1348 | 716 |
HTMLDocumentView openFullOnText:html |
513 | 717 |
] |
718 |
||
719 |
"Created: 11.4.1996 / 19:29:50 / cg" |
|
515 | 720 |
"Modified: 26.4.1996 / 17:48:33 / cg" |
513 | 721 |
! |
722 |
||
217 | 723 |
showProject |
955 | 724 |
"show all views belonging to that project and hide |
725 |
the active projects views (except for those opened before)" |
|
726 |
||
217 | 727 |
ActiveProjectView notNil ifTrue:[ |
1348 | 728 |
ActiveProjectView hideProject |
57 | 729 |
]. |
217 | 730 |
ActiveProjectView := self. |
110 | 731 |
|
217 | 732 |
myProject showViews. |
733 |
Project current:myProject. |
|
734 |
toggle turnOn |
|
955 | 735 |
|
736 |
"Modified: 14.2.1997 / 13:40:10 / cg" |
|
57 | 737 |
! ! |
738 |
||
0 | 739 |
!ProjectView methodsFor:'private accessing'! |
740 |
||
741 |
setProject:aProject |
|
742 |
|name e| |
|
743 |
||
744 |
name := aProject name. |
|
745 |
self label:name. |
|
17 | 746 |
self iconLabel:name. |
0 | 747 |
toggle label:'Project: ' , name. |
748 |
toggle resize. |
|
749 |
myProject := aProject. |
|
750 |
e := (toggle width @ toggle height). |
|
29 | 751 |
drawableId isNil ifTrue:[ |
1348 | 752 |
self minExtent:e. |
753 |
self maxExtent:e. |
|
754 |
self open |
|
29 | 755 |
] ifFalse:[ |
1348 | 756 |
self unmap. |
757 |
self minExtent:e. |
|
758 |
self maxExtent:e. |
|
759 |
self extent:e. |
|
760 |
self remap |
|
29 | 761 |
] |
0 | 762 |
! ! |
217 | 763 |
|
796
b8edcbceaa18
XtHTML is no longer there ...
Claus Gittinger <cg@exept.de>
parents:
692
diff
changeset
|
764 |
!ProjectView class methodsFor:'documentation'! |
217 | 765 |
|
766 |
version |
|
2108 | 767 |
^ '$Header: /cvs/stx/stx/libtool/ProjectView.st,v 1.44 1999-04-22 14:09:57 cg Exp $' |
515 | 768 |
! ! |