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