author | Claus Gittinger <cg@exept.de> |
Fri, 24 Jan 2003 18:29:24 +0100 | |
changeset 4481 | 6dda26f9f6e9 |
parent 4480 | defa79bbdaaa |
child 4509 | ede2c88a8be4 |
permissions | -rw-r--r-- |
3154 | 1 |
"{ Package: 'stx:libtool' }" |
2 |
||
3 |
ToolApplicationModel subclass:#WorkspaceApplication |
|
3667 | 4 |
instanceVariableNames:'workspaces tabList selectedWorkspaceIndexHolder workspaceHolder |
4474 | 5 |
autoDefineWorkspaceVariables autoDefineVariables' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
6 |
classVariableNames:'LastFilterBlockString LastProcessingBlockString' |
3222 | 7 |
poolDictionaries:'' |
8 |
category:'Interface-Smalltalk' |
|
3154 | 9 |
! |
10 |
||
3191 | 11 |
!WorkspaceApplication class methodsFor:'documentation'! |
12 |
||
13 |
documentation |
|
14 |
" |
|
15 |
A simple wrapper around a WorkSpace-View, adding a pullDown menu. |
|
16 |
||
17 |
[author:] |
|
18 |
Claus Gittinger |
|
19 |
" |
|
20 |
! ! |
|
3154 | 21 |
|
22 |
!WorkspaceApplication class methodsFor:'interface specs'! |
|
23 |
||
24 |
windowSpec |
|
25 |
"This resource specification was automatically generated |
|
26 |
by the UIPainter of ST/X." |
|
27 |
||
28 |
"Do not manually edit this!! If it is corrupted, |
|
29 |
the UIPainter may not be able to read the specification." |
|
30 |
||
31 |
" |
|
32 |
UIPainter new openOnClass:WorkspaceApplication andSelector:#windowSpec |
|
33 |
WorkspaceApplication new openInterface:#windowSpec |
|
34 |
WorkspaceApplication open |
|
35 |
" |
|
36 |
||
37 |
<resource: #canvas> |
|
38 |
||
39 |
^ |
|
40 |
#(#FullSpec |
|
41 |
#name: #windowSpec |
|
42 |
#window: |
|
43 |
#(#WindowSpec |
|
44 |
#label: 'Workspace' |
|
45 |
#name: 'Workspace' |
|
46 |
#min: #(#Point 10 10) |
|
3845 | 47 |
#bounds: #(#Rectangle 13 23 445 264) |
3154 | 48 |
#menu: #mainMenu |
49 |
) |
|
50 |
#component: |
|
51 |
#(#SpecCollection |
|
52 |
#collection: #( |
|
3193 | 53 |
#(#NoteBookViewSpec |
54 |
#name: 'NoteBook1' |
|
55 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
56 |
#model: #selectedWorkspaceIndexHolder |
|
57 |
#menu: #tabList |
|
58 |
#useIndex: true |
|
59 |
#accessTabMenuAction: #tabMenuAt: |
|
60 |
#canvas: #workspaceHolder |
|
61 |
#canvasInset: 0 |
|
62 |
#canvasFrameLevel: 0 |
|
63 |
#keepCanvasAlive: true |
|
4369 | 64 |
#tabLevel: 1 |
3193 | 65 |
) |
3154 | 66 |
) |
67 |
||
68 |
) |
|
69 |
) |
|
70 |
! ! |
|
71 |
||
72 |
!WorkspaceApplication class methodsFor:'menu specs'! |
|
73 |
||
74 |
mainMenu |
|
75 |
"This resource specification was automatically generated |
|
76 |
by the MenuEditor of ST/X." |
|
77 |
||
78 |
"Do not manually edit this!! If it is corrupted, |
|
79 |
the MenuEditor may not be able to read the specification." |
|
80 |
||
81 |
" |
|
82 |
MenuEditor new openOnClass:WorkspaceApplication andSelector:#mainMenu |
|
83 |
(Menu new fromLiteralArrayEncoding:(WorkspaceApplication mainMenu)) startUp |
|
84 |
" |
|
85 |
||
86 |
<resource: #menu> |
|
87 |
||
88 |
^ |
|
89 |
#(#Menu |
|
90 |
#( |
|
91 |
#(#MenuItem |
|
92 |
#label: 'File' |
|
93 |
#translateLabel: true |
|
94 |
#submenu: |
|
95 |
#(#Menu |
|
96 |
#( |
|
97 |
#(#MenuItem |
|
3651 | 98 |
#label: 'New Workspace' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
99 |
#itemValue: #newWorkspace |
3154 | 100 |
#translateLabel: true |
3651 | 101 |
) |
102 |
#(#MenuItem |
|
103 |
#label: 'New SystemWorkspace' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
104 |
#itemValue: #newSystemWorkspace |
3651 | 105 |
#translateLabel: true |
3154 | 106 |
) |
107 |
#(#MenuItem |
|
108 |
#label: '-' |
|
109 |
) |
|
110 |
#(#MenuItem |
|
111 |
#label: 'Load File...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
112 |
#itemValue: #menuLoad |
3154 | 113 |
#translateLabel: true |
114 |
) |
|
115 |
#(#MenuItem |
|
116 |
#label: '-' |
|
117 |
) |
|
118 |
#(#MenuItem |
|
119 |
#label: 'Save As...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
120 |
#itemValue: #menuSaveAs |
3154 | 121 |
#translateLabel: true |
122 |
) |
|
123 |
#(#MenuItem |
|
4474 | 124 |
#enabled: #hasMultipleBuffersHolder |
4267 | 125 |
#label: 'Save all As...' |
126 |
#itemValue: #menuSaveAllAs |
|
127 |
#translateLabel: true |
|
128 |
) |
|
129 |
#(#MenuItem |
|
3154 | 130 |
#label: '-' |
131 |
) |
|
132 |
#(#MenuItem |
|
133 |
#label: 'Exit' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
134 |
#itemValue: #closeRequest |
3154 | 135 |
#translateLabel: true |
136 |
) |
|
137 |
) |
|
138 |
nil |
|
139 |
nil |
|
140 |
) |
|
141 |
) |
|
142 |
#(#MenuItem |
|
3736 | 143 |
#label: 'Buffers' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
144 |
#nameKey: #Buffer |
3193 | 145 |
#translateLabel: true |
146 |
#submenu: |
|
147 |
#(#Menu |
|
148 |
#( |
|
149 |
#(#MenuItem |
|
3222 | 150 |
#label: 'Add Buffer' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
151 |
#itemValue: #addWorkspace |
3193 | 152 |
#translateLabel: true |
153 |
) |
|
154 |
#(#MenuItem |
|
4098 | 155 |
#enabled: #anyWorkspaceVariableIsDefined |
156 |
#label: 'Add Buffer on Workspace Variables' |
|
157 |
#itemValue: #addWorkspaceVariableInspector |
|
158 |
#translateLabel: true |
|
159 |
) |
|
160 |
#(#MenuItem |
|
4099 | 161 |
#label: 'Add Buffer on Global Variables' |
162 |
#itemValue: #addGlobalVariableInspector |
|
163 |
#translateLabel: true |
|
164 |
) |
|
165 |
#(#MenuItem |
|
3193 | 166 |
#label: 'Rename...' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
167 |
#itemValue: #renameWorkspace |
3193 | 168 |
#translateLabel: true |
169 |
) |
|
170 |
#(#MenuItem |
|
171 |
#label: '-' |
|
172 |
) |
|
173 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
174 |
#enabled: #canRemoveWorkspace |
3222 | 175 |
#label: 'Remove Buffer' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
176 |
#itemValue: #removeWorkspace |
3193 | 177 |
#translateLabel: true |
178 |
) |
|
179 |
) |
|
180 |
nil |
|
181 |
nil |
|
182 |
) |
|
183 |
) |
|
184 |
#(#MenuItem |
|
3154 | 185 |
#label: 'Edit' |
186 |
#translateLabel: true |
|
187 |
#submenu: |
|
188 |
#(#Menu |
|
189 |
#( |
|
190 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
191 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 192 |
#label: 'Copy' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
193 |
#itemValue: #copySelection |
3154 | 194 |
#translateLabel: true |
195 |
) |
|
196 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
197 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 198 |
#label: 'Cut' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
199 |
#itemValue: #cutSelection |
3154 | 200 |
#translateLabel: true |
201 |
) |
|
202 |
#(#MenuItem |
|
203 |
#label: 'Paste' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
204 |
#itemValue: #paste |
3154 | 205 |
#translateLabel: true |
206 |
) |
|
3752 | 207 |
#(#MenuItem |
208 |
#label: '-' |
|
209 |
) |
|
210 |
#(#MenuItem |
|
211 |
#label: 'Filter Text...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
212 |
#itemValue: #filterText |
3752 | 213 |
#translateLabel: true |
214 |
) |
|
215 |
#(#MenuItem |
|
216 |
#label: 'Process Text...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
217 |
#itemValue: #processText |
3752 | 218 |
#translateLabel: true |
219 |
) |
|
4136 | 220 |
#(#MenuItem |
4480 | 221 |
#label: 'WEB Services' |
222 |
#translateLabel: true |
|
223 |
#submenu: |
|
224 |
#(#Menu |
|
225 |
#( |
|
226 |
#(#MenuItem |
|
227 |
#enabled: #hasSelectionInActiveWorkspace |
|
228 |
#label: 'Google Spell' |
|
229 |
#itemValue: #googleSpellingSuggestion |
|
230 |
#translateLabel: true |
|
231 |
) |
|
232 |
#(#MenuItem |
|
233 |
#label: 'Translate' |
|
234 |
#translateLabel: true |
|
235 |
#submenu: |
|
236 |
#(#Menu |
|
237 |
#( |
|
238 |
#(#MenuItem |
|
239 |
#enabled: #hasSelectionInActiveWorkspace |
|
240 |
#label: 'English -> German' |
|
241 |
#itemValue: #babelFishTranslate: |
|
242 |
#translateLabel: true |
|
243 |
#argument: 'en_de' |
|
244 |
) |
|
245 |
#(#MenuItem |
|
246 |
#enabled: #hasSelectionInActiveWorkspace |
|
247 |
#label: 'English -> French' |
|
248 |
#itemValue: #babelFishTranslate: |
|
249 |
#translateLabel: true |
|
250 |
#argument: 'en_fr' |
|
251 |
) |
|
252 |
#(#MenuItem |
|
253 |
#enabled: #hasSelectionInActiveWorkspace |
|
254 |
#label: 'English -> Spanish' |
|
255 |
#itemValue: #babelFishTranslate: |
|
256 |
#translateLabel: true |
|
257 |
#argument: 'en_es' |
|
258 |
) |
|
259 |
#(#MenuItem |
|
260 |
#enabled: #hasSelectionInActiveWorkspace |
|
261 |
#label: 'English -> Portuguese' |
|
262 |
#itemValue: #babelFishTranslate: |
|
263 |
#translateLabel: true |
|
264 |
#argument: 'en_pt' |
|
265 |
) |
|
266 |
#(#MenuItem |
|
267 |
#label: '-' |
|
268 |
) |
|
269 |
#(#MenuItem |
|
270 |
#enabled: #hasSelectionInActiveWorkspace |
|
271 |
#label: 'German -> English' |
|
272 |
#itemValue: #babelFishTranslate: |
|
273 |
#translateLabel: true |
|
274 |
#argument: 'de_en' |
|
275 |
) |
|
276 |
#(#MenuItem |
|
277 |
#enabled: #hasSelectionInActiveWorkspace |
|
278 |
#label: 'French -> English' |
|
279 |
#itemValue: #babelFishTranslate: |
|
280 |
#translateLabel: true |
|
281 |
#argument: 'fr_en' |
|
282 |
) |
|
283 |
#(#MenuItem |
|
284 |
#enabled: #hasSelectionInActiveWorkspace |
|
285 |
#label: 'Spanish -> English' |
|
286 |
#itemValue: #babelFishTranslate: |
|
287 |
#translateLabel: true |
|
288 |
#argument: 'es_en' |
|
289 |
) |
|
290 |
#(#MenuItem |
|
291 |
#enabled: #hasSelectionInActiveWorkspace |
|
292 |
#label: 'Portuguese -> English' |
|
293 |
#itemValue: #babelFishTranslate: |
|
294 |
#translateLabel: true |
|
295 |
#argument: 'pt_en' |
|
296 |
) |
|
297 |
#(#MenuItem |
|
298 |
#enabled: #hasSelectionInActiveWorkspace |
|
299 |
#label: 'Russian -> English' |
|
300 |
#itemValue: #babelFishTranslate: |
|
301 |
#translateLabel: true |
|
302 |
#argument: 'ru_en' |
|
303 |
) |
|
304 |
) |
|
305 |
nil |
|
306 |
nil |
|
307 |
) |
|
308 |
) |
|
309 |
) |
|
310 |
nil |
|
311 |
nil |
|
312 |
) |
|
313 |
) |
|
314 |
#(#MenuItem |
|
4136 | 315 |
#label: '-' |
316 |
) |
|
317 |
#(#MenuItem |
|
318 |
#enabled: #hasHistory |
|
319 |
#label: 'Redo Last' |
|
320 |
#itemValue: #redoLastDoIt |
|
321 |
#translateLabel: true |
|
4267 | 322 |
#submenuChannel: #redoRecentDoItMenu |
323 |
) |
|
324 |
#(#MenuItem |
|
325 |
#enabled: #hasHistory |
|
326 |
#label: 'Paste Last' |
|
327 |
#itemValue: #pasteLastDoIt |
|
328 |
#translateLabel: true |
|
329 |
#submenuChannel: #pasteRecentDoItMenu |
|
4136 | 330 |
) |
3154 | 331 |
) |
332 |
nil |
|
333 |
nil |
|
334 |
) |
|
335 |
) |
|
336 |
#(#MenuItem |
|
3722 | 337 |
#label: 'Workspace' |
338 |
#translateLabel: true |
|
339 |
#submenu: |
|
340 |
#(#Menu |
|
341 |
#( |
|
342 |
#(#MenuItem |
|
343 |
#label: 'Add Workspace Variable...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
344 |
#itemValue: #addWorkspaceVariable |
3722 | 345 |
#translateLabel: true |
346 |
) |
|
347 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
348 |
#enabled: #anyWorkspaceVariableIsDefined |
3722 | 349 |
#label: 'Remove Workspace Variable...' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
350 |
#itemValue: #removeWorkspaceVariable |
3722 | 351 |
#translateLabel: true |
352 |
) |
|
353 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
354 |
#enabled: #anyWorkspaceVariableIsDefined |
4267 | 355 |
#label: 'Remove all Workspace Variables...' |
356 |
#itemValue: #removeAllWorkspaceVariables |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
357 |
#translateLabel: true |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
358 |
) |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
359 |
#(#MenuItem |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
360 |
#label: '-' |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
361 |
) |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
362 |
#(#MenuItem |
3812 | 363 |
#enabled: #anyWorkspaceVariableIsDefined |
4267 | 364 |
#label: 'Inspect Workspace Variables' |
365 |
#itemValue: #inspectWorkspaceVariables |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
366 |
#translateLabel: true |
3722 | 367 |
) |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
368 |
#(#MenuItem |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
369 |
#label: '-' |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
370 |
) |
3722 | 371 |
#(#MenuItem |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
372 |
#label: 'Settings' |
3722 | 373 |
#translateLabel: true |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
374 |
#submenu: |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
375 |
#(#Menu |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
376 |
#( |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
377 |
#(#MenuItem |
4474 | 378 |
#label: 'Autodefine as Workspace Variable' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
379 |
#translateLabel: true |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
380 |
#hideMenuOnActivated: false |
4474 | 381 |
#choice: #autoDefineVariables |
382 |
#choiceValue: #workspace |
|
383 |
) |
|
384 |
#(#MenuItem |
|
385 |
#label: 'Autodefine as DoIt Variable' |
|
386 |
#translateLabel: true |
|
387 |
#hideMenuOnActivated: false |
|
388 |
#choice: #autoDefineVariables |
|
389 |
#choiceValue: #doIt |
|
390 |
) |
|
391 |
#(#MenuItem |
|
392 |
#label: 'Autodefine off' |
|
393 |
#translateLabel: true |
|
394 |
#hideMenuOnActivated: false |
|
395 |
#choice: #autoDefineVariables |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
396 |
) |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
397 |
) |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
398 |
nil |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
399 |
nil |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
400 |
) |
3722 | 401 |
) |
402 |
) |
|
403 |
nil |
|
404 |
nil |
|
405 |
) |
|
406 |
) |
|
407 |
#(#MenuItem |
|
3154 | 408 |
#label: 'Smalltalk' |
409 |
#translateLabel: true |
|
410 |
#submenu: |
|
411 |
#(#Menu |
|
412 |
#( |
|
413 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
414 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 415 |
#label: 'DoIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
416 |
#itemValue: #doIt |
3154 | 417 |
#translateLabel: true |
418 |
) |
|
419 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
420 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 421 |
#label: 'PrintIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
422 |
#itemValue: #printIt |
3154 | 423 |
#translateLabel: true |
424 |
) |
|
425 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
426 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 427 |
#label: 'InspectIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
428 |
#itemValue: #inspectIt |
3154 | 429 |
#translateLabel: true |
430 |
) |
|
431 |
#(#MenuItem |
|
432 |
#label: '-' |
|
433 |
) |
|
434 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
435 |
#enabled: #hasSelectionInActiveWorkspace |
3384 | 436 |
#label: 'TimeIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
437 |
#itemValue: #timeIt |
3384 | 438 |
#translateLabel: true |
439 |
) |
|
440 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
441 |
#enabled: #hasSelectionInActiveWorkspace |
3384 | 442 |
#label: 'SpyOnIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
443 |
#itemValue: #spyOnIt |
3384 | 444 |
#translateLabel: true |
445 |
) |
|
446 |
#(#MenuItem |
|
447 |
#label: '-' |
|
448 |
) |
|
449 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
450 |
#enabled: #hasSelectionInActiveWorkspace |
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
451 |
#label: 'Browse Class' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
452 |
#itemValue: #browseIt |
3154 | 453 |
#translateLabel: true |
454 |
) |
|
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
455 |
#(#MenuItem |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
456 |
#enabled: #hasSelectionInActiveWorkspace |
3710 | 457 |
#label: 'Browse Implementors of It' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
458 |
#itemValue: #browseImplementorsOfIt |
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
459 |
#translateLabel: true |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
460 |
) |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
461 |
#(#MenuItem |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
462 |
#enabled: #hasSelectionInActiveWorkspace |
3710 | 463 |
#label: 'Browse References to It' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
464 |
#itemValue: #browseReferencesToIt |
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
465 |
#translateLabel: true |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
466 |
) |
4154 | 467 |
#(#MenuItem |
468 |
#label: '-' |
|
469 |
) |
|
470 |
#(#MenuItem |
|
471 |
#label: 'Add Global Variable...' |
|
4284 | 472 |
#itemValue: #addGlobalVariable |
473 |
#translateLabel: true |
|
474 |
) |
|
475 |
#(#MenuItem |
|
476 |
#label: 'Remove Global Variable...' |
|
477 |
#itemValue: #removeGlobalVariable |
|
4154 | 478 |
#translateLabel: true |
479 |
) |
|
3154 | 480 |
) |
481 |
nil |
|
482 |
nil |
|
483 |
) |
|
484 |
) |
|
485 |
#(#MenuItem |
|
486 |
#label: 'Help' |
|
487 |
#translateLabel: true |
|
488 |
#startGroup: #right |
|
489 |
#submenu: |
|
490 |
#(#Menu |
|
491 |
#( |
|
492 |
#(#MenuItem |
|
493 |
#label: 'Documentation' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
494 |
#itemValue: #openDocumentation |
3154 | 495 |
#translateLabel: true |
496 |
) |
|
497 |
#(#MenuItem |
|
498 |
#label: '-' |
|
499 |
) |
|
500 |
#(#MenuItem |
|
3282 | 501 |
#label: 'About this Application...' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
502 |
#itemValue: #openAboutThisApplication |
3154 | 503 |
#translateLabel: true |
504 |
) |
|
505 |
) |
|
506 |
nil |
|
507 |
nil |
|
508 |
) |
|
509 |
) |
|
510 |
) |
|
511 |
nil |
|
512 |
nil |
|
513 |
) |
|
3193 | 514 |
! |
515 |
||
516 |
tabMenu |
|
517 |
"This resource specification was automatically generated |
|
518 |
by the MenuEditor of ST/X." |
|
519 |
||
520 |
"Do not manually edit this!! If it is corrupted, |
|
521 |
the MenuEditor may not be able to read the specification." |
|
522 |
||
523 |
" |
|
524 |
MenuEditor new openOnClass:WorkspaceApplication andSelector:#tabMenu |
|
525 |
(Menu new fromLiteralArrayEncoding:(WorkspaceApplication tabMenu)) startUp |
|
526 |
" |
|
527 |
||
528 |
<resource: #menu> |
|
529 |
||
530 |
^ |
|
531 |
#(#Menu |
|
532 |
#( |
|
533 |
#(#MenuItem |
|
3222 | 534 |
#label: 'Add Buffer' |
3193 | 535 |
#translateLabel: true |
3651 | 536 |
"/ #triggerOnDown: true |
3193 | 537 |
#value: #addWorkspace |
538 |
) |
|
539 |
#(#MenuItem |
|
540 |
#label: 'Rename...' |
|
541 |
#translateLabel: true |
|
3651 | 542 |
"/ #triggerOnDown: true |
3193 | 543 |
#value: #renameWorkspace: |
544 |
) |
|
545 |
#(#MenuItem |
|
546 |
#label: '-' |
|
547 |
) |
|
548 |
#(#MenuItem |
|
3222 | 549 |
#label: 'Remove Buffer' |
3193 | 550 |
#translateLabel: true |
3651 | 551 |
"/ #triggerOnDown: true |
3193 | 552 |
#value: #removeWorkspace: |
553 |
#enabled: #canRemoveWorkspace: |
|
554 |
) |
|
555 |
) |
|
556 |
nil |
|
557 |
nil |
|
558 |
) |
|
3154 | 559 |
! ! |
560 |
||
3332 | 561 |
!WorkspaceApplication class methodsFor:'special startup'! |
562 |
||
563 |
openSystemWorkspace |
|
3345 | 564 |
|wsApp licenceView path needRemove| |
565 |
||
566 |
needRemove := true. |
|
3332 | 567 |
|
568 |
wsApp := self new. |
|
569 |
wsApp allButOpen. |
|
3337 | 570 |
wsApp window extent:640@400. |
3332 | 571 |
|
3345 | 572 |
path := (Smalltalk getSystemFileName:'README') ? '../../README'. |
3532
e38c9dd404a2
care for missing workspace files
Claus Gittinger <cg@exept.de>
parents:
3507
diff
changeset
|
573 |
(path notNil and:[path asFilename exists]) ifTrue:[ |
3345 | 574 |
wsApp addWindow:(HVScrollableView for:Workspace) named:'README' asFirst:false. |
575 |
wsApp loadFile:path. |
|
576 |
wsApp removeWorkspace:1. "/ the original Workspace |
|
4183 | 577 |
wsApp renameWorkspace:1 to:'LICENCE README'. |
3345 | 578 |
needRemove := false. |
579 |
]. |
|
3334 | 580 |
|
3346 | 581 |
"/ path := (Smalltalk getSystemFileName:'doc/online/english/LICENCE_STX.html') ? '../../doc/online/english/LICENCE_STX.html'. |
582 |
"/ path asFilename exists ifTrue:[ |
|
583 |
"/ wsApp addWindow:(licenceView := HVScrollableView for:HTMLDocumentView) named:'License' asFirst:false. |
|
584 |
"/ licenceView homeDocument:'../../doc/online/english/LICENCE_STX.html'. |
|
585 |
"/ licenceView updateLabelFlag:false. |
|
586 |
"/ needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
587 |
"/ needRemove := false. |
|
588 |
"/ ]. |
|
3332 | 589 |
|
3347 | 590 |
path := (Smalltalk getSystemFileName:'Keyboard.wsp'). |
3532
e38c9dd404a2
care for missing workspace files
Claus Gittinger <cg@exept.de>
parents:
3507
diff
changeset
|
591 |
(path notNil and:[path asFilename exists]) ifTrue:[ |
3345 | 592 |
wsApp addWindow:(HVScrollableView for:Workspace) named:'Keyboard' asFirst:false. |
593 |
wsApp loadFile:path. |
|
594 |
needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
595 |
needRemove := false. |
|
596 |
]. |
|
3332 | 597 |
|
4183 | 598 |
path := (Smalltalk getSystemFileName:'Setup.wsp'). |
599 |
(path notNil and:[path asFilename exists]) ifTrue:[ |
|
600 |
wsApp addWindow:(HVScrollableView for:Workspace) named:'Setup' asFirst:false. |
|
601 |
wsApp loadFile:path. |
|
602 |
needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
603 |
needRemove := false. |
|
604 |
]. |
|
605 |
||
3347 | 606 |
path := (Smalltalk getSystemFileName:'Hello.wsp'). |
3532
e38c9dd404a2
care for missing workspace files
Claus Gittinger <cg@exept.de>
parents:
3507
diff
changeset
|
607 |
(path notNil and:[path asFilename exists]) ifTrue:[ |
3345 | 608 |
wsApp addWindow:(HVScrollableView for:Workspace) named:'Welcome' asFirst:false. |
609 |
wsApp loadFile:path. |
|
610 |
needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
611 |
needRemove := false. |
|
612 |
]. |
|
3332 | 613 |
|
614 |
wsApp openWindow |
|
615 |
||
616 |
" |
|
617 |
self openSystemWorkspace |
|
618 |
" |
|
619 |
! ! |
|
620 |
||
3154 | 621 |
!WorkspaceApplication methodsFor:'accessing'! |
622 |
||
3193 | 623 |
selectedWorkspace |
624 |
|wsIndex| |
|
625 |
||
626 |
workspaces isNil ifTrue:[ |
|
627 |
workspaces := OrderedCollection new. |
|
628 |
]. |
|
629 |
wsIndex := self selectedWorkspaceIndexHolder value. |
|
630 |
wsIndex == 0 ifTrue:[ |
|
631 |
^ nil |
|
632 |
]. |
|
633 |
||
634 |
workspaces size < wsIndex ifTrue:[ |
|
635 |
workspaces grow:wsIndex. |
|
636 |
workspaces at:wsIndex put:(HVScrollableView for:Workspace). |
|
637 |
]. |
|
638 |
^ workspaces at:wsIndex |
|
639 |
! |
|
640 |
||
641 |
tabMenuAt:index |
|
3196 | 642 |
|m i ws| |
3193 | 643 |
|
644 |
m := self class tabMenu. |
|
645 |
m := m decodeAsLiteralArray. |
|
646 |
i := m detectItem:[:item | item value == #removeWorkspace:] ifNone:nil. |
|
647 |
i notNil ifTrue:[ |
|
648 |
i argument:index. |
|
649 |
index ~~ self selectedWorkspaceIndexHolder value ifTrue:[ |
|
650 |
"/ for now: if that buffer is modified, |
|
651 |
"/ do not allow removing. |
|
652 |
"/ (must be brought to front, in order for check-for-modification to work) |
|
3196 | 653 |
ws := workspaces at:index. |
654 |
(ws isKindOf:ScrollableView) ifTrue:[ |
|
655 |
ws := ws scrolledView |
|
656 |
]. |
|
657 |
((ws isKindOf:TextView) not |
|
658 |
or:[ ws modified ]) |
|
659 |
ifTrue:[ |
|
3193 | 660 |
i disable |
661 |
]. |
|
662 |
]. |
|
663 |
]. |
|
664 |
i := m detectItem:[:item | item value == #renameWorkspace:] ifNone:nil. |
|
665 |
i notNil ifTrue:[ |
|
666 |
i argument:index. |
|
667 |
]. |
|
668 |
||
669 |
m findGuiResourcesIn:self. |
|
670 |
^ m |
|
671 |
! |
|
672 |
||
673 |
workspaceHolder |
|
674 |
workspaceHolder isNil ifTrue:[ |
|
3207 | 675 |
workspaceHolder := ValueHolder with:(self selectedWorkspace). |
3193 | 676 |
]. |
677 |
^ workspaceHolder |
|
678 |
! ! |
|
679 |
||
680 |
!WorkspaceApplication methodsFor:'aspects'! |
|
681 |
||
4474 | 682 |
autoDefineVariables |
683 |
autoDefineVariables isNil ifTrue:[ |
|
684 |
autoDefineVariables := ValueHolder new. |
|
685 |
(UserPreferences current autoDefineWorkspaceVariables) ifTrue:[ |
|
686 |
autoDefineVariables value:#workspace |
|
687 |
]. |
|
688 |
autoDefineVariables onChangeSend:#autoDefineVariablesChanged to:self. |
|
689 |
]. |
|
690 |
^ autoDefineVariables. |
|
691 |
! |
|
692 |
||
3667 | 693 |
autoDefineWorkspaceVariables |
694 |
"does not work yet - needs more interaction with parser" |
|
695 |
||
696 |
autoDefineWorkspaceVariables isNil ifTrue:[ |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
697 |
autoDefineWorkspaceVariables := UserPreferences current autoDefineWorkspaceVariables asValue. |
3667 | 698 |
autoDefineWorkspaceVariables onChangeSend:#autoDefineWorkspaceVariablesChanged to:self. |
699 |
]. |
|
700 |
^ autoDefineWorkspaceVariables. |
|
701 |
! |
|
702 |
||
4136 | 703 |
hasHistory |
704 |
^ Workspace doItHistory size > 0. |
|
705 |
! |
|
706 |
||
3193 | 707 |
selectedWorkspaceIndexHolder |
708 |
selectedWorkspaceIndexHolder isNil ifTrue:[ |
|
709 |
selectedWorkspaceIndexHolder := 1 asValue. |
|
710 |
selectedWorkspaceIndexHolder onChangeSend:#workspaceSelectionChanged to:self. |
|
711 |
]. |
|
712 |
^ selectedWorkspaceIndexHolder. |
|
713 |
! |
|
714 |
||
715 |
tabList |
|
716 |
tabList isNil ifTrue:[ |
|
717 |
tabList := List new. |
|
718 |
]. |
|
719 |
^ tabList. |
|
720 |
! ! |
|
721 |
||
4358 | 722 |
!WorkspaceApplication methodsFor:'aspects-queries'! |
3193 | 723 |
|
3812 | 724 |
anyWorkspaceVariableIsDefined |
725 |
^ Workspace workspaceVariables size > 0 |
|
726 |
! |
|
727 |
||
3193 | 728 |
canRemoveWorkspace |
3214 | 729 |
^ self canRemoveWorkspace:(self selectedWorkspaceIndexHolder value) |
730 |
! |
|
731 |
||
732 |
canRemoveWorkspace:idx |
|
3193 | 733 |
^ self tabList size > 1 |
3214 | 734 |
"/ and:[ (self workspacesTextViewAt:(self selectedWorkspaceIndexHolder value)) |
3391
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
735 |
! |
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
736 |
|
4267 | 737 |
hasMultipleBuffersHolder |
738 |
^ [ workspaces size > 1 ] |
|
739 |
! |
|
740 |
||
3391
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
741 |
hasSelectionInActiveWorkspace |
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
742 |
^ self selectedWorkspacesTextView selectionAsString size > 0 |
3154 | 743 |
! ! |
744 |
||
745 |
!WorkspaceApplication methodsFor:'initialization & release'! |
|
746 |
||
747 |
closeRequest |
|
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
748 |
(self askIfAnyModified:'Text was not saved. Close anyway ?' yesButton:'Close') ifFalse:[ |
3154 | 749 |
^ self |
750 |
]. |
|
751 |
||
752 |
^ super closeRequest |
|
753 |
! ! |
|
754 |
||
4359 | 755 |
!WorkspaceApplication methodsFor:'menu-actions'! |
3154 | 756 |
|
4154 | 757 |
addGlobalVariable |
758 |
|name nameKey selection| |
|
759 |
||
760 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
761 |
||
762 |
name := Dialog |
|
763 |
request:'Name of new Global Variable:' |
|
764 |
initialAnswer:(selection asString string) |
|
765 |
okLabel:'Add' |
|
766 |
title:'Enter Variable Name'. |
|
767 |
name size == 0 ifTrue:[ |
|
768 |
^ self |
|
769 |
]. |
|
770 |
nameKey := name asSymbol. |
|
771 |
||
4284 | 772 |
(Smalltalk includesKey:nameKey) ifTrue:[ |
4154 | 773 |
self warn:'Global named ''' , name , ''' already exists.'. |
774 |
^ self. |
|
775 |
]. |
|
776 |
Smalltalk at:nameKey put:nil. |
|
777 |
! |
|
778 |
||
4099 | 779 |
addGlobalVariableInspector |
780 |
|v| |
|
781 |
||
782 |
v := self addInspectorOn:(Smalltalk) basic:false suppressPseudoSlots:true. |
|
783 |
v fieldListLabel:'Name'. |
|
4208 | 784 |
self renameWorkspace:(self selectedWorkspaceIndexHolder value) to:'Globals (Smalltalk)'. |
4099 | 785 |
! |
786 |
||
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
787 |
addInspectorOn:aValue basic:isBasicInspector suppressPseudoSlots:suppressPseudoSlots |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
788 |
|view cls resultString| |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
789 |
|
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
790 |
isBasicInspector ifFalse:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
791 |
cls := aValue inspectorClass. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
792 |
]. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
793 |
cls isNil ifTrue:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
794 |
cls := InspectorView |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
795 |
]. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
796 |
view := cls new. |
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
797 |
view suppressPseudoSlots:suppressPseudoSlots. |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
798 |
view inspect:aValue. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
799 |
"/ v allowFollow:true. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
800 |
aValue isBehavior ifTrue:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
801 |
resultString := aValue name |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
802 |
] ifFalse:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
803 |
resultString := aValue classNameWithArticle |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
804 |
]. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
805 |
self addWindow:view named:('Inspecting: ' , resultString). |
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
806 |
^ view |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
807 |
! |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
808 |
|
3196 | 809 |
addWindow:aWindow named:name |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
810 |
^ self addWindow:aWindow named:name asFirst:false |
3334 | 811 |
! |
812 |
||
813 |
addWindow:aWindow named:name asFirst:asFirst |
|
814 |
|tabList wsIndex newSelectedIndex| |
|
3193 | 815 |
|
816 |
tabList := self tabList. |
|
817 |
wsIndex := tabList size + 1. |
|
818 |
wsIndex == 1 ifTrue:[ |
|
819 |
"/ first - add a name for the first tab |
|
820 |
tabList add:(self window label). "/ 'Workspace'. |
|
821 |
wsIndex := wsIndex + 1. |
|
822 |
]. |
|
823 |
||
824 |
workspaces grow:wsIndex. |
|
3334 | 825 |
asFirst ifTrue:[ |
826 |
tabList addFirst:(name bindWith:wsIndex). |
|
827 |
workspaces replaceFrom:2 to:wsIndex with:workspaces startingAt:1. |
|
828 |
newSelectedIndex := 1. |
|
829 |
] ifFalse:[ |
|
830 |
tabList addLast:(name bindWith:wsIndex). |
|
831 |
newSelectedIndex := wsIndex. |
|
832 |
]. |
|
833 |
workspaces at:newSelectedIndex put:aWindow. |
|
834 |
self selectedWorkspaceIndexHolder value:newSelectedIndex. |
|
835 |
"/ workspaceHolder value:aWindow. |
|
3193 | 836 |
! |
837 |
||
3196 | 838 |
addWorkspace |
839 |
self addWindow:(HVScrollableView for:Workspace) named:'Workspace%1' |
|
840 |
! |
|
841 |
||
3722 | 842 |
addWorkspaceVariable |
843 |
|name selection| |
|
844 |
||
845 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
846 |
||
847 |
name := Dialog |
|
848 |
request:'Name of new Workspace Variable:' |
|
849 |
initialAnswer:(selection asString string) |
|
850 |
okLabel:'Add' |
|
851 |
title:'Enter Variable Name'. |
|
852 |
name size == 0 ifTrue:[ |
|
853 |
^ self |
|
854 |
]. |
|
855 |
Workspace addWorkspaceVariable:name. |
|
856 |
! |
|
857 |
||
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
858 |
addWorkspaceVariableInspector |
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
859 |
|v| |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
860 |
|
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
861 |
v := self addInspectorOn:(Workspace workspaceVariables) basic:false suppressPseudoSlots:true. |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
862 |
v dereferenceValueHolders:true. |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
863 |
v fieldListLabel:'Name'. |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
864 |
self renameWorkspace:(self selectedWorkspaceIndexHolder value) to:'Variables'. |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
865 |
! |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
866 |
|
3752 | 867 |
askForFilterBlock:message template:template rememberIn:nameOfClassVar |
868 |
|filterBlockString filterBlock dialog textHolder classVarValue| |
|
869 |
||
870 |
classVarValue := self class classVarAt:nameOfClassVar ifAbsent:nil. |
|
871 |
classVarValue isNil ifTrue:[ |
|
872 |
self class classVarAt:nameOfClassVar put:template. |
|
873 |
classVarValue := template. |
|
874 |
]. |
|
875 |
||
876 |
textHolder := ValueHolder new. |
|
877 |
dialog := Dialog |
|
878 |
forRequestText:(resources string:message) |
|
879 |
lines:25 |
|
880 |
columns:70 |
|
881 |
initialAnswer:classVarValue |
|
882 |
model:textHolder. |
|
883 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
884 |
dialog open. |
|
885 |
dialog accepted ifFalse:[^ nil]. |
|
886 |
||
887 |
filterBlockString := textHolder value. |
|
888 |
self class classVarAt:nameOfClassVar put:filterBlockString. |
|
889 |
||
890 |
filterBlock := Parser evaluate:filterBlockString. |
|
891 |
filterBlock isBlock ifFalse:[ |
|
892 |
self halt:'oops - bad input'. |
|
893 |
^ nil |
|
894 |
]. |
|
895 |
||
896 |
^ filterBlock |
|
897 |
! |
|
898 |
||
4474 | 899 |
autoDefineVariablesChanged |
900 |
|autoDefine| |
|
901 |
||
902 |
autoDefine := autoDefineVariables value. |
|
903 |
UserPreferences current autoDefineWorkspaceVariables:(autoDefine == #workspace). |
|
904 |
workspaces do:[:each | |
|
905 |
each autoDefineVariables:autoDefine |
|
906 |
]. |
|
907 |
! |
|
908 |
||
3667 | 909 |
autoDefineWorkspaceVariablesChanged |
910 |
"does not work yet - needs more interaction with parser" |
|
911 |
||
912 |
|doAutoDefine| |
|
913 |
||
914 |
doAutoDefine := autoDefineWorkspaceVariables value. |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
915 |
UserPreferences current autoDefineWorkspaceVariables:doAutoDefine. |
3667 | 916 |
workspaces do:[:each | |
917 |
each autoDefineWorkspaceVariables:doAutoDefine |
|
918 |
]. |
|
919 |
! |
|
920 |
||
4480 | 921 |
babelFishTranslate:fromToModeString |
922 |
"translate the selected text and paste it after the selection" |
|
4481 | 923 |
|original translated v| |
4480 | 924 |
|
4481 | 925 |
v := self selectedWorkspacesTextView. |
926 |
original := v selectionAsString. |
|
4480 | 927 |
original size == 0 ifTrue:[^ self]. |
928 |
self withWaitCursorDo:[ |
|
929 |
translated := SOAP::BabelFishClient new translate:original mode:fromToModeString. |
|
930 |
]. |
|
4481 | 931 |
|
932 |
"/ v pasteOrReplace:translated |
|
933 |
v cursorLine:(v selectionEndLine) col:(v selectionEndCol + 1). |
|
934 |
v unselect. |
|
935 |
v paste:translated |
|
4480 | 936 |
! |
937 |
||
3198 | 938 |
basicInspectIt |
939 |
self inspectIt:true |
|
940 |
! |
|
941 |
||
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
942 |
browseImplementorsOfIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
943 |
self selectedWorkspacesTextView browseImplementorsOfIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
944 |
! |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
945 |
|
3154 | 946 |
browseIt |
3198 | 947 |
self selectedWorkspacesTextView browseIt |
3154 | 948 |
! |
949 |
||
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
950 |
browseReferencesToIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
951 |
self selectedWorkspacesTextView browseReferencesToIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
952 |
! |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
953 |
|
4136 | 954 |
clearHistory |
955 |
Workspace clearDoItHistory |
|
956 |
! |
|
957 |
||
3154 | 958 |
copySelection |
3198 | 959 |
self selectedWorkspacesTextView copySelection |
3154 | 960 |
! |
961 |
||
962 |
cutSelection |
|
3198 | 963 |
self selectedWorkspacesTextView cutSelection |
3154 | 964 |
! |
965 |
||
966 |
doIt |
|
3198 | 967 |
self selectedWorkspacesTextView doIt |
3154 | 968 |
! |
969 |
||
3752 | 970 |
filterText |
971 |
|template filterBlock newList oldList answer nDeleted deletedLines| |
|
972 |
||
973 |
template := |
|
974 |
'"/ general text filter; |
|
975 |
"/ the following block should evaluate to true for all lines |
|
976 |
"/ you want to keep - lines for which the block returns false will be removed. |
|
977 |
"/ Beginner warning: Smalltalk know-how is useful here. |
|
978 |
||
979 |
[:line | |
|
980 |
"/ any condition on line. |
|
981 |
"/ Notice, that line might be a Text object (i.e. non-string), |
|
982 |
"/ so you may want to use line string. |
|
983 |
"/ |
|
984 |
"/ Useful queries on the line are: |
|
985 |
"/ - size the length of the line |
|
986 |
"/ - hasChangeOfEmphasis any bold, italic etc. |
|
987 |
"/ - startsWith:someString |
|
988 |
"/ - endsWith:someString |
|
989 |
||
990 |
"/ example filter (removes all empty lines) |
|
991 |
"/ |
|
992 |
"/ line size > 0 |
|
993 |
||
994 |
"/ example filter (removes all lines which do not end with some suffix) |
|
995 |
"/ |
|
996 |
"/ (line asLowercase endsWith:''foo'') not |
|
997 |
||
998 |
"/ dummy filter (keeps all lines) |
|
999 |
"/ |
|
1000 |
true |
|
1001 |
] |
|
1002 |
'. |
|
1003 |
||
1004 |
filterBlock := self askForFilterBlock:'Filter block:' |
|
1005 |
template:template |
|
1006 |
rememberIn:#LastFilterBlockString. |
|
1007 |
filterBlock isNil ifTrue:[^ self]. |
|
1008 |
||
1009 |
oldList := self selectedWorkspacesTextView list. |
|
1010 |
oldList := oldList collect:[:lineOrNil | lineOrNil ? '']. |
|
1011 |
newList := oldList select:filterBlock. |
|
1012 |
newList := newList collect:[:line | (line isString and:[line size == 0]) ifTrue:[nil] ifFalse:[line]]. |
|
1013 |
nDeleted := oldList size - newList size. |
|
1014 |
nDeleted == 0 ifTrue:[ |
|
1015 |
self information:'No lines were deleted.'. |
|
1016 |
^ self |
|
1017 |
]. |
|
1018 |
||
1019 |
answer := Dialog confirmWithCancel:(resources |
|
1020 |
string:'%1 lines remain (%2 deleted). Change text ?' |
|
1021 |
with:newList size |
|
1022 |
with:nDeleted) |
|
1023 |
labels:#( 'Cancel' 'No, Show Deleted' 'Yes'). |
|
1024 |
answer isNil ifTrue:[^ self]. |
|
1025 |
answer ifFalse:[ |
|
1026 |
deletedLines := oldList reject:filterBlock. |
|
1027 |
TextBox openOn:(deletedLines asStringCollection) title:'Filtered lines'. |
|
1028 |
^ self. |
|
1029 |
]. |
|
1030 |
||
1031 |
self selectedWorkspacesTextView list:newList. |
|
1032 |
! |
|
1033 |
||
4480 | 1034 |
googleSpellingSuggestion |
1035 |
self selectedWorkspacesTextView googleSpellingSuggestion |
|
1036 |
! |
|
1037 |
||
3154 | 1038 |
inspectIt |
3198 | 1039 |
self inspectIt:false |
1040 |
! |
|
1041 |
||
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1042 |
inspectIt:isBasicInspector |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1043 |
|ws| |
3196 | 1044 |
|
3198 | 1045 |
ws := self selectedWorkspacesTextView. |
3196 | 1046 |
ws |
1047 |
do:(ws selection) |
|
1048 |
withValueDo:[:result | |
|
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
1049 |
self addInspectorOn:result basic:isBasicInspector suppressPseudoSlots:false |
3196 | 1050 |
] |
1051 |
||
1052 |
"/ self selectedWorkspace inspectIt |
|
3154 | 1053 |
! |
1054 |
||
3812 | 1055 |
inspectWorkspaceVariables |
1056 |
|wsvars| |
|
1057 |
||
1058 |
wsvars := Workspace workspaceVariables. |
|
1059 |
wsvars size == 0 ifTrue:[ |
|
1060 |
Dialog information:'No Workspace Variables are defined'. |
|
1061 |
^ self |
|
1062 |
]. |
|
1063 |
wsvars inspect |
|
1064 |
! |
|
1065 |
||
3332 | 1066 |
loadFile:aFileName |
1067 |
|file ws lbl| |
|
1068 |
||
1069 |
file := aFileName asFilename. |
|
3507 | 1070 |
(ws := self selectedWorkspacesTextView) contents:file contents. |
3332 | 1071 |
ws modified:false. |
1072 |
||
1073 |
lbl := file withoutSuffix baseName. |
|
1074 |
tabList size <= 1 ifTrue:[ |
|
1075 |
self window label:lbl. |
|
1076 |
] ifFalse:[ |
|
1077 |
tabList at:self selectedWorkspaceIndexHolder value put:lbl |
|
1078 |
] |
|
1079 |
! |
|
1080 |
||
3154 | 1081 |
menuLoad |
3332 | 1082 |
|file| |
3154 | 1083 |
|
3193 | 1084 |
(self askIfModified:'Text was modified. Load anyway ?' yesButton:'Load') ifFalse:[ ^ self]. |
1085 |
||
3469 | 1086 |
file := Dialog requestFileName:'Load file:' default:'file.wsp' pattern:'*.wsp'. |
3154 | 1087 |
file size > 0 ifTrue:[ |
3332 | 1088 |
self loadFile:file |
3154 | 1089 |
] |
1090 |
! |
|
1091 |
||
4267 | 1092 |
menuSaveAllAs |
1093 |
self |
|
1094 |
askForFile:'Save all Buffers into:' |
|
1095 |
thenDo:[:file :doAppend | |
|
1096 |
|ws append| |
|
3473
1120657c3d2e
added Append-option to saveAs
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
1097 |
|
4267 | 1098 |
append := doAppend. |
1099 |
workspaces do:[:subView | |
|
1100 |
|ws| |
|
3154 | 1101 |
|
4267 | 1102 |
ws := self workspaceViewOfView:subView. |
1103 |
ws notNil ifTrue:[ |
|
1104 |
ws saveAs:file doAppend:append. |
|
1105 |
ws modified:false. |
|
1106 |
]. |
|
1107 |
append := true. |
|
1108 |
]. |
|
1109 |
] |
|
1110 |
! |
|
3473
1120657c3d2e
added Append-option to saveAs
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
1111 |
|
4267 | 1112 |
menuSaveAs |
1113 |
self |
|
1114 |
askForFile:'Save Buffer into:' |
|
1115 |
thenDo:[:file :doAppend | |
|
1116 |
|ws| |
|
1117 |
||
1118 |
ws := self selectedWorkspacesTextView. |
|
1119 |
ws saveAs:file doAppend:doAppend. |
|
1120 |
ws modified:false. |
|
1121 |
] |
|
3154 | 1122 |
! |
1123 |
||
3334 | 1124 |
newSystemWorkspace |
1125 |
self class openSystemWorkspace |
|
1126 |
! |
|
1127 |
||
3651 | 1128 |
newWorkspace |
1129 |
self class open |
|
1130 |
! |
|
1131 |
||
3154 | 1132 |
openDocumentation |
1133 |
"opens the documentation file" |
|
1134 |
||
1135 |
self openHTMLDocument: 'tools/misc/TOP.html#WORKSPACE' |
|
1136 |
! |
|
1137 |
||
1138 |
paste |
|
3198 | 1139 |
self selectedWorkspacesTextView paste |
3154 | 1140 |
! |
1141 |
||
4267 | 1142 |
paste:aString |
4136 | 1143 |
self selectedWorkspacesTextView paste:aString. |
4267 | 1144 |
! |
1145 |
||
1146 |
pasteAndExecute:aString |
|
1147 |
self paste:aString. |
|
4136 | 1148 |
self printIt |
1149 |
! |
|
1150 |
||
4267 | 1151 |
pasteLastDoIt |
1152 |
|s| |
|
1153 |
||
1154 |
s := self lastDoItsString. |
|
1155 |
s notNil ifTrue:[ |
|
1156 |
self paste:s |
|
1157 |
] |
|
1158 |
! |
|
1159 |
||
3154 | 1160 |
printIt |
3198 | 1161 |
self selectedWorkspacesTextView printIt |
3193 | 1162 |
! |
1163 |
||
3752 | 1164 |
processText |
1165 |
|template filterBlock newList oldList answer nChanged changedLines flags| |
|
1166 |
||
1167 |
template := |
|
1168 |
'"/ general text processor; |
|
1169 |
"/ the following block should evaluate to a new line, |
|
1170 |
"/ given the original line as argument. |
|
1171 |
"/ Beginner warning: Smalltalk know-how is useful here. |
|
1172 |
||
1173 |
[:line | |
|
1174 |
"/ any processing on line. |
|
1175 |
"/ Notice, that line might be a Text object (i.e. non-string), |
|
1176 |
"/ |
|
1177 |
"/ Useful operations on the line are: |
|
1178 |
"/ - '' .... '' , concatenation of any prefix/suffix |
|
1179 |
"/ - leftPaddedTo:size padding |
|
1180 |
"/ - rightPaddedTo:size padding |
|
1181 |
"/ - copyTo:(size min:N) |
|
1182 |
"/ - asUppercase |
|
1183 |
"/ - asLowercase |
|
4141 | 1184 |
"/ - withoutSeparators remove whiteSpace |
1185 |
"/ - asCollectionOfWords words |
|
3752 | 1186 |
|
1187 |
"/ makes everything bold |
|
1188 |
"/ |
|
1189 |
"/ line allBold |
|
1190 |
||
4141 | 1191 |
"/ first word only |
1192 |
"/ |
|
1193 |
"/ line withoutSeparators asCollectionOfWords first |
|
1194 |
||
3752 | 1195 |
"/ dummy filter (keeps all lines as-is) |
1196 |
"/ |
|
1197 |
line |
|
1198 |
] |
|
1199 |
'. |
|
1200 |
filterBlock := self askForFilterBlock:'Processing block:' |
|
1201 |
template:template |
|
1202 |
rememberIn:#LastProcessingBlockString. |
|
1203 |
filterBlock isNil ifTrue:[^ self]. |
|
1204 |
||
1205 |
oldList := self selectedWorkspacesTextView list. |
|
1206 |
oldList := oldList collect:[:lineOrNil | lineOrNil ? '']. |
|
4141 | 1207 |
newList := oldList collect:[:line | |newLine| |
1208 |
newLine := line. |
|
1209 |
Error handle:[:ex | |
|
1210 |
] do:[ |
|
1211 |
newLine := filterBlock value:line |
|
1212 |
]. |
|
1213 |
newLine |
|
1214 |
]. |
|
3752 | 1215 |
newList := newList collect:[:line | (line isString and:[line size == 0]) ifTrue:[nil] ifFalse:[line]]. |
1216 |
||
1217 |
flags := (1 to:oldList size) collect:[:i | (oldList at:i) ~= (newList at:i)]. |
|
1218 |
flags := flags select:[:flag | flag]. |
|
1219 |
nChanged := flags size. |
|
1220 |
nChanged == 0 ifTrue:[ |
|
1221 |
self information:'No lines were changed.'. |
|
1222 |
^ self |
|
1223 |
]. |
|
1224 |
||
1225 |
answer := Dialog confirmWithCancel:(resources |
|
1226 |
string:'%1 lines changed. Change text ?' |
|
1227 |
with:nChanged) |
|
1228 |
labels:#( 'Cancel' 'No, Show Changed' 'Yes'). |
|
1229 |
answer isNil ifTrue:[^ self]. |
|
1230 |
answer ifFalse:[ |
|
1231 |
changedLines := (1 to:oldList size) select:[:i | (oldList at:i) ~= (newList at:i)]. |
|
1232 |
changedLines := changedLines collect:[:i | (newList at:i)]. |
|
1233 |
TextBox openOn:(changedLines asStringCollection) title:'Changed lines'. |
|
1234 |
^ self. |
|
1235 |
]. |
|
1236 |
||
1237 |
self selectedWorkspacesTextView list:newList. |
|
1238 |
! |
|
1239 |
||
4136 | 1240 |
redoLastDoIt |
4267 | 1241 |
|s| |
4136 | 1242 |
|
4267 | 1243 |
s := self lastDoItsString. |
1244 |
s notNil ifTrue:[ |
|
1245 |
self pasteAndExecute:s |
|
1246 |
] |
|
4136 | 1247 |
! |
1248 |
||
3722 | 1249 |
removeAllWorkspaceVariables |
1250 |
(Dialog confirm:'Do you really want to remove all Workspace Variables ?') |
|
1251 |
ifTrue:[ |
|
1252 |
Workspace removeAllWorkspaceVariables |
|
1253 |
]. |
|
1254 |
! |
|
1255 |
||
4284 | 1256 |
removeGlobalVariable |
1257 |
|name nameKey selection value| |
|
1258 |
||
1259 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
1260 |
||
1261 |
name := Dialog |
|
1262 |
request:'Remove Global Variable:' |
|
1263 |
initialAnswer:(selection asString string) |
|
1264 |
okLabel:'Remove' |
|
1265 |
title:'Remove Global'. |
|
1266 |
||
1267 |
name size == 0 ifTrue:[^ self]. |
|
1268 |
nameKey := name asSymbolIfInterned. |
|
1269 |
nameKey isNil ifTrue:[^ self]. |
|
1270 |
||
1271 |
(Smalltalk includesKey:nameKey) ifFalse:[ |
|
1272 |
self warn:('No such Global Binding: ''%1''.' bindWith:name). |
|
1273 |
^ self. |
|
1274 |
]. |
|
1275 |
||
1276 |
value := Smalltalk at:nameKey. |
|
1277 |
value notNil ifTrue:[ |
|
1278 |
(self confirm:('Global ''%1'' is currently bound to %2\\Remove Binding ?' bindWith:name with:value) withCRs) |
|
1279 |
ifFalse:[ |
|
1280 |
^ self. |
|
1281 |
]. |
|
1282 |
]. |
|
1283 |
Smalltalk at:nameKey put:nil. |
|
1284 |
Smalltalk removeKey:nameKey |
|
1285 |
! |
|
1286 |
||
3193 | 1287 |
removeWorkspace |
1288 |
self removeWorkspace:(self selectedWorkspaceIndexHolder value) |
|
1289 |
! |
|
1290 |
||
1291 |
removeWorkspace:wsIndex |
|
1292 |
|tabList newWsIndex| |
|
1293 |
||
1294 |
wsIndex == self selectedWorkspaceIndexHolder value ifTrue:[ |
|
1295 |
(self askIfModified:'Text was modified. Remove anyway ?' yesButton:'Remove') ifFalse:[ |
|
1296 |
^ self |
|
1297 |
]. |
|
1298 |
]. |
|
1299 |
||
1300 |
tabList := self tabList. |
|
1301 |
||
1302 |
wsIndex == tabList size ifTrue:[ |
|
1303 |
newWsIndex := wsIndex - 1. |
|
1304 |
] ifFalse:[ |
|
1305 |
newWsIndex := wsIndex. |
|
1306 |
]. |
|
1307 |
||
1308 |
tabList removeIndex:wsIndex. |
|
1309 |
(workspaces at:wsIndex) destroy. |
|
1310 |
workspaces removeIndex:wsIndex. |
|
1311 |
||
1312 |
tabList size == 1 ifTrue:[ |
|
1313 |
self window label:(tabList at:1). |
|
1314 |
tabList removeIndex:1 |
|
1315 |
]. |
|
1316 |
||
3334 | 1317 |
workspaceHolder value:(workspaces at:newWsIndex). |
3193 | 1318 |
self selectedWorkspaceIndexHolder value:newWsIndex. |
1319 |
"/ to force change (update workspaceHolder - even if same index) |
|
1320 |
self selectedWorkspaceIndexHolder changed:#value. |
|
1321 |
! |
|
1322 |
||
3722 | 1323 |
removeWorkspaceVariable |
3812 | 1324 |
|name selection wsvars| |
1325 |
||
1326 |
wsvars := Workspace workspaceVariables. |
|
1327 |
wsvars size == 0 ifTrue:[ |
|
1328 |
Dialog information:'No Workspace Variables are defined'. |
|
1329 |
^ self |
|
1330 |
]. |
|
3722 | 1331 |
|
1332 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
1333 |
||
1334 |
name := Dialog |
|
1335 |
request:'Variable to remove:' |
|
1336 |
initialAnswer:(selection asString string) |
|
1337 |
okLabel:'Remove' |
|
1338 |
title:'Enter Variable Name' |
|
3812 | 1339 |
list:(wsvars keys asOrderedCollection sort). |
3722 | 1340 |
name size == 0 ifTrue:[ |
1341 |
^ self |
|
1342 |
]. |
|
1343 |
Workspace removeWorkspaceVariable:name. |
|
1344 |
! |
|
1345 |
||
3193 | 1346 |
renameWorkspace |
1347 |
self renameWorkspace:(self selectedWorkspaceIndexHolder value) |
|
1348 |
! |
|
1349 |
||
1350 |
renameWorkspace:wsIndex |
|
1351 |
|tabList oldName newName| |
|
1352 |
||
1353 |
tabList := self tabList. |
|
1354 |
tabList isEmpty ifTrue:[ |
|
1355 |
oldName := self window label |
|
1356 |
] ifFalse:[ |
|
1357 |
oldName := tabList at:wsIndex. |
|
1358 |
]. |
|
1359 |
newName := Dialog request:(resources string:'New Name for %1:' with:oldName) initialAnswer:oldName. |
|
1360 |
newName size == 0 ifTrue:[ ^ self]. |
|
1361 |
||
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1362 |
self renameWorkspace:wsIndex to:newName. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1363 |
! |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1364 |
|
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1365 |
renameWorkspace:wsIndex to:newName |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1366 |
|tabList| |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1367 |
|
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1368 |
tabList := self tabList. |
3193 | 1369 |
tabList notEmpty ifTrue:[ |
1370 |
tabList at:wsIndex put:newName. |
|
1371 |
]. |
|
1372 |
wsIndex == self selectedWorkspaceIndexHolder value ifTrue:[ |
|
1373 |
self window label:newName. |
|
1374 |
]. |
|
3384 | 1375 |
! |
1376 |
||
1377 |
spyOnIt |
|
1378 |
self selectedWorkspacesTextView spyOnIt |
|
1379 |
! |
|
1380 |
||
1381 |
timeIt |
|
1382 |
self selectedWorkspacesTextView timeIt |
|
3154 | 1383 |
! ! |
1384 |
||
4136 | 1385 |
!WorkspaceApplication methodsFor:'menu-dynamic'! |
1386 |
||
4267 | 1387 |
pasteRecentDoItMenu |
1388 |
<resource: #programMenu > |
|
1389 |
||
1390 |
^ self recentDoItsMenuFor:#'paste:' |
|
1391 |
! |
|
1392 |
||
1393 |
recentDoItsMenuFor:aSelector |
|
4136 | 1394 |
<resource: #programMenu > |
1395 |
||
1396 |
^ [ |
|
1397 |
|doIts m classHistory currentClass| |
|
1398 |
||
1399 |
doIts := Workspace doItHistory. |
|
1400 |
doIts size > 0 ifTrue:[ |
|
1401 |
m := Menu new. |
|
1402 |
doIts do:[:doItEntry | |
|
1403 |
|lines label item| |
|
1404 |
||
1405 |
label := doItEntry withoutLeadingSeparators asStringCollection first. |
|
1406 |
(label size > 20) ifTrue:[ |
|
1407 |
label := (label contractTo:20) |
|
1408 |
] ifFalse:[ |
|
1409 |
(lines size > 1) ifTrue:[ |
|
1410 |
label := label , '...' |
|
1411 |
]. |
|
1412 |
]. |
|
1413 |
label := '''' , label , ''''. |
|
1414 |
||
1415 |
item := MenuItem label:label. |
|
1416 |
m addItem:item. |
|
4267 | 1417 |
item value:aSelector. |
4136 | 1418 |
item argument:doItEntry. |
1419 |
]. |
|
1420 |
m addItem: (MenuItem new label:'-'). |
|
1421 |
m addItem: (MenuItem new |
|
1422 |
label: 'Clear History'; |
|
1423 |
value: #clearHistory; |
|
1424 |
activeHelpKey: #historyEmptyMenu; |
|
1425 |
translateLabel:true). |
|
1426 |
]. |
|
1427 |
m |
|
1428 |
]. |
|
4267 | 1429 |
! |
1430 |
||
1431 |
redoRecentDoItMenu |
|
1432 |
<resource: #programMenu > |
|
1433 |
||
1434 |
^ self recentDoItsMenuFor:#'pasteAndExecute:' |
|
4136 | 1435 |
! ! |
1436 |
||
3154 | 1437 |
!WorkspaceApplication methodsFor:'private'! |
1438 |
||
4267 | 1439 |
askForFile:question thenDo:aBlock |
1440 |
|file doAppend| |
|
1441 |
||
1442 |
doAppend := false. |
|
1443 |
Dialog aboutToOpenBoxNotificationSignal handle:[:n | |
|
1444 |
|box| |
|
1445 |
||
1446 |
box := n parameter. |
|
1447 |
box addButton:(Button label:'Append' |
|
1448 |
action:[doAppend := true. box okPressed]). |
|
1449 |
n proceed. |
|
1450 |
] do:[ |
|
1451 |
file := Dialog requestFileName:question default:'file.wsp'. |
|
1452 |
]. |
|
1453 |
file isEmptyOrNil ifFalse:[ |
|
1454 |
aBlock value:file value:doAppend |
|
1455 |
]. |
|
1456 |
! |
|
1457 |
||
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1458 |
askIfAnyModified:question yesButton:yesButtonText |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1459 |
(workspaces contains:[:aView | self isModifiedWorkspace:aView]) ifFalse:[^ true]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1460 |
|
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1461 |
(Dialog |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1462 |
confirm:(resources string:question) withCRs |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1463 |
yesLabel:(resources at:yesButtonText) |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1464 |
noLabel:(resources at:'Cancel')) |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1465 |
ifTrue:[ |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1466 |
"/ reset modified flag so question is asked only once |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1467 |
(workspaces select:[:aView | (self isModifiedWorkspace:aView)]) |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1468 |
do:[:eachModifiedTextView | |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1469 |
eachModifiedTextView modified:false. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1470 |
]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1471 |
^ true |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1472 |
]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1473 |
^ false |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1474 |
! |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1475 |
|
3154 | 1476 |
askIfModified:question yesButton:yesButtonText |
1477 |
"tell user, that code has been modified - let her confirm" |
|
1478 |
||
1479 |
|textView| |
|
1480 |
||
3193 | 1481 |
textView := self selectedWorkspace. |
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1482 |
(self isModifiedWorkspace:textView) ifFalse:[^ true]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1483 |
|
3154 | 1484 |
(Dialog |
1485 |
confirm:(resources string:question) withCRs |
|
1486 |
yesLabel:(resources at:yesButtonText) |
|
1487 |
noLabel:(resources at:'Cancel')) |
|
1488 |
ifTrue:[ |
|
1489 |
"/ reset modified flag so question is asked only once |
|
1490 |
textView modified:false. |
|
1491 |
^ true |
|
1492 |
]. |
|
1493 |
^ false |
|
1494 |
||
1495 |
"Modified: 2.10.1997 / 14:23:47 / stefan" |
|
3193 | 1496 |
! |
1497 |
||
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1498 |
isModifiedWorkspace:aView |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1499 |
|view| |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1500 |
|
4267 | 1501 |
view := self workspaceViewOfView:aView. |
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1502 |
|
4313 | 1503 |
(view isNil |
1504 |
or:[view modified not |
|
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1505 |
or:[view contentsWasSaved |
4313 | 1506 |
or:[view contents withoutSeparators isEmpty]]]) ifTrue:[ |
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1507 |
^ false |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1508 |
]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1509 |
^ true |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1510 |
! |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1511 |
|
4267 | 1512 |
lastDoItsString |
1513 |
|history| |
|
3198 | 1514 |
|
4267 | 1515 |
history := Workspace doItHistory. |
1516 |
history size > 0 ifFalse:[ |
|
1517 |
self selectedWorkspacesTextView flash. |
|
1518 |
^ nil |
|
3198 | 1519 |
]. |
4267 | 1520 |
^ history first |
1521 |
! |
|
1522 |
||
1523 |
selectedWorkspacesTextView |
|
1524 |
^ self workspaceViewOfView:(self selectedWorkspace) |
|
3198 | 1525 |
! |
1526 |
||
3193 | 1527 |
workspaceSelectionChanged |
3334 | 1528 |
|wsIndex windowLabel v| |
3193 | 1529 |
|
1530 |
"/ self selected |
|
3334 | 1531 |
self workspaceHolder value:(v := self selectedWorkspace). |
3193 | 1532 |
wsIndex := self selectedWorkspaceIndexHolder value. |
1533 |
||
1534 |
wsIndex ~~ 0 ifTrue:[ |
|
1535 |
windowLabel := tabList at:wsIndex ifAbsent:nil. |
|
1536 |
windowLabel notNil ifTrue:[self window label:windowLabel]. |
|
1537 |
]. |
|
4267 | 1538 |
! |
1539 |
||
1540 |
workspaceViewOfView:aView |
|
1541 |
|view| |
|
1542 |
||
1543 |
view := aView. |
|
1544 |
(view isScrollWrapper) ifTrue:[ |
|
4313 | 1545 |
view := view scrolledView. |
1546 |
view isNil ifTrue:[^ nil]. |
|
4267 | 1547 |
]. |
1548 |
(view isTextView) ifFalse:[ |
|
1549 |
(view isKindOf:InspectorView) ifFalse:[ |
|
4313 | 1550 |
^ nil |
4267 | 1551 |
]. |
1552 |
view := view workspace. |
|
1553 |
(view isScrollWrapper) ifTrue:[ |
|
1554 |
view := view scrolledView |
|
1555 |
]. |
|
1556 |
]. |
|
1557 |
^ view |
|
3154 | 1558 |
! ! |
1559 |
||
1560 |
!WorkspaceApplication class methodsFor:'documentation'! |
|
1561 |
||
1562 |
version |
|
4481 | 1563 |
^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.55 2003-01-24 17:29:24 cg Exp $' |
3154 | 1564 |
! ! |