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