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 |
|
57
|
13 |
'From Smalltalk/X, Version:2.10.4 on 5-feb-1995 at 11:48:18 pm'!
|
0
|
14 |
|
|
15 |
StandardSystemView subclass:#ProjectView
|
45
|
16 |
instanceVariableNames:'myProject toggle'
|
|
17 |
classVariableNames:'ActiveProjectView'
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Interface-Smalltalk'
|
0
|
20 |
!
|
|
21 |
|
88
|
22 |
!ProjectView class methodsFor:'documentation'!
|
|
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 |
"
|
|
36 |
!
|
|
37 |
|
|
38 |
version
|
|
39 |
"
|
|
40 |
$Header: /cvs/stx/stx/libtool/ProjectView.st,v 1.12 1995-03-26 17:35:57 claus Exp $
|
|
41 |
"
|
|
42 |
! !
|
|
43 |
|
0
|
44 |
!ProjectView class methodsFor:'instance creation'!
|
|
45 |
|
|
46 |
for:aProject
|
|
47 |
|newView|
|
|
48 |
|
|
49 |
newView := super new.
|
|
50 |
newView setProject:aProject.
|
|
51 |
^ newView
|
|
52 |
|
|
53 |
"ProjectView for:(Project new)"
|
|
54 |
! !
|
|
55 |
|
57
|
56 |
!ProjectView methodsFor:'menu actions'!
|
|
57 |
|
|
58 |
browseChanges
|
|
59 |
|b|
|
|
60 |
|
|
61 |
b := ChangeSetBrowser openOn:(myProject changeSet).
|
|
62 |
b label:'Changes in ' , myProject name
|
|
63 |
!
|
|
64 |
|
|
65 |
browsePackage
|
|
66 |
"launch browsers for all classes/methods which are defined in this package"
|
|
67 |
|
|
68 |
self topView withWaitCursorDo:[
|
85
|
69 |
|classes packageName|
|
57
|
70 |
|
85
|
71 |
packageName := myProject packageName.
|
|
72 |
classes := myProject classes.
|
|
73 |
classes notNil ifTrue:[
|
|
74 |
SystemBrowser browseClasses:classes
|
|
75 |
title:'classes in package ' , packageName.
|
57
|
76 |
|
85
|
77 |
classes := classes asIdentitySet.
|
|
78 |
classes addAll:(classes collect:[:c | c class]).
|
|
79 |
] ifFalse:[
|
|
80 |
classes := #()
|
|
81 |
].
|
|
82 |
SystemBrowser browseMethodsWhere:[:cls :mthd :sel |
|
|
83 |
mthd package = packageName
|
|
84 |
and:[(classes includes:cls) not]
|
|
85 |
]
|
|
86 |
title:'additional methods in package ' , packageName
|
57
|
87 |
]
|
|
88 |
!
|
|
89 |
|
|
90 |
projectDirectory
|
|
91 |
|box d|
|
|
92 |
|
|
93 |
box := FilenameEnterBox new.
|
85
|
94 |
box directoriesOnly.
|
57
|
95 |
box title:(resources string:'Directory of project (fileOuts will go there):').
|
|
96 |
(d := myProject directory) notNil ifTrue:[
|
|
97 |
box initialText:d
|
|
98 |
].
|
|
99 |
box action:[:dirName |
|
|
100 |
(OperatingSystem isDirectory:dirName) ifFalse:[
|
|
101 |
(OperatingSystem isValidPath:dirName) ifTrue:[
|
|
102 |
self warn:(resources string:'%1 is not a valid directory' with:dirName).
|
|
103 |
^ self
|
|
104 |
].
|
|
105 |
(self confirm:(resources string:'%1 does not exist\\create ?' with:dirName) withCRs) ifTrue:[
|
|
106 |
(OperatingSystem recursiveCreateDirectory:dirName) ifFalse:[
|
|
107 |
self warn:(resources string:'cannot create %1' with:dirName)
|
|
108 |
]
|
|
109 |
].
|
|
110 |
].
|
|
111 |
"did it work ?"
|
|
112 |
(OperatingSystem isDirectory:dirName) ifTrue:[
|
|
113 |
myProject directory:dirName
|
|
114 |
].
|
|
115 |
].
|
|
116 |
box showAtPointer
|
|
117 |
!
|
|
118 |
|
|
119 |
projectPackage
|
|
120 |
self topView withWaitCursorDo:[
|
85
|
121 |
|box p existingPackages|
|
57
|
122 |
|
85
|
123 |
existingPackages := Set new.
|
|
124 |
Smalltalk allClassesDo:[:aClass |
|
|
125 |
|p|
|
57
|
126 |
|
85
|
127 |
(p := aClass package) notNil ifTrue:[
|
|
128 |
existingPackages add:(p asString)
|
|
129 |
]
|
|
130 |
].
|
|
131 |
Method allInstancesDo:[:aClass |
|
|
132 |
|p|
|
57
|
133 |
|
85
|
134 |
(p := aClass package) notNil ifTrue:[
|
|
135 |
existingPackages add:(p asString)
|
|
136 |
]
|
|
137 |
].
|
57
|
138 |
|
85
|
139 |
box := ListSelectionBox title:'Package (new classes/methods will be put into that):'.
|
|
140 |
box list:(existingPackages asOrderedCollection sort).
|
|
141 |
(p := myProject packageName) notNil ifTrue:[
|
|
142 |
box initialText:p
|
|
143 |
].
|
|
144 |
box action:[:packageName |
|
|
145 |
myProject packageName:packageName
|
|
146 |
].
|
|
147 |
box showAtPointer
|
57
|
148 |
]
|
|
149 |
|
|
150 |
|
|
151 |
!
|
|
152 |
|
|
153 |
showProject
|
|
154 |
ActiveProjectView notNil ifTrue:[
|
|
155 |
ActiveProjectView hideProject
|
|
156 |
].
|
|
157 |
ActiveProjectView := self.
|
|
158 |
|
|
159 |
myProject showViews.
|
|
160 |
Project current:myProject.
|
|
161 |
toggle turnOn
|
|
162 |
!
|
|
163 |
|
|
164 |
browseProps
|
|
165 |
"will look better, once property inspector runs ..."
|
|
166 |
|
|
167 |
myProject properties inspect
|
|
168 |
!
|
|
169 |
|
|
170 |
saveProjectFiles
|
|
171 |
self topView withWaitCursorDo:[
|
85
|
172 |
|dir|
|
57
|
173 |
|
85
|
174 |
dir := myProject directory.
|
|
175 |
(self confirm:'create source files in: ' , dir , ' ?') ifTrue:[
|
|
176 |
myProject createProjectFiles.
|
|
177 |
]
|
57
|
178 |
].
|
|
179 |
!
|
|
180 |
|
|
181 |
hideProject
|
|
182 |
myProject hideViews.
|
|
183 |
ActiveProjectView := nil.
|
|
184 |
toggle turnOff
|
|
185 |
!
|
|
186 |
|
|
187 |
renameProject
|
|
188 |
|box|
|
|
189 |
|
|
190 |
box := EnterBox new.
|
|
191 |
box title:'new name of project:'.
|
|
192 |
box okText:'rename'.
|
|
193 |
box initialText:(myProject name).
|
|
194 |
box action:[:newName |
|
|
195 |
myProject name:newName.
|
85
|
196 |
self setProject:myProject.
|
|
197 |
self windowGroup process name:'Project: ' , newName.
|
57
|
198 |
].
|
|
199 |
box showAtPointer
|
|
200 |
!
|
|
201 |
|
|
202 |
buildProject
|
|
203 |
self topView withWaitCursorDo:[
|
85
|
204 |
|dir|
|
57
|
205 |
|
85
|
206 |
self saveProjectFiles.
|
|
207 |
(self confirm:'make object files in: ' , dir , ' ?') ifTrue:[
|
|
208 |
myProject buildProject.
|
|
209 |
]
|
57
|
210 |
].
|
|
211 |
!
|
|
212 |
|
|
213 |
destroyProject
|
|
214 |
|box|
|
|
215 |
|
|
216 |
box := YesNoBox new.
|
|
217 |
box title:'Destroying a project will discard all changes made
|
|
218 |
for that project and destroy all views opened for it.
|
|
219 |
|
|
220 |
Do you really want to do this ?'.
|
|
221 |
box okText:'yes'.
|
|
222 |
box yesAction:[
|
|
223 |
self doDestroyProject
|
|
224 |
].
|
|
225 |
box showAtPointer
|
|
226 |
!
|
|
227 |
|
|
228 |
doDestroy
|
|
229 |
self hideProject.
|
|
230 |
|
|
231 |
myProject := nil.
|
|
232 |
super destroy
|
|
233 |
!
|
|
234 |
|
|
235 |
destroy
|
|
236 |
(myProject views notNil
|
|
237 |
and:[myProject views notEmpty]) ifTrue:[
|
|
238 |
|box|
|
|
239 |
|
|
240 |
box := YesNoBox new.
|
|
241 |
box title:'Destroying a project will discard all changes made
|
|
242 |
for that project and destroy all views opened for it.
|
|
243 |
|
|
244 |
Do you really want to do this ?'.
|
|
245 |
box okText:'yes'.
|
|
246 |
(box confirm) ifFalse:[^ self]
|
|
247 |
].
|
|
248 |
|
|
249 |
self doDestroy
|
|
250 |
! !
|
|
251 |
|
|
252 |
!ProjectView methodsFor:'initialization'!
|
|
253 |
|
|
254 |
initialize
|
|
255 |
super initialize.
|
|
256 |
toggle := Toggle in:self.
|
|
257 |
toggle borderWidth:0.
|
|
258 |
toggle pressAction:[self showProject].
|
|
259 |
toggle releaseAction:[self hideProject].
|
|
260 |
toggle middleButtonMenu:(
|
|
261 |
PopUpMenu
|
|
262 |
labels:(resources array:
|
|
263 |
#('rename'
|
|
264 |
'changes'
|
|
265 |
'browse'
|
|
266 |
'directory'
|
|
267 |
'package'
|
|
268 |
"
|
|
269 |
'properties'
|
|
270 |
"
|
|
271 |
'-'
|
|
272 |
'save project code'
|
|
273 |
'build'
|
|
274 |
'-'
|
|
275 |
'show'
|
|
276 |
'hide'
|
|
277 |
'-'
|
|
278 |
'destroy'
|
|
279 |
)
|
|
280 |
)
|
|
281 |
selectors:#(renameProject
|
|
282 |
browseChanges
|
|
283 |
browsePackage
|
|
284 |
projectDirectory
|
|
285 |
projectPackage
|
|
286 |
"
|
|
287 |
browseProps
|
|
288 |
"
|
|
289 |
nil
|
|
290 |
saveProjectFiles
|
|
291 |
buildProject
|
|
292 |
nil
|
|
293 |
showProject
|
|
294 |
hideProject
|
|
295 |
nil
|
|
296 |
destroy
|
|
297 |
)
|
|
298 |
receiver:self
|
|
299 |
)
|
|
300 |
!
|
|
301 |
|
|
302 |
addToCurrentProject
|
|
303 |
"ignored here"
|
|
304 |
|
|
305 |
^ self
|
|
306 |
! !
|
|
307 |
|
0
|
308 |
!ProjectView methodsFor:'private accessing'!
|
|
309 |
|
|
310 |
setProject:aProject
|
|
311 |
|name e|
|
|
312 |
|
|
313 |
name := aProject name.
|
|
314 |
self label:name.
|
17
|
315 |
self iconLabel:name.
|
0
|
316 |
toggle label:'Project: ' , name.
|
|
317 |
toggle resize.
|
|
318 |
myProject := aProject.
|
|
319 |
e := (toggle width @ toggle height).
|
29
|
320 |
drawableId isNil ifTrue:[
|
45
|
321 |
self minExtent:e.
|
|
322 |
self maxExtent:e.
|
|
323 |
self open
|
29
|
324 |
] ifFalse:[
|
45
|
325 |
self unrealize.
|
|
326 |
self minExtent:e.
|
|
327 |
self maxExtent:e.
|
|
328 |
self extent:e.
|
|
329 |
self rerealize
|
29
|
330 |
]
|
0
|
331 |
! !
|
|
332 |
|