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