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