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