author | Claus Gittinger <cg@exept.de> |
Wed, 12 Feb 2003 14:06:01 +0100 | |
changeset 4542 | 1881967c7262 |
parent 4509 | ede2c88a8be4 |
child 4591 | 083328c16498 |
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 |
" |
|
4542 | 619 |
! |
620 |
||
621 |
openWith:initialText |
|
622 |
"launch a new workspace with some initial contents" |
|
623 |
||
624 |
|workspace| |
|
625 |
||
626 |
workspace := self new. |
|
627 |
workspace open. |
|
628 |
workspace selectedWorkspace contents:initialText. |
|
629 |
^ workspace |
|
630 |
||
631 |
" |
|
632 |
WorkspaceApplication openWith:'Transcript showCR:''hello world''' |
|
633 |
" |
|
3332 | 634 |
! ! |
635 |
||
3154 | 636 |
!WorkspaceApplication methodsFor:'accessing'! |
637 |
||
3193 | 638 |
selectedWorkspace |
639 |
|wsIndex| |
|
640 |
||
641 |
workspaces isNil ifTrue:[ |
|
642 |
workspaces := OrderedCollection new. |
|
643 |
]. |
|
644 |
wsIndex := self selectedWorkspaceIndexHolder value. |
|
645 |
wsIndex == 0 ifTrue:[ |
|
646 |
^ nil |
|
647 |
]. |
|
648 |
||
649 |
workspaces size < wsIndex ifTrue:[ |
|
650 |
workspaces grow:wsIndex. |
|
651 |
workspaces at:wsIndex put:(HVScrollableView for:Workspace). |
|
652 |
]. |
|
653 |
^ workspaces at:wsIndex |
|
654 |
! |
|
655 |
||
656 |
tabMenuAt:index |
|
3196 | 657 |
|m i ws| |
3193 | 658 |
|
659 |
m := self class tabMenu. |
|
660 |
m := m decodeAsLiteralArray. |
|
661 |
i := m detectItem:[:item | item value == #removeWorkspace:] ifNone:nil. |
|
662 |
i notNil ifTrue:[ |
|
663 |
i argument:index. |
|
664 |
index ~~ self selectedWorkspaceIndexHolder value ifTrue:[ |
|
665 |
"/ for now: if that buffer is modified, |
|
666 |
"/ do not allow removing. |
|
667 |
"/ (must be brought to front, in order for check-for-modification to work) |
|
3196 | 668 |
ws := workspaces at:index. |
669 |
(ws isKindOf:ScrollableView) ifTrue:[ |
|
670 |
ws := ws scrolledView |
|
671 |
]. |
|
672 |
((ws isKindOf:TextView) not |
|
673 |
or:[ ws modified ]) |
|
674 |
ifTrue:[ |
|
3193 | 675 |
i disable |
676 |
]. |
|
677 |
]. |
|
678 |
]. |
|
679 |
i := m detectItem:[:item | item value == #renameWorkspace:] ifNone:nil. |
|
680 |
i notNil ifTrue:[ |
|
681 |
i argument:index. |
|
682 |
]. |
|
683 |
||
684 |
m findGuiResourcesIn:self. |
|
685 |
^ m |
|
686 |
! |
|
687 |
||
688 |
workspaceHolder |
|
689 |
workspaceHolder isNil ifTrue:[ |
|
3207 | 690 |
workspaceHolder := ValueHolder with:(self selectedWorkspace). |
3193 | 691 |
]. |
692 |
^ workspaceHolder |
|
693 |
! ! |
|
694 |
||
695 |
!WorkspaceApplication methodsFor:'aspects'! |
|
696 |
||
4474 | 697 |
autoDefineVariables |
698 |
autoDefineVariables isNil ifTrue:[ |
|
699 |
autoDefineVariables := ValueHolder new. |
|
700 |
(UserPreferences current autoDefineWorkspaceVariables) ifTrue:[ |
|
701 |
autoDefineVariables value:#workspace |
|
702 |
]. |
|
703 |
autoDefineVariables onChangeSend:#autoDefineVariablesChanged to:self. |
|
704 |
]. |
|
705 |
^ autoDefineVariables. |
|
706 |
! |
|
707 |
||
3667 | 708 |
autoDefineWorkspaceVariables |
709 |
"does not work yet - needs more interaction with parser" |
|
710 |
||
711 |
autoDefineWorkspaceVariables isNil ifTrue:[ |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
712 |
autoDefineWorkspaceVariables := UserPreferences current autoDefineWorkspaceVariables asValue. |
3667 | 713 |
autoDefineWorkspaceVariables onChangeSend:#autoDefineWorkspaceVariablesChanged to:self. |
714 |
]. |
|
715 |
^ autoDefineWorkspaceVariables. |
|
716 |
! |
|
717 |
||
4136 | 718 |
hasHistory |
719 |
^ Workspace doItHistory size > 0. |
|
720 |
! |
|
721 |
||
3193 | 722 |
selectedWorkspaceIndexHolder |
723 |
selectedWorkspaceIndexHolder isNil ifTrue:[ |
|
724 |
selectedWorkspaceIndexHolder := 1 asValue. |
|
725 |
selectedWorkspaceIndexHolder onChangeSend:#workspaceSelectionChanged to:self. |
|
726 |
]. |
|
727 |
^ selectedWorkspaceIndexHolder. |
|
728 |
! |
|
729 |
||
730 |
tabList |
|
731 |
tabList isNil ifTrue:[ |
|
732 |
tabList := List new. |
|
733 |
]. |
|
734 |
^ tabList. |
|
735 |
! ! |
|
736 |
||
4358 | 737 |
!WorkspaceApplication methodsFor:'aspects-queries'! |
3193 | 738 |
|
3812 | 739 |
anyWorkspaceVariableIsDefined |
740 |
^ Workspace workspaceVariables size > 0 |
|
741 |
! |
|
742 |
||
3193 | 743 |
canRemoveWorkspace |
3214 | 744 |
^ self canRemoveWorkspace:(self selectedWorkspaceIndexHolder value) |
745 |
! |
|
746 |
||
747 |
canRemoveWorkspace:idx |
|
3193 | 748 |
^ self tabList size > 1 |
3214 | 749 |
"/ and:[ (self workspacesTextViewAt:(self selectedWorkspaceIndexHolder value)) |
3391
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
750 |
! |
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
751 |
|
4267 | 752 |
hasMultipleBuffersHolder |
753 |
^ [ workspaces size > 1 ] |
|
754 |
! |
|
755 |
||
3391
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
756 |
hasSelectionInActiveWorkspace |
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
757 |
^ self selectedWorkspacesTextView selectionAsString size > 0 |
3154 | 758 |
! ! |
759 |
||
760 |
!WorkspaceApplication methodsFor:'initialization & release'! |
|
761 |
||
762 |
closeRequest |
|
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
763 |
(self askIfAnyModified:'Text was not saved. Close anyway ?' yesButton:'Close') ifFalse:[ |
3154 | 764 |
^ self |
765 |
]. |
|
766 |
||
767 |
^ super closeRequest |
|
768 |
! ! |
|
769 |
||
4359 | 770 |
!WorkspaceApplication methodsFor:'menu-actions'! |
3154 | 771 |
|
4154 | 772 |
addGlobalVariable |
773 |
|name nameKey selection| |
|
774 |
||
775 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
776 |
||
777 |
name := Dialog |
|
778 |
request:'Name of new Global Variable:' |
|
779 |
initialAnswer:(selection asString string) |
|
780 |
okLabel:'Add' |
|
781 |
title:'Enter Variable Name'. |
|
782 |
name size == 0 ifTrue:[ |
|
783 |
^ self |
|
784 |
]. |
|
785 |
nameKey := name asSymbol. |
|
786 |
||
4284 | 787 |
(Smalltalk includesKey:nameKey) ifTrue:[ |
4154 | 788 |
self warn:'Global named ''' , name , ''' already exists.'. |
789 |
^ self. |
|
790 |
]. |
|
791 |
Smalltalk at:nameKey put:nil. |
|
792 |
! |
|
793 |
||
4099 | 794 |
addGlobalVariableInspector |
795 |
|v| |
|
796 |
||
797 |
v := self addInspectorOn:(Smalltalk) basic:false suppressPseudoSlots:true. |
|
798 |
v fieldListLabel:'Name'. |
|
4208 | 799 |
self renameWorkspace:(self selectedWorkspaceIndexHolder value) to:'Globals (Smalltalk)'. |
4099 | 800 |
! |
801 |
||
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
802 |
addInspectorOn:aValue basic:isBasicInspector suppressPseudoSlots:suppressPseudoSlots |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
803 |
|view cls resultString| |
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 |
isBasicInspector ifFalse:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
806 |
cls := aValue inspectorClass. |
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 |
cls isNil ifTrue:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
809 |
cls := InspectorView |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
810 |
]. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
811 |
view := cls new. |
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
812 |
view suppressPseudoSlots:suppressPseudoSlots. |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
813 |
view inspect:aValue. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
814 |
"/ v allowFollow:true. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
815 |
aValue isBehavior ifTrue:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
816 |
resultString := aValue name |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
817 |
] ifFalse:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
818 |
resultString := aValue classNameWithArticle |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
819 |
]. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
820 |
self addWindow:view named:('Inspecting: ' , resultString). |
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
821 |
^ view |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
822 |
! |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
823 |
|
3196 | 824 |
addWindow:aWindow named:name |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
825 |
^ self addWindow:aWindow named:name asFirst:false |
3334 | 826 |
! |
827 |
||
828 |
addWindow:aWindow named:name asFirst:asFirst |
|
829 |
|tabList wsIndex newSelectedIndex| |
|
3193 | 830 |
|
831 |
tabList := self tabList. |
|
832 |
wsIndex := tabList size + 1. |
|
833 |
wsIndex == 1 ifTrue:[ |
|
834 |
"/ first - add a name for the first tab |
|
835 |
tabList add:(self window label). "/ 'Workspace'. |
|
836 |
wsIndex := wsIndex + 1. |
|
837 |
]. |
|
838 |
||
839 |
workspaces grow:wsIndex. |
|
3334 | 840 |
asFirst ifTrue:[ |
841 |
tabList addFirst:(name bindWith:wsIndex). |
|
842 |
workspaces replaceFrom:2 to:wsIndex with:workspaces startingAt:1. |
|
843 |
newSelectedIndex := 1. |
|
844 |
] ifFalse:[ |
|
845 |
tabList addLast:(name bindWith:wsIndex). |
|
846 |
newSelectedIndex := wsIndex. |
|
847 |
]. |
|
848 |
workspaces at:newSelectedIndex put:aWindow. |
|
849 |
self selectedWorkspaceIndexHolder value:newSelectedIndex. |
|
850 |
"/ workspaceHolder value:aWindow. |
|
3193 | 851 |
! |
852 |
||
3196 | 853 |
addWorkspace |
854 |
self addWindow:(HVScrollableView for:Workspace) named:'Workspace%1' |
|
855 |
! |
|
856 |
||
3722 | 857 |
addWorkspaceVariable |
858 |
|name selection| |
|
859 |
||
860 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
861 |
||
862 |
name := Dialog |
|
863 |
request:'Name of new Workspace Variable:' |
|
864 |
initialAnswer:(selection asString string) |
|
865 |
okLabel:'Add' |
|
866 |
title:'Enter Variable Name'. |
|
867 |
name size == 0 ifTrue:[ |
|
868 |
^ self |
|
869 |
]. |
|
870 |
Workspace addWorkspaceVariable:name. |
|
871 |
! |
|
872 |
||
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
873 |
addWorkspaceVariableInspector |
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
874 |
|v| |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
875 |
|
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
876 |
v := self addInspectorOn:(Workspace workspaceVariables) basic:false suppressPseudoSlots:true. |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
877 |
v dereferenceValueHolders:true. |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
878 |
v fieldListLabel:'Name'. |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
879 |
self renameWorkspace:(self selectedWorkspaceIndexHolder value) to:'Variables'. |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
880 |
! |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
881 |
|
3752 | 882 |
askForFilterBlock:message template:template rememberIn:nameOfClassVar |
883 |
|filterBlockString filterBlock dialog textHolder classVarValue| |
|
884 |
||
885 |
classVarValue := self class classVarAt:nameOfClassVar ifAbsent:nil. |
|
886 |
classVarValue isNil ifTrue:[ |
|
887 |
self class classVarAt:nameOfClassVar put:template. |
|
888 |
classVarValue := template. |
|
889 |
]. |
|
890 |
||
891 |
textHolder := ValueHolder new. |
|
892 |
dialog := Dialog |
|
893 |
forRequestText:(resources string:message) |
|
894 |
lines:25 |
|
895 |
columns:70 |
|
896 |
initialAnswer:classVarValue |
|
897 |
model:textHolder. |
|
898 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
899 |
dialog open. |
|
900 |
dialog accepted ifFalse:[^ nil]. |
|
901 |
||
902 |
filterBlockString := textHolder value. |
|
903 |
self class classVarAt:nameOfClassVar put:filterBlockString. |
|
904 |
||
905 |
filterBlock := Parser evaluate:filterBlockString. |
|
906 |
filterBlock isBlock ifFalse:[ |
|
907 |
self halt:'oops - bad input'. |
|
908 |
^ nil |
|
909 |
]. |
|
910 |
||
911 |
^ filterBlock |
|
912 |
! |
|
913 |
||
4474 | 914 |
autoDefineVariablesChanged |
915 |
|autoDefine| |
|
916 |
||
917 |
autoDefine := autoDefineVariables value. |
|
918 |
UserPreferences current autoDefineWorkspaceVariables:(autoDefine == #workspace). |
|
919 |
workspaces do:[:each | |
|
920 |
each autoDefineVariables:autoDefine |
|
921 |
]. |
|
922 |
! |
|
923 |
||
3667 | 924 |
autoDefineWorkspaceVariablesChanged |
925 |
"does not work yet - needs more interaction with parser" |
|
926 |
||
927 |
|doAutoDefine| |
|
928 |
||
929 |
doAutoDefine := autoDefineWorkspaceVariables value. |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
930 |
UserPreferences current autoDefineWorkspaceVariables:doAutoDefine. |
3667 | 931 |
workspaces do:[:each | |
932 |
each autoDefineWorkspaceVariables:doAutoDefine |
|
933 |
]. |
|
934 |
! |
|
935 |
||
4480 | 936 |
babelFishTranslate:fromToModeString |
937 |
"translate the selected text and paste it after the selection" |
|
938 |
||
4509
ede2c88a8be4
babelFish service moved to editor
Claus Gittinger <cg@exept.de>
parents:
4481
diff
changeset
|
939 |
self selectedWorkspace babelFishTranslate:fromToModeString |
4480 | 940 |
! |
941 |
||
3198 | 942 |
basicInspectIt |
943 |
self inspectIt:true |
|
944 |
! |
|
945 |
||
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
946 |
browseImplementorsOfIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
947 |
self selectedWorkspacesTextView browseImplementorsOfIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
948 |
! |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
949 |
|
3154 | 950 |
browseIt |
3198 | 951 |
self selectedWorkspacesTextView browseIt |
3154 | 952 |
! |
953 |
||
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
954 |
browseReferencesToIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
955 |
self selectedWorkspacesTextView browseReferencesToIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
956 |
! |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
957 |
|
4136 | 958 |
clearHistory |
959 |
Workspace clearDoItHistory |
|
960 |
! |
|
961 |
||
3154 | 962 |
copySelection |
3198 | 963 |
self selectedWorkspacesTextView copySelection |
3154 | 964 |
! |
965 |
||
966 |
cutSelection |
|
3198 | 967 |
self selectedWorkspacesTextView cutSelection |
3154 | 968 |
! |
969 |
||
970 |
doIt |
|
3198 | 971 |
self selectedWorkspacesTextView doIt |
3154 | 972 |
! |
973 |
||
3752 | 974 |
filterText |
975 |
|template filterBlock newList oldList answer nDeleted deletedLines| |
|
976 |
||
977 |
template := |
|
978 |
'"/ general text filter; |
|
979 |
"/ the following block should evaluate to true for all lines |
|
980 |
"/ you want to keep - lines for which the block returns false will be removed. |
|
981 |
"/ Beginner warning: Smalltalk know-how is useful here. |
|
982 |
||
983 |
[:line | |
|
984 |
"/ any condition on line. |
|
985 |
"/ Notice, that line might be a Text object (i.e. non-string), |
|
986 |
"/ so you may want to use line string. |
|
987 |
"/ |
|
988 |
"/ Useful queries on the line are: |
|
989 |
"/ - size the length of the line |
|
990 |
"/ - hasChangeOfEmphasis any bold, italic etc. |
|
991 |
"/ - startsWith:someString |
|
992 |
"/ - endsWith:someString |
|
993 |
||
994 |
"/ example filter (removes all empty lines) |
|
995 |
"/ |
|
996 |
"/ line size > 0 |
|
997 |
||
998 |
"/ example filter (removes all lines which do not end with some suffix) |
|
999 |
"/ |
|
1000 |
"/ (line asLowercase endsWith:''foo'') not |
|
1001 |
||
1002 |
"/ dummy filter (keeps all lines) |
|
1003 |
"/ |
|
1004 |
true |
|
1005 |
] |
|
1006 |
'. |
|
1007 |
||
1008 |
filterBlock := self askForFilterBlock:'Filter block:' |
|
1009 |
template:template |
|
1010 |
rememberIn:#LastFilterBlockString. |
|
1011 |
filterBlock isNil ifTrue:[^ self]. |
|
1012 |
||
1013 |
oldList := self selectedWorkspacesTextView list. |
|
1014 |
oldList := oldList collect:[:lineOrNil | lineOrNil ? '']. |
|
1015 |
newList := oldList select:filterBlock. |
|
1016 |
newList := newList collect:[:line | (line isString and:[line size == 0]) ifTrue:[nil] ifFalse:[line]]. |
|
1017 |
nDeleted := oldList size - newList size. |
|
1018 |
nDeleted == 0 ifTrue:[ |
|
1019 |
self information:'No lines were deleted.'. |
|
1020 |
^ self |
|
1021 |
]. |
|
1022 |
||
1023 |
answer := Dialog confirmWithCancel:(resources |
|
1024 |
string:'%1 lines remain (%2 deleted). Change text ?' |
|
1025 |
with:newList size |
|
1026 |
with:nDeleted) |
|
1027 |
labels:#( 'Cancel' 'No, Show Deleted' 'Yes'). |
|
1028 |
answer isNil ifTrue:[^ self]. |
|
1029 |
answer ifFalse:[ |
|
1030 |
deletedLines := oldList reject:filterBlock. |
|
1031 |
TextBox openOn:(deletedLines asStringCollection) title:'Filtered lines'. |
|
1032 |
^ self. |
|
1033 |
]. |
|
1034 |
||
1035 |
self selectedWorkspacesTextView list:newList. |
|
1036 |
! |
|
1037 |
||
4480 | 1038 |
googleSpellingSuggestion |
1039 |
self selectedWorkspacesTextView googleSpellingSuggestion |
|
1040 |
! |
|
1041 |
||
3154 | 1042 |
inspectIt |
3198 | 1043 |
self inspectIt:false |
1044 |
! |
|
1045 |
||
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1046 |
inspectIt:isBasicInspector |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1047 |
|ws| |
3196 | 1048 |
|
3198 | 1049 |
ws := self selectedWorkspacesTextView. |
3196 | 1050 |
ws |
1051 |
do:(ws selection) |
|
1052 |
withValueDo:[:result | |
|
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
1053 |
self addInspectorOn:result basic:isBasicInspector suppressPseudoSlots:false |
3196 | 1054 |
] |
1055 |
||
1056 |
"/ self selectedWorkspace inspectIt |
|
3154 | 1057 |
! |
1058 |
||
3812 | 1059 |
inspectWorkspaceVariables |
1060 |
|wsvars| |
|
1061 |
||
1062 |
wsvars := Workspace workspaceVariables. |
|
1063 |
wsvars size == 0 ifTrue:[ |
|
1064 |
Dialog information:'No Workspace Variables are defined'. |
|
1065 |
^ self |
|
1066 |
]. |
|
1067 |
wsvars inspect |
|
1068 |
! |
|
1069 |
||
3332 | 1070 |
loadFile:aFileName |
1071 |
|file ws lbl| |
|
1072 |
||
1073 |
file := aFileName asFilename. |
|
3507 | 1074 |
(ws := self selectedWorkspacesTextView) contents:file contents. |
3332 | 1075 |
ws modified:false. |
1076 |
||
1077 |
lbl := file withoutSuffix baseName. |
|
1078 |
tabList size <= 1 ifTrue:[ |
|
1079 |
self window label:lbl. |
|
1080 |
] ifFalse:[ |
|
1081 |
tabList at:self selectedWorkspaceIndexHolder value put:lbl |
|
1082 |
] |
|
1083 |
! |
|
1084 |
||
3154 | 1085 |
menuLoad |
3332 | 1086 |
|file| |
3154 | 1087 |
|
3193 | 1088 |
(self askIfModified:'Text was modified. Load anyway ?' yesButton:'Load') ifFalse:[ ^ self]. |
1089 |
||
3469 | 1090 |
file := Dialog requestFileName:'Load file:' default:'file.wsp' pattern:'*.wsp'. |
3154 | 1091 |
file size > 0 ifTrue:[ |
3332 | 1092 |
self loadFile:file |
3154 | 1093 |
] |
1094 |
! |
|
1095 |
||
4267 | 1096 |
menuSaveAllAs |
1097 |
self |
|
1098 |
askForFile:'Save all Buffers into:' |
|
1099 |
thenDo:[:file :doAppend | |
|
1100 |
|ws append| |
|
3473
1120657c3d2e
added Append-option to saveAs
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
1101 |
|
4267 | 1102 |
append := doAppend. |
1103 |
workspaces do:[:subView | |
|
1104 |
|ws| |
|
3154 | 1105 |
|
4267 | 1106 |
ws := self workspaceViewOfView:subView. |
1107 |
ws notNil ifTrue:[ |
|
1108 |
ws saveAs:file doAppend:append. |
|
1109 |
ws modified:false. |
|
1110 |
]. |
|
1111 |
append := true. |
|
1112 |
]. |
|
1113 |
] |
|
1114 |
! |
|
3473
1120657c3d2e
added Append-option to saveAs
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
1115 |
|
4267 | 1116 |
menuSaveAs |
1117 |
self |
|
1118 |
askForFile:'Save Buffer into:' |
|
1119 |
thenDo:[:file :doAppend | |
|
1120 |
|ws| |
|
1121 |
||
1122 |
ws := self selectedWorkspacesTextView. |
|
1123 |
ws saveAs:file doAppend:doAppend. |
|
1124 |
ws modified:false. |
|
1125 |
] |
|
3154 | 1126 |
! |
1127 |
||
3334 | 1128 |
newSystemWorkspace |
1129 |
self class openSystemWorkspace |
|
1130 |
! |
|
1131 |
||
3651 | 1132 |
newWorkspace |
1133 |
self class open |
|
1134 |
! |
|
1135 |
||
3154 | 1136 |
openDocumentation |
1137 |
"opens the documentation file" |
|
1138 |
||
1139 |
self openHTMLDocument: 'tools/misc/TOP.html#WORKSPACE' |
|
1140 |
! |
|
1141 |
||
1142 |
paste |
|
3198 | 1143 |
self selectedWorkspacesTextView paste |
3154 | 1144 |
! |
1145 |
||
4267 | 1146 |
paste:aString |
4136 | 1147 |
self selectedWorkspacesTextView paste:aString. |
4267 | 1148 |
! |
1149 |
||
1150 |
pasteAndExecute:aString |
|
1151 |
self paste:aString. |
|
4136 | 1152 |
self printIt |
1153 |
! |
|
1154 |
||
4267 | 1155 |
pasteLastDoIt |
1156 |
|s| |
|
1157 |
||
1158 |
s := self lastDoItsString. |
|
1159 |
s notNil ifTrue:[ |
|
1160 |
self paste:s |
|
1161 |
] |
|
1162 |
! |
|
1163 |
||
3154 | 1164 |
printIt |
3198 | 1165 |
self selectedWorkspacesTextView printIt |
3193 | 1166 |
! |
1167 |
||
3752 | 1168 |
processText |
1169 |
|template filterBlock newList oldList answer nChanged changedLines flags| |
|
1170 |
||
1171 |
template := |
|
1172 |
'"/ general text processor; |
|
1173 |
"/ the following block should evaluate to a new line, |
|
1174 |
"/ given the original line as argument. |
|
1175 |
"/ Beginner warning: Smalltalk know-how is useful here. |
|
1176 |
||
1177 |
[:line | |
|
1178 |
"/ any processing on line. |
|
1179 |
"/ Notice, that line might be a Text object (i.e. non-string), |
|
1180 |
"/ |
|
1181 |
"/ Useful operations on the line are: |
|
1182 |
"/ - '' .... '' , concatenation of any prefix/suffix |
|
1183 |
"/ - leftPaddedTo:size padding |
|
1184 |
"/ - rightPaddedTo:size padding |
|
1185 |
"/ - copyTo:(size min:N) |
|
1186 |
"/ - asUppercase |
|
1187 |
"/ - asLowercase |
|
4141 | 1188 |
"/ - withoutSeparators remove whiteSpace |
1189 |
"/ - asCollectionOfWords words |
|
3752 | 1190 |
|
1191 |
"/ makes everything bold |
|
1192 |
"/ |
|
1193 |
"/ line allBold |
|
1194 |
||
4141 | 1195 |
"/ first word only |
1196 |
"/ |
|
1197 |
"/ line withoutSeparators asCollectionOfWords first |
|
1198 |
||
3752 | 1199 |
"/ dummy filter (keeps all lines as-is) |
1200 |
"/ |
|
1201 |
line |
|
1202 |
] |
|
1203 |
'. |
|
1204 |
filterBlock := self askForFilterBlock:'Processing block:' |
|
1205 |
template:template |
|
1206 |
rememberIn:#LastProcessingBlockString. |
|
1207 |
filterBlock isNil ifTrue:[^ self]. |
|
1208 |
||
1209 |
oldList := self selectedWorkspacesTextView list. |
|
1210 |
oldList := oldList collect:[:lineOrNil | lineOrNil ? '']. |
|
4141 | 1211 |
newList := oldList collect:[:line | |newLine| |
1212 |
newLine := line. |
|
1213 |
Error handle:[:ex | |
|
1214 |
] do:[ |
|
1215 |
newLine := filterBlock value:line |
|
1216 |
]. |
|
1217 |
newLine |
|
1218 |
]. |
|
3752 | 1219 |
newList := newList collect:[:line | (line isString and:[line size == 0]) ifTrue:[nil] ifFalse:[line]]. |
1220 |
||
1221 |
flags := (1 to:oldList size) collect:[:i | (oldList at:i) ~= (newList at:i)]. |
|
1222 |
flags := flags select:[:flag | flag]. |
|
1223 |
nChanged := flags size. |
|
1224 |
nChanged == 0 ifTrue:[ |
|
1225 |
self information:'No lines were changed.'. |
|
1226 |
^ self |
|
1227 |
]. |
|
1228 |
||
1229 |
answer := Dialog confirmWithCancel:(resources |
|
1230 |
string:'%1 lines changed. Change text ?' |
|
1231 |
with:nChanged) |
|
1232 |
labels:#( 'Cancel' 'No, Show Changed' 'Yes'). |
|
1233 |
answer isNil ifTrue:[^ self]. |
|
1234 |
answer ifFalse:[ |
|
1235 |
changedLines := (1 to:oldList size) select:[:i | (oldList at:i) ~= (newList at:i)]. |
|
1236 |
changedLines := changedLines collect:[:i | (newList at:i)]. |
|
1237 |
TextBox openOn:(changedLines asStringCollection) title:'Changed lines'. |
|
1238 |
^ self. |
|
1239 |
]. |
|
1240 |
||
1241 |
self selectedWorkspacesTextView list:newList. |
|
1242 |
! |
|
1243 |
||
4136 | 1244 |
redoLastDoIt |
4267 | 1245 |
|s| |
4136 | 1246 |
|
4267 | 1247 |
s := self lastDoItsString. |
1248 |
s notNil ifTrue:[ |
|
1249 |
self pasteAndExecute:s |
|
1250 |
] |
|
4136 | 1251 |
! |
1252 |
||
3722 | 1253 |
removeAllWorkspaceVariables |
1254 |
(Dialog confirm:'Do you really want to remove all Workspace Variables ?') |
|
1255 |
ifTrue:[ |
|
1256 |
Workspace removeAllWorkspaceVariables |
|
1257 |
]. |
|
1258 |
! |
|
1259 |
||
4284 | 1260 |
removeGlobalVariable |
1261 |
|name nameKey selection value| |
|
1262 |
||
1263 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
1264 |
||
1265 |
name := Dialog |
|
1266 |
request:'Remove Global Variable:' |
|
1267 |
initialAnswer:(selection asString string) |
|
1268 |
okLabel:'Remove' |
|
1269 |
title:'Remove Global'. |
|
1270 |
||
1271 |
name size == 0 ifTrue:[^ self]. |
|
1272 |
nameKey := name asSymbolIfInterned. |
|
1273 |
nameKey isNil ifTrue:[^ self]. |
|
1274 |
||
1275 |
(Smalltalk includesKey:nameKey) ifFalse:[ |
|
1276 |
self warn:('No such Global Binding: ''%1''.' bindWith:name). |
|
1277 |
^ self. |
|
1278 |
]. |
|
1279 |
||
1280 |
value := Smalltalk at:nameKey. |
|
1281 |
value notNil ifTrue:[ |
|
1282 |
(self confirm:('Global ''%1'' is currently bound to %2\\Remove Binding ?' bindWith:name with:value) withCRs) |
|
1283 |
ifFalse:[ |
|
1284 |
^ self. |
|
1285 |
]. |
|
1286 |
]. |
|
1287 |
Smalltalk at:nameKey put:nil. |
|
1288 |
Smalltalk removeKey:nameKey |
|
1289 |
! |
|
1290 |
||
3193 | 1291 |
removeWorkspace |
1292 |
self removeWorkspace:(self selectedWorkspaceIndexHolder value) |
|
1293 |
! |
|
1294 |
||
1295 |
removeWorkspace:wsIndex |
|
1296 |
|tabList newWsIndex| |
|
1297 |
||
1298 |
wsIndex == self selectedWorkspaceIndexHolder value ifTrue:[ |
|
1299 |
(self askIfModified:'Text was modified. Remove anyway ?' yesButton:'Remove') ifFalse:[ |
|
1300 |
^ self |
|
1301 |
]. |
|
1302 |
]. |
|
1303 |
||
1304 |
tabList := self tabList. |
|
1305 |
||
1306 |
wsIndex == tabList size ifTrue:[ |
|
1307 |
newWsIndex := wsIndex - 1. |
|
1308 |
] ifFalse:[ |
|
1309 |
newWsIndex := wsIndex. |
|
1310 |
]. |
|
1311 |
||
1312 |
tabList removeIndex:wsIndex. |
|
1313 |
(workspaces at:wsIndex) destroy. |
|
1314 |
workspaces removeIndex:wsIndex. |
|
1315 |
||
1316 |
tabList size == 1 ifTrue:[ |
|
1317 |
self window label:(tabList at:1). |
|
1318 |
tabList removeIndex:1 |
|
1319 |
]. |
|
1320 |
||
3334 | 1321 |
workspaceHolder value:(workspaces at:newWsIndex). |
3193 | 1322 |
self selectedWorkspaceIndexHolder value:newWsIndex. |
1323 |
"/ to force change (update workspaceHolder - even if same index) |
|
1324 |
self selectedWorkspaceIndexHolder changed:#value. |
|
1325 |
! |
|
1326 |
||
3722 | 1327 |
removeWorkspaceVariable |
3812 | 1328 |
|name selection wsvars| |
1329 |
||
1330 |
wsvars := Workspace workspaceVariables. |
|
1331 |
wsvars size == 0 ifTrue:[ |
|
1332 |
Dialog information:'No Workspace Variables are defined'. |
|
1333 |
^ self |
|
1334 |
]. |
|
3722 | 1335 |
|
1336 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
1337 |
||
1338 |
name := Dialog |
|
1339 |
request:'Variable to remove:' |
|
1340 |
initialAnswer:(selection asString string) |
|
1341 |
okLabel:'Remove' |
|
1342 |
title:'Enter Variable Name' |
|
3812 | 1343 |
list:(wsvars keys asOrderedCollection sort). |
3722 | 1344 |
name size == 0 ifTrue:[ |
1345 |
^ self |
|
1346 |
]. |
|
1347 |
Workspace removeWorkspaceVariable:name. |
|
1348 |
! |
|
1349 |
||
3193 | 1350 |
renameWorkspace |
1351 |
self renameWorkspace:(self selectedWorkspaceIndexHolder value) |
|
1352 |
! |
|
1353 |
||
1354 |
renameWorkspace:wsIndex |
|
1355 |
|tabList oldName newName| |
|
1356 |
||
1357 |
tabList := self tabList. |
|
1358 |
tabList isEmpty ifTrue:[ |
|
1359 |
oldName := self window label |
|
1360 |
] ifFalse:[ |
|
1361 |
oldName := tabList at:wsIndex. |
|
1362 |
]. |
|
1363 |
newName := Dialog request:(resources string:'New Name for %1:' with:oldName) initialAnswer:oldName. |
|
1364 |
newName size == 0 ifTrue:[ ^ self]. |
|
1365 |
||
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1366 |
self renameWorkspace:wsIndex to:newName. |
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 |
|
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1369 |
renameWorkspace:wsIndex to:newName |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1370 |
|tabList| |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1371 |
|
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1372 |
tabList := self tabList. |
3193 | 1373 |
tabList notEmpty ifTrue:[ |
1374 |
tabList at:wsIndex put:newName. |
|
1375 |
]. |
|
1376 |
wsIndex == self selectedWorkspaceIndexHolder value ifTrue:[ |
|
1377 |
self window label:newName. |
|
1378 |
]. |
|
3384 | 1379 |
! |
1380 |
||
1381 |
spyOnIt |
|
1382 |
self selectedWorkspacesTextView spyOnIt |
|
1383 |
! |
|
1384 |
||
1385 |
timeIt |
|
1386 |
self selectedWorkspacesTextView timeIt |
|
3154 | 1387 |
! ! |
1388 |
||
4136 | 1389 |
!WorkspaceApplication methodsFor:'menu-dynamic'! |
1390 |
||
4267 | 1391 |
pasteRecentDoItMenu |
1392 |
<resource: #programMenu > |
|
1393 |
||
1394 |
^ self recentDoItsMenuFor:#'paste:' |
|
1395 |
! |
|
1396 |
||
1397 |
recentDoItsMenuFor:aSelector |
|
4136 | 1398 |
<resource: #programMenu > |
1399 |
||
1400 |
^ [ |
|
1401 |
|doIts m classHistory currentClass| |
|
1402 |
||
1403 |
doIts := Workspace doItHistory. |
|
1404 |
doIts size > 0 ifTrue:[ |
|
1405 |
m := Menu new. |
|
1406 |
doIts do:[:doItEntry | |
|
1407 |
|lines label item| |
|
1408 |
||
1409 |
label := doItEntry withoutLeadingSeparators asStringCollection first. |
|
1410 |
(label size > 20) ifTrue:[ |
|
1411 |
label := (label contractTo:20) |
|
1412 |
] ifFalse:[ |
|
1413 |
(lines size > 1) ifTrue:[ |
|
1414 |
label := label , '...' |
|
1415 |
]. |
|
1416 |
]. |
|
1417 |
label := '''' , label , ''''. |
|
1418 |
||
1419 |
item := MenuItem label:label. |
|
1420 |
m addItem:item. |
|
4267 | 1421 |
item value:aSelector. |
4136 | 1422 |
item argument:doItEntry. |
1423 |
]. |
|
1424 |
m addItem: (MenuItem new label:'-'). |
|
1425 |
m addItem: (MenuItem new |
|
1426 |
label: 'Clear History'; |
|
1427 |
value: #clearHistory; |
|
1428 |
activeHelpKey: #historyEmptyMenu; |
|
1429 |
translateLabel:true). |
|
1430 |
]. |
|
1431 |
m |
|
1432 |
]. |
|
4267 | 1433 |
! |
1434 |
||
1435 |
redoRecentDoItMenu |
|
1436 |
<resource: #programMenu > |
|
1437 |
||
1438 |
^ self recentDoItsMenuFor:#'pasteAndExecute:' |
|
4136 | 1439 |
! ! |
1440 |
||
3154 | 1441 |
!WorkspaceApplication methodsFor:'private'! |
1442 |
||
4267 | 1443 |
askForFile:question thenDo:aBlock |
1444 |
|file doAppend| |
|
1445 |
||
1446 |
doAppend := false. |
|
1447 |
Dialog aboutToOpenBoxNotificationSignal handle:[:n | |
|
1448 |
|box| |
|
1449 |
||
1450 |
box := n parameter. |
|
1451 |
box addButton:(Button label:'Append' |
|
1452 |
action:[doAppend := true. box okPressed]). |
|
1453 |
n proceed. |
|
1454 |
] do:[ |
|
1455 |
file := Dialog requestFileName:question default:'file.wsp'. |
|
1456 |
]. |
|
1457 |
file isEmptyOrNil ifFalse:[ |
|
1458 |
aBlock value:file value:doAppend |
|
1459 |
]. |
|
1460 |
! |
|
1461 |
||
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1462 |
askIfAnyModified:question yesButton:yesButtonText |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1463 |
(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
|
1464 |
|
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1465 |
(Dialog |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1466 |
confirm:(resources string:question) withCRs |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1467 |
yesLabel:(resources at:yesButtonText) |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1468 |
noLabel:(resources at:'Cancel')) |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1469 |
ifTrue:[ |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1470 |
"/ 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
|
1471 |
(workspaces select:[:aView | (self isModifiedWorkspace:aView)]) |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1472 |
do:[:eachModifiedTextView | |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1473 |
eachModifiedTextView modified: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 |
^ true |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1476 |
]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1477 |
^ false |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1478 |
! |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1479 |
|
3154 | 1480 |
askIfModified:question yesButton:yesButtonText |
1481 |
"tell user, that code has been modified - let her confirm" |
|
1482 |
||
1483 |
|textView| |
|
1484 |
||
3193 | 1485 |
textView := self selectedWorkspace. |
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1486 |
(self isModifiedWorkspace:textView) ifFalse:[^ true]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1487 |
|
3154 | 1488 |
(Dialog |
1489 |
confirm:(resources string:question) withCRs |
|
1490 |
yesLabel:(resources at:yesButtonText) |
|
1491 |
noLabel:(resources at:'Cancel')) |
|
1492 |
ifTrue:[ |
|
1493 |
"/ reset modified flag so question is asked only once |
|
1494 |
textView modified:false. |
|
1495 |
^ true |
|
1496 |
]. |
|
1497 |
^ false |
|
1498 |
||
1499 |
"Modified: 2.10.1997 / 14:23:47 / stefan" |
|
3193 | 1500 |
! |
1501 |
||
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1502 |
isModifiedWorkspace:aView |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1503 |
|view| |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1504 |
|
4267 | 1505 |
view := self workspaceViewOfView:aView. |
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1506 |
|
4313 | 1507 |
(view isNil |
1508 |
or:[view modified not |
|
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1509 |
or:[view contentsWasSaved |
4313 | 1510 |
or:[view contents withoutSeparators isEmpty]]]) ifTrue:[ |
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1511 |
^ false |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1512 |
]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1513 |
^ true |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1514 |
! |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1515 |
|
4267 | 1516 |
lastDoItsString |
1517 |
|history| |
|
3198 | 1518 |
|
4267 | 1519 |
history := Workspace doItHistory. |
1520 |
history size > 0 ifFalse:[ |
|
1521 |
self selectedWorkspacesTextView flash. |
|
1522 |
^ nil |
|
3198 | 1523 |
]. |
4267 | 1524 |
^ history first |
1525 |
! |
|
1526 |
||
1527 |
selectedWorkspacesTextView |
|
1528 |
^ self workspaceViewOfView:(self selectedWorkspace) |
|
3198 | 1529 |
! |
1530 |
||
3193 | 1531 |
workspaceSelectionChanged |
3334 | 1532 |
|wsIndex windowLabel v| |
3193 | 1533 |
|
1534 |
"/ self selected |
|
3334 | 1535 |
self workspaceHolder value:(v := self selectedWorkspace). |
3193 | 1536 |
wsIndex := self selectedWorkspaceIndexHolder value. |
1537 |
||
1538 |
wsIndex ~~ 0 ifTrue:[ |
|
1539 |
windowLabel := tabList at:wsIndex ifAbsent:nil. |
|
1540 |
windowLabel notNil ifTrue:[self window label:windowLabel]. |
|
1541 |
]. |
|
4267 | 1542 |
! |
1543 |
||
1544 |
workspaceViewOfView:aView |
|
1545 |
|view| |
|
1546 |
||
1547 |
view := aView. |
|
1548 |
(view isScrollWrapper) ifTrue:[ |
|
4313 | 1549 |
view := view scrolledView. |
1550 |
view isNil ifTrue:[^ nil]. |
|
4267 | 1551 |
]. |
1552 |
(view isTextView) ifFalse:[ |
|
1553 |
(view isKindOf:InspectorView) ifFalse:[ |
|
4313 | 1554 |
^ nil |
4267 | 1555 |
]. |
1556 |
view := view workspace. |
|
1557 |
(view isScrollWrapper) ifTrue:[ |
|
1558 |
view := view scrolledView |
|
1559 |
]. |
|
1560 |
]. |
|
1561 |
^ view |
|
3154 | 1562 |
! ! |
1563 |
||
1564 |
!WorkspaceApplication class methodsFor:'documentation'! |
|
1565 |
||
1566 |
version |
|
4542 | 1567 |
^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.57 2003-02-12 13:06:01 cg Exp $' |
3154 | 1568 |
! ! |