author | Claus Gittinger <cg@exept.de> |
Mon, 12 Oct 2009 13:39:01 +0200 | |
changeset 3968 | 37af1e95c4b4 |
parent 3959 | 2d90b5eaada7 |
child 4057 | 314415319f37 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
2277 | 12 |
"{ Package: 'stx:libwidg' }" |
13 |
||
0 | 14 |
TextCollector subclass:#Workspace |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
15 |
instanceVariableNames:'doItAction codeStartPosition errorFgColor errorBgColor |
2679 | 16 |
commentStrings autoDefineWorkspaceVariables simulatedSelf |
3537 | 17 |
autoDefineVariables compilerClass allowValueDrop |
18 |
poolsConsideredInDoIts' |
|
2492
740174c1be0f
allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents:
2489
diff
changeset
|
19 |
classVariableNames:'DefaultViewBackground DefaultErrorForegroundColor |
3007 | 20 |
DefaultErrorBackgroundColor DefaultWarningBackgroundColor |
3712 | 21 |
DefaultWarningForegroundColor WorkspaceVariables DoItHistory |
22 |
Sniplets' |
|
257 | 23 |
poolDictionaries:'' |
2097 | 24 |
category:'Interface-Smalltalk' |
0 | 25 |
! |
26 |
||
3155 | 27 |
Workspace comment:'declared from: ..\..\..\stx\libwidg\abbrev.stc' |
28 |
! |
|
29 |
||
32 | 30 |
!Workspace class methodsFor:'documentation'! |
31 |
||
38 | 32 |
copyright |
33 |
" |
|
34 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 35 |
All Rights Reserved |
38 | 36 |
|
37 |
This software is furnished under a license and may be used |
|
38 |
only in accordance with the terms of that license and with the |
|
39 |
inclusion of the above copyright notice. This software may not |
|
40 |
be provided or otherwise made available to, or used by, any |
|
41 |
other person. No title to or ownership of the software is |
|
42 |
hereby transferred. |
|
43 |
" |
|
44 |
! |
|
45 |
||
32 | 46 |
documentation |
47 |
" |
|
48 |
a view for editable text which can evaluate expressions. |
|
38 | 49 |
I.e. its basically a view for editable text, with added |
50 |
'doIt', 'printIt' and 'inspectIt' functions on the popup-menu. |
|
125 | 51 |
|
38 | 52 |
The action to be performed on doIt is defined by a block, |
58 | 53 |
which can be defined by the owner of this view. |
60 | 54 |
(thus you can put a workspace into more complex widgets, and |
55 |
control what should happen on 'doIt'). |
|
58 | 56 |
|
578 | 57 |
A useful default action is automatically defined, which simply |
58 |
evaluates the selection as a smalltalk expression. |
|
59 |
(but, a lisp or prolog workspace would define its own action, |
|
60 |
to call for another compiler/interpreter ...) |
|
32 | 61 |
|
123 | 62 |
|
63 |
Caveat: |
|
418 | 64 |
in this version, Workspace does not yet support doIt in MVC setups. |
65 |
For now, simulate this by setting the doItAction, to notify the |
|
66 |
model manually about the doIt. |
|
123 | 67 |
|
68 |
||
578 | 69 |
[instance variables:] |
32 | 70 |
|
121 | 71 |
doItAction <Block> block to evaluate for doIt |
123 | 72 |
|
121 | 73 |
errorFgColor <Color> fg-Color to be used when highlighting errors |
74 |
||
75 |
errorBgColor <Color> bg-Color to be used when highlighting errors |
|
58 | 76 |
|
578 | 77 |
codeStartPosition private temporary |
121 | 78 |
|
578 | 79 |
|
80 |
[styleSheet values:] |
|
121 | 81 |
|
82 |
codeErrorSelectionForegroundColor fg color to highlight errors |
|
418 | 83 |
(default: selection fg) |
84 |
||
121 | 85 |
codeErrorSelectionBackgroundColor bg color to highlight errors |
418 | 86 |
(default: selection bg) |
578 | 87 |
|
1522
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
88 |
[start with:] |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
89 |
Workspace open |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
90 |
|
578 | 91 |
[see also:] |
92 |
Workspace EditTextView |
|
93 |
Parser ByteCodeCompiler |
|
583 | 94 |
|
95 |
[author:] |
|
96 |
Claus Gittinger |
|
32 | 97 |
" |
201 | 98 |
! ! |
99 |
||
3712 | 100 |
!Workspace class methodsFor:'accessing'! |
101 |
||
102 |
sniplets |
|
103 |
Sniplets isNil ifTrue:[ |
|
104 |
Sniplets := Dictionary new. |
|
3713 | 105 |
self initializeDefaultAbbreviations. |
3712 | 106 |
]. |
107 |
^ Sniplets |
|
3713 | 108 |
|
109 |
" |
|
110 |
Sniplets := nil |
|
111 |
" |
|
3712 | 112 |
! |
113 |
||
114 |
sniplets:something |
|
115 |
Sniplets := something. |
|
116 |
! ! |
|
117 |
||
201 | 118 |
!Workspace class methodsFor:'defaults'! |
119 |
||
1522
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
120 |
defaultLabel |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
121 |
"my default window label" |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
122 |
|
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
123 |
^ 'Workspace' |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
124 |
|
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
125 |
"Created: / 16.5.1998 / 16:53:37 / cg" |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
126 |
! |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
127 |
|
3716 | 128 |
initializeDefaultAbbreviations |
3807 | 129 |
"default sniplets/abbreviations. TODO: save/load sniplets" |
3728 | 130 |
|
3735 | 131 |
"flush and reinitialize sniplets with: |
3807 | 132 |
Sniplets := Dictionary new. |
3741 | 133 |
" |
3807 | 134 |
"after a code change below, update with: |
135 |
self initializeDefaultAbbreviations. |
|
3735 | 136 |
" |
3807 | 137 |
|
138 |
#( |
|
139 |
't' 'true' |
|
140 |
'f' 'false' |
|
141 |
's' 'self' |
|
3876
38612526d6a2
sniplets: what was %p ? (noone knows)
Claus Gittinger <cg@exept.de>
parents:
3870
diff
changeset
|
142 |
'su' 'super' |
38612526d6a2
sniplets: what was %p ? (noone knows)
Claus Gittinger <cg@exept.de>
parents:
3870
diff
changeset
|
143 |
'ss' 'super ' |
3807 | 144 |
'n' 'nil' |
145 |
'y' 'yourself.' |
|
146 |
||
147 |
'in' 'isNil ' |
|
148 |
'nn' 'notNil ' |
|
149 |
'ie' 'isEmpty ' |
|
150 |
'ne' 'notEmpty ' |
|
151 |
'ien' 'isEmptyOrNil ' |
|
152 |
'nen' 'notEmptyOrNil ' |
|
153 |
||
154 |
'it' 'ifTrue: [!!]' |
|
155 |
'if' 'ifFalse: [!!]' |
|
156 |
'itf' 'ifTrue: [!!] ifFalse: []' |
|
157 |
'int' 'isNil ifTrue: [!!]' |
|
158 |
'inf' 'isNil ifFalse: [!!]' |
|
159 |
'ints' 'isNil ifTrue: [^ self]' |
|
160 |
'infs' 'isNil ifFalse: [^ self]' |
|
161 |
'nnt' 'notNil ifTrue: [!!]' |
|
162 |
'nnf' 'notNil ifFalse: [!!]' |
|
163 |
||
164 |
'wt' 'whileTrue: [!!]' |
|
165 |
'wf' 'whileFalse: [!!]' |
|
166 |
||
167 |
'do' 'do: [:each | !!]' |
|
168 |
'kdo' 'keysAndValuesDo: [:each | !!]' |
|
169 |
'dt' 'detect: [:each | !!]' |
|
170 |
'de' 'detect: [:each | !!]' |
|
171 |
'det' 'detect: [:each | !!]' |
|
172 |
'dtn' 'detect: [:each | !!] ifNone: []' |
|
173 |
'cl' 'collect: [:each | !!]' |
|
174 |
'co' 'collect: [:each | !!]' |
|
175 |
'col' 'collect: [:each | !!]' |
|
176 |
'sl' 'select: [:each | !!]' |
|
177 |
'se' 'select: [:each | !!]' |
|
178 |
'sel' 'select: [:each | !!]' |
|
179 |
'rj' 'reject: [:each | !!]' |
|
180 |
're' 'reject: [:each | !!]' |
|
181 |
'rej' 'reject: [:each | !!]' |
|
182 |
'inj' 'inject: !! into:[:accum :each | ]' |
|
183 |
||
184 |
'ex' 'Error handle:[ex | !!] do:[]' |
|
185 |
'sh' 'self halt.' |
|
186 |
||
187 |
'ik' 'includesKey: #' |
|
188 |
'is' 'includesString: #' |
|
189 |
||
190 |
'af' 'asFilename ' |
|
191 |
'as' 'asString ' |
|
192 |
'aoc' 'asOrderedCollection ' |
|
193 |
||
194 |
'np' 'nextPut: ' |
|
195 |
'npa' 'nextPutAll: ' |
|
196 |
'npl' 'nextPutLine: ' |
|
197 |
||
198 |
'ps' 'printString' |
|
199 |
'sr' 'self subclassResponsibility' |
|
200 |
||
201 |
'ati' 'at:!! ifAbsent: ' |
|
202 |
'atip' 'at:!! ifAbsentPut:[ ] ' |
|
203 |
'ap' 'at:!! ' |
|
204 |
||
205 |
'st' 'Smalltalk' |
|
206 |
'ts' 'Transcript showCR: ' |
|
207 |
'trs' 'Transcript showCR: ' |
|
208 |
'abb' 'Workspace sniplets inspect' |
|
209 |
'ws' 'Delay waitForSeconds: 1' |
|
210 |
'wfs' 'Delay waitForSeconds: 1' |
|
211 |
'wfm' 'Delay waitForMilliseconds: 1000' |
|
212 |
'ini' 'initialize\ super initialize.\ ' |
|
213 |
'newi' 'new\ ^ super new initialize.' |
|
214 |
'upd' 'update:something with:aParameter from:changedObject\ !!\ ^ super update:something with:aParameter from:changedObject.' |
|
215 |
'OC' 'OrderedCollection' |
|
216 |
'oc' 'OrderedCollection' |
|
217 |
'SC' 'SortedCollection' |
|
218 |
'sc' 'SortedCollection' |
|
219 |
'D' 'Dictionary' |
|
220 |
'ID' 'IdentityDictionary' |
|
221 |
'Id' 'IdentityDictionary' |
|
222 |
'id' 'IdentityDictionary' |
|
223 |
'iD' 'IdentityDictionary' |
|
224 |
'OCn' 'OrderedCollection new.' |
|
225 |
'ocn' 'OrderedCollection new.' |
|
226 |
'SCn' 'SortedCollection new.' |
|
227 |
'IDn' 'IdentityDictionary new' |
|
228 |
'idn' 'IdentityDictionary new' |
|
229 |
'Dn' 'Dictionary new' |
|
230 |
'dn' 'Dictionary new' |
|
231 |
'Sn' 'Set new' |
|
232 |
'sn' 'Set new' |
|
233 |
'A' 'Array' |
|
234 |
'a' 'Array' |
|
235 |
'An' 'Array new:' |
|
236 |
'an' 'Array new:' |
|
237 |
'Aw' 'Array with:' |
|
238 |
'aw' 'Array with:' |
|
239 |
'Aww' 'Array with:!! with:' |
|
240 |
'sww' 'Array with:!! with:' |
|
241 |
'Awww' 'Array with:!! with: with:' |
|
242 |
'awww' 'Array with:!! with: with:' |
|
243 |
'Awwww' 'Array with:!! with: with: with:' |
|
244 |
'awwww' 'Array with:!! with: with: with:' |
|
245 |
'aw2' 'Array with:!! with:' |
|
246 |
'aw3' 'Array with:!! with: with:' |
|
247 |
'aw4' 'Array with:!! with: with: with:' |
|
248 |
'0' '(0.0 @ 0.0)' |
|
249 |
'1' '(1.0 @ 1.0)' |
|
250 |
'[' '[:!! ]' |
|
3876
38612526d6a2
sniplets: what was %p ? (noone knows)
Claus Gittinger <cg@exept.de>
parents:
3870
diff
changeset
|
251 |
'(' '(!! )' |
3807 | 252 |
|
253 |
"/ typos... |
|
254 |
'eslf' 'self' |
|
255 |
'slef' 'self' |
|
256 |
'sefl' 'self' |
|
257 |
'elf' 'self' |
|
258 |
'slf' 'self' |
|
259 |
'sef' 'self' |
|
260 |
||
261 |
'iftrue' 'ifTrue' |
|
262 |
'iffalse' 'ifFalse' |
|
263 |
'iftrue:' 'ifTrue:' |
|
264 |
'iffalse:' 'ifFalse:' |
|
265 |
) pairWiseDo:[:abbrev :text | |
|
266 |
Sniplets |
|
267 |
at:abbrev put:text "/ ifPresent:[ self error:'duplicate abbreviation key' ] |
|
268 |
]. |
|
3716 | 269 |
! |
270 |
||
201 | 271 |
updateStyleCache |
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
430
diff
changeset
|
272 |
"extract values from the styleSheet and cache them in class variables" |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
430
diff
changeset
|
273 |
|
1354 | 274 |
<resource: #style (#'codeErrorSelection.foregroundColor' |
2492
740174c1be0f
allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents:
2489
diff
changeset
|
275 |
#'codeErrorSelection.backgroundColor' |
740174c1be0f
allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents:
2489
diff
changeset
|
276 |
#'codeView.backgroundColor' )> |
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
430
diff
changeset
|
277 |
|
1354 | 278 |
DefaultErrorForegroundColor := StyleSheet colorAt:'codeErrorSelection.foregroundColor'. |
279 |
DefaultErrorBackgroundColor := StyleSheet colorAt:'codeErrorSelection.backgroundColor'. |
|
2492
740174c1be0f
allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents:
2489
diff
changeset
|
280 |
DefaultViewBackground := StyleSheet colorAt:'codeView.backgroundColor'. |
32 | 281 |
! ! |
282 |
||
2776 | 283 |
!Workspace class methodsFor:'getting a new Workspace'! |
0 | 284 |
|
32 | 285 |
open |
0 | 286 |
"launch a new workspace" |
287 |
||
418 | 288 |
|scr topView workspace f| |
0 | 289 |
|
418 | 290 |
topView := StandardSystemView |
1522
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
291 |
label:(self classResources string:(self defaultLabel)) |
1901
b3556ff49778
removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents:
1738
diff
changeset
|
292 |
" minExtent:(100 @ 100)". |
23 | 293 |
|
418 | 294 |
scr := HVScrollableView for:self in:topView. |
295 |
scr origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
296 |
workspace := scr scrolledView. |
|
0 | 297 |
|
418 | 298 |
"/ adjust topViews extent according to my font |
299 |
||
0 | 300 |
f := workspace font. |
301 |
topView extent:((f widthOf:'x') * 40) @ (f height * 10). |
|
7 | 302 |
topView open. |
131 | 303 |
^ workspace |
0 | 304 |
|
58 | 305 |
" |
306 |
Workspace open |
|
307 |
" |
|
418 | 308 |
|
1522
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
309 |
"Modified: / 16.5.1998 / 16:53:53 / cg" |
857 | 310 |
! |
311 |
||
312 |
openForRemote:hostName |
|
313 |
"launch a new workspace to evaluate expression on some remote machine. |
|
1522
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
314 |
Entered expressions are sent over to some partner machine, evaluated there, |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
315 |
and the result is shown here. |
857 | 316 |
This requires the RemoteObjects package to be loaded." |
317 |
||
318 |
|server remoteCompiler workspace| |
|
319 |
||
1522
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
320 |
RemoteObjectServer isNil ifTrue:[ |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
321 |
self warn:'no remoteObjectServer available'. |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
322 |
^ nil |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
323 |
]. |
857 | 324 |
|
325 |
server := RemoteObjectServer on:hostName. |
|
326 |
remoteCompiler := server get:#Compiler. |
|
327 |
||
328 |
workspace := self open. |
|
1522
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
329 |
workspace topView |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
330 |
label:(self classResources string:'Remote Workspace {%1}' with:hostName). |
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
331 |
|
857 | 332 |
workspace doItAction: |
333 |
[:theCode | |
|
334 |
remoteCompiler |
|
335 |
evaluate:theCode |
|
336 |
in:nil |
|
337 |
receiver:nil |
|
338 |
notifying:workspace |
|
339 |
logged:true |
|
340 |
ifFail:nil |
|
341 |
] |
|
342 |
" |
|
343 |
Workspace openForRemote:'andi' |
|
344 |
" |
|
345 |
||
1522
b9b131f6c959
made defaultLabel a class method
Claus Gittinger <cg@exept.de>
parents:
1521
diff
changeset
|
346 |
"Modified: / 16.5.1998 / 16:57:38 / cg" |
2686 | 347 |
! |
348 |
||
2794 | 349 |
openWith:initialText selected:selectedBoolean |
2686 | 350 |
"launch a new workspace with some initial contents" |
351 |
||
352 |
|workspace| |
|
353 |
||
354 |
workspace := self open. |
|
2794 | 355 |
workspace contents:initialText selected:selectedBoolean. |
2686 | 356 |
^ workspace |
357 |
||
358 |
" |
|
359 |
Workspace openWith:'Transcript showCR:''hello world''' |
|
360 |
" |
|
0 | 361 |
! ! |
362 |
||
2657 | 363 |
!Workspace class methodsFor:'history'! |
364 |
||
365 |
clearDoItHistory |
|
366 |
DoItHistory := nil |
|
367 |
! |
|
368 |
||
369 |
doItHistory |
|
370 |
^ DoItHistory |
|
371 |
! |
|
372 |
||
373 |
doItHistorySize |
|
374 |
"the number of remembered doIts" |
|
375 |
||
376 |
^ 20 |
|
377 |
! |
|
378 |
||
379 |
rememberDoIt:aString |
|
380 |
|string| |
|
381 |
||
382 |
string := aString asString string withoutSeparators. |
|
2726 | 383 |
(string asCollectionOfWords size <= 1) ifTrue:[ |
384 |
((Scanner new scanTokens:string) size <= 1) ifTrue:[ |
|
385 |
"its a variable only" |
|
386 |
^ self |
|
387 |
] |
|
388 |
]. |
|
2657 | 389 |
|
390 |
DoItHistory isNil ifTrue:[ |
|
391 |
DoItHistory := OrderedCollection new. |
|
392 |
]. |
|
393 |
DoItHistory remove:string ifAbsent:nil. |
|
394 |
DoItHistory addFirst:string. |
|
395 |
DoItHistory size > self doItHistorySize ifTrue:[ |
|
396 |
DoItHistory removeLast |
|
397 |
]. |
|
2726 | 398 |
|
399 |
Scanner |
|
2657 | 400 |
! ! |
401 |
||
1523
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
402 |
!Workspace class methodsFor:'queries'! |
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
403 |
|
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
404 |
isVisualStartable |
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
405 |
"returns whether this application class can be started via #open |
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
406 |
(i.e. via a double click on the class in the browser)" |
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
407 |
|
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
408 |
^ self == Workspace |
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
409 |
|
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
410 |
"Created: / 16.5.1998 / 16:59:00 / cg" |
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
411 |
"Modified: / 16.5.1998 / 16:59:39 / cg" |
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
412 |
! ! |
6c0045d6a91f
open workspace via double-click in the browser
Claus Gittinger <cg@exept.de>
parents:
1522
diff
changeset
|
413 |
|
1931
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
414 |
!Workspace class methodsFor:'workspace variables'! |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
415 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
416 |
addWorkspaceVariable:name |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
417 |
"create a new workspace variable" |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
418 |
|
1933 | 419 |
|holder| |
420 |
||
3325 | 421 |
holder := self workspaceVariables at:name ifAbsentPut:[ ValueHolder new ]. |
1933 | 422 |
^ holder |
1931
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
423 |
! |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
424 |
|
3157 | 425 |
anyWorkspaceVariableIsDefined |
426 |
^ WorkspaceVariables notEmptyOrNil |
|
427 |
||
428 |
"Created: / 20-04-2005 / 11:57:53 / cg" |
|
429 |
! |
|
430 |
||
1931
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
431 |
removeAllWorkspaceVariables |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
432 |
"delete all workspace variables" |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
433 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
434 |
WorkspaceVariables := nil |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
435 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
436 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
437 |
! |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
438 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
439 |
removeWorkspaceVariable:name |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
440 |
"delete a workspace variable" |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
441 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
442 |
WorkspaceVariables notNil ifTrue:[ |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
443 |
WorkspaceVariables removeKey:name ifAbsent:nil. |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
444 |
WorkspaceVariables isEmpty ifTrue:[ |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
445 |
WorkspaceVariables := nil |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
446 |
] |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
447 |
]. |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
448 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
449 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
450 |
! |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
451 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
452 |
workspaceVariableAt:name |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
453 |
"retrieve a workspace variable (actually, a holder onto it)" |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
454 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
455 |
WorkspaceVariables isNil ifTrue:[^ nil]. |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
456 |
^ WorkspaceVariables at:name ifAbsent:nil. |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
457 |
|
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
458 |
|
1932
a898c608fb9a
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
459 |
! |
a898c608fb9a
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
460 |
|
3157 | 461 |
workspaceVariableNames |
462 |
"retrieve the collection of workspace variable names" |
|
463 |
||
464 |
WorkspaceVariables isNil ifTrue:[^ #()]. |
|
465 |
^ WorkspaceVariables keys |
|
1932
a898c608fb9a
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
466 |
|
3157 | 467 |
"Created: / 20-04-2005 / 11:42:45 / cg" |
468 |
! |
|
1932
a898c608fb9a
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
469 |
|
3157 | 470 |
workspaceVariables |
471 |
"retrieve the collection of workspace variables. |
|
472 |
That is a dictionary associating names to values." |
|
1932
a898c608fb9a
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
473 |
|
3325 | 474 |
WorkspaceVariables isNil ifTrue:[ |
475 |
WorkspaceVariables := Dictionary new. |
|
476 |
]. |
|
477 |
^ WorkspaceVariables |
|
3157 | 478 |
|
479 |
"Modified: / 20-04-2005 / 11:43:14 / cg" |
|
1931
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
480 |
! ! |
06cbb886dd10
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1930
diff
changeset
|
481 |
|
201 | 482 |
!Workspace methodsFor:'accessing'! |
0 | 483 |
|
3428 | 484 |
allowValueDrop:aBoolean |
485 |
"if on (the default), any smalltalk value can be dropped and leads to a workspace variable |
|
486 |
holding on to that being defined. Can be turned off, if youdont like this (for standAlone apps)" |
|
487 |
||
488 |
allowValueDrop := aBoolean. |
|
489 |
||
490 |
"Created: / 28-11-2006 / 16:13:02 / cg" |
|
491 |
! |
|
492 |
||
2679 | 493 |
autoDefineVariables |
494 |
^ autoDefineVariables |
|
2535 | 495 |
! |
496 |
||
2679 | 497 |
autoDefineVariables:nilOrSymbol |
3429
670414b849dd
allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
498 |
"undefined variables handling: |
670414b849dd
allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
499 |
are automatically defined as workspace variable if nilOrSymbol is #workspace. |
670414b849dd
allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
500 |
are automatically defined as doit variable if nilOrSymbol is #doit. |
670414b849dd
allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
501 |
are left undefined if nilOrSymbol is nil." |
670414b849dd
allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
502 |
|
2679 | 503 |
autoDefineVariables := nilOrSymbol. |
3429
670414b849dd
allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
504 |
|
670414b849dd
allow value drop to be disabled
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
505 |
"Modified: / 28-11-2006 / 16:21:01 / cg" |
2679 | 506 |
! |
2535 | 507 |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
508 |
commentStrings:anArrayOfCommentStrings |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
509 |
"define the comment strings" |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
510 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
511 |
commentStrings := anArrayOfCommentStrings |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
512 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
513 |
"Created: / 9.11.1997 / 01:05:25 / cg" |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
514 |
! |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
515 |
|
201 | 516 |
doItAction |
517 |
"return the action to be performed when 'doIt' is selected" |
|
32 | 518 |
|
201 | 519 |
^ doItAction |
0 | 520 |
! |
521 |
||
3007 | 522 |
errorBackgroundColor |
523 |
errorBgColor notNil ifTrue:[ ^ errorBgColor ]. |
|
524 |
DefaultErrorBackgroundColor notNil ifTrue:[ ^ DefaultErrorBackgroundColor ]. |
|
525 |
device hasColors ifTrue:[ ^ Color red ]. |
|
526 |
||
527 |
^ selectionBgColor |
|
528 |
! |
|
529 |
||
530 |
errorForegroundColor |
|
531 |
errorFgColor notNil ifTrue:[ ^ errorFgColor ]. |
|
532 |
DefaultErrorForegroundColor notNil ifTrue:[ ^ DefaultErrorForegroundColor ]. |
|
533 |
^ selectionFgColor |
|
534 |
! |
|
535 |
||
3279
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
536 |
hasSelectionOrTextInCursorLine |
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
537 |
^ (self selectionOrTextOfCursorLine:false) notNil |
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
538 |
! |
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
539 |
|
3537 | 540 |
poolsConsideredInDoIts:something |
541 |
poolsConsideredInDoIts := something. |
|
542 |
! |
|
543 |
||
2727 | 544 |
selectAll |
545 |
super selectAll |
|
546 |
! |
|
547 |
||
3272 | 548 |
selectionOrTextOfCursorLine |
3279
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
549 |
^ self selectionOrTextOfCursorLine:true |
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
550 |
! |
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
551 |
|
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
552 |
selectionOrTextOfCursorLine:doSelect |
3272 | 553 |
|sel lNr line| |
554 |
||
555 |
sel := self selectionAsString. |
|
556 |
sel notNil ifTrue:[^ sel]. |
|
557 |
||
558 |
lNr := self cursorLine. |
|
559 |
line := self listAt:lNr. |
|
560 |
line notEmptyOrNil ifTrue:[ |
|
3279
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
561 |
doSelect ifTrue:[ |
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
562 |
self selectLine:lNr. |
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
563 |
]. |
3272 | 564 |
^ line |
565 |
]. |
|
566 |
||
567 |
^ nil |
|
568 |
! |
|
569 |
||
2601 | 570 |
simulatedSelf:anObject |
571 |
"define what self is in an evaluation" |
|
572 |
||
573 |
simulatedSelf := anObject |
|
3007 | 574 |
! |
575 |
||
576 |
warningBackgroundColor |
|
577 |
DefaultWarningBackgroundColor notNil ifTrue:[ ^ DefaultWarningBackgroundColor ]. |
|
578 |
device hasColors ifTrue:[ ^ Color orange ]. |
|
579 |
||
580 |
^ selectionBgColor |
|
581 |
! |
|
582 |
||
583 |
warningForegroundColor |
|
584 |
DefaultWarningForegroundColor notNil ifTrue:[ ^ DefaultWarningForegroundColor ]. |
|
585 |
^ selectionFgColor |
|
201 | 586 |
! ! |
587 |
||
588 |
!Workspace methodsFor:'compiler interface'! |
|
589 |
||
2303 | 590 |
compilerClass |
2980 | 591 |
^ compilerClass ? Compiler |
592 |
! |
|
593 |
||
594 |
compilerClass:aCompilerClass |
|
595 |
compilerClass := aCompilerClass |
|
2303 | 596 |
! |
597 |
||
201 | 598 |
currentSourceCode |
599 |
"special interface to compiler - called by parser |
|
600 |
to get the updated source code after a corrected error" |
|
601 |
||
602 |
^ self contents |
|
0 | 603 |
! |
604 |
||
201 | 605 |
wantChangeLog |
606 |
"sent by the compiler to ask if a changeLog entry should |
|
607 |
be written. Return true here." |
|
0 | 608 |
|
201 | 609 |
^ true |
0 | 610 |
! ! |
611 |
||
2754 | 612 |
!Workspace methodsFor:'compiler interface-error handling'! |
0 | 613 |
|
201 | 614 |
correctableError:aString position:relPos to:relEndPos from:aCompiler |
615 |
"compiler notifies us of a correctable error; |
|
616 |
hilight the error (relPos to relEndPos) and show a Box asking for continue/correct/abort; |
|
617 |
this method should return true to the compiler if user wants the error |
|
618 |
to be corrected; false otherwise" |
|
619 |
||
620 |
|action| |
|
621 |
||
622 |
self highlightingErrorPosition:relPos to:relEndPos do:[ |
|
3383 | 623 |
Dialog aboutToOpenBoxNotificationSignal handle:[:ex | |
624 |
|box declareButton| |
|
625 |
||
626 |
box := ex parameter. |
|
627 |
declareButton := box buttons at:2. |
|
628 |
declareButton pressAction:declareButton controller releaseAction. |
|
629 |
declareButton controller beTriggerOnDown. |
|
630 |
ex proceed. |
|
631 |
] do:[ |
|
632 |
action := OptionBox |
|
633 |
request:aString |
|
3592
cb6f9f060e62
changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents:
3579
diff
changeset
|
634 |
label:(resources string:'Correctable Error') |
3383 | 635 |
image:(WarningBox iconBitmap) |
3592
cb6f9f060e62
changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents:
3579
diff
changeset
|
636 |
buttonLabels:(resources array:#('Cancel' 'Declare as...' 'Correct...' 'Continue')) |
3383 | 637 |
values:#(#abort #declare #correct #continue) |
638 |
default:#continue |
|
639 |
onCancel:#abort. |
|
640 |
]. |
|
201 | 641 |
]. |
642 |
||
1930
5852350f36f4
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
643 |
action == #declare ifTrue:[ |
5852350f36f4
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
644 |
^ action |
5852350f36f4
support for workspace variables
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
645 |
]. |
201 | 646 |
action == #abort ifTrue:[ |
2477
8a324269ee7a
class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents:
2471
diff
changeset
|
647 |
AbortOperationRequest raise. |
368 | 648 |
^ false |
201 | 649 |
]. |
368 | 650 |
^ action == #correct |
651 |
||
3383 | 652 |
"Modified: / 05-09-2006 / 12:20:42 / cg" |
201 | 653 |
! |
654 |
||
2104 | 655 |
correctableSelectorWarning:aString position:relPos to:relEndPos from:aCompiler |
656 |
"compiler notifies us of a correctable selector warning; |
|
657 |
hilight the error (relPos to relEndPos) and show a Box asking for continue/correct/abort; |
|
658 |
this method should return true to the compiler if user wants the error |
|
659 |
to be corrected; false otherwise" |
|
660 |
||
3744
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
661 |
|action doNotShowAgainHolder| |
2104 | 662 |
|
3261 | 663 |
self highlightingWarningPosition:relPos to:relEndPos do:[ |
3744
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
664 |
doNotShowAgainHolder := false asValue. |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
665 |
Dialog aboutToOpenBoxNotificationSignal handle:[:ex | |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
666 |
(aCompiler notNil and:[aCompiler class doNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[ |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
667 |
ex parameter addCheckBox:'Do not show this dialog again (reenable via Launchers Settings Dialog)' on:doNotShowAgainHolder. |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
668 |
]. |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
669 |
ex proceed. |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
670 |
] do:[ |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
671 |
action := OptionBox |
2104 | 672 |
request:aString |
3593
0de12c5b752a
changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents:
3592
diff
changeset
|
673 |
label:(resources string:'Warning') |
2983
910b4d5f7b1b
dont send obsolete message (OptionBox request:..form:..)
Claus Gittinger <cg@exept.de>
parents:
2982
diff
changeset
|
674 |
image:(WarningBox iconBitmap) |
2471
fc8c179c4228
finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents:
2470
diff
changeset
|
675 |
buttonLabels:(resources array:#('Cancel' 'Correct...' 'Generate' 'Continue')) |
2338 | 676 |
values:#(#abort #correct #generate #continue) |
2391
f8cd579704db
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2388
diff
changeset
|
677 |
default:#continue |
f8cd579704db
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2388
diff
changeset
|
678 |
onCancel:#abort. |
3744
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
679 |
]. |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
680 |
doNotShowAgainHolder value == true ifTrue:[ |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
681 |
aCompiler class doNotShowCompilerWarningAgainActionQuery actionQuery value |
c206f437042e
turn on/off selector warnings
Claus Gittinger <cg@exept.de>
parents:
3742
diff
changeset
|
682 |
]. |
2104 | 683 |
]. |
684 |
||
2338 | 685 |
action == #generate ifTrue:[ |
686 |
^ action |
|
687 |
]. |
|
688 |
||
2391
f8cd579704db
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2388
diff
changeset
|
689 |
(action isNil or:[action == #abort]) ifTrue:[ |
2477
8a324269ee7a
class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents:
2471
diff
changeset
|
690 |
AbortOperationRequest raise. |
2104 | 691 |
^ false |
692 |
]. |
|
693 |
^ action == #correct |
|
694 |
||
695 |
"Created: / 19.1.2000 / 16:27:28 / cg" |
|
2477
8a324269ee7a
class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents:
2471
diff
changeset
|
696 |
"Modified: / 16.11.2001 / 17:39:29 / cg" |
2104 | 697 |
! |
698 |
||
201 | 699 |
error:aString position:relPos to:relEndPos asWarning:asWarning |
2277 | 700 |
"obsolete - no longer invoked" |
701 |
||
702 |
^ self error:aString position:relPos to:relEndPos from:nil asWarning:asWarning |
|
703 |
! |
|
704 |
||
705 |
error:aString position:relPos to:relEndPos from:aCompiler |
|
706 |
"compiler notifies us of an error; hilight the error (relPos to relEndPos) |
|
707 |
and show a Box asking for continue/abort." |
|
708 |
||
709 |
^ self error:aString position:relPos to:relEndPos from:aCompiler asWarning:false |
|
710 |
! |
|
711 |
||
712 |
error:aString position:relPos to:relEndPos from:aCompiler asWarning:asWarning |
|
3397 | 713 |
"compiler notifies us of an error; hilight the error (relPos to relEndPos) |
201 | 714 |
and show a Box asking for continue/abort." |
715 |
||
3007 | 716 |
|answer fg bg| |
201 | 717 |
|
3007 | 718 |
fg := asWarning ifTrue:[ self warningForegroundColor ] ifFalse:[ self errorForegroundColor ]. |
719 |
bg := asWarning ifTrue:[ self warningBackgroundColor ] ifFalse:[ self errorBackgroundColor ]. |
|
201 | 720 |
|
3397 | 721 |
self |
3480
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
722 |
highlightingErrorPosition:relPos to:relEndPos |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
723 |
withForeground:fg andBackground:bg |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
724 |
do:[ |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
725 |
|box lbl doNotShowAgainHolder l1 y1 y2 l2| |
201 | 726 |
|
3480
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
727 |
Warning isHandled ifTrue:[ |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
728 |
Warning raiseErrorString:aString. |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
729 |
^ false |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
730 |
]. |
213
6286d3f36c14
raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
731 |
|
3480
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
732 |
" |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
733 |
ask if we should abort or continue |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
734 |
" |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
735 |
box := YesNoBox |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
736 |
title:aString |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
737 |
yesText:(resources string:'Continue') |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
738 |
noText:(resources string:'Abort'). |
2799
4d9967d1052e
support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents:
2794
diff
changeset
|
739 |
|
3480
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
740 |
lbl := aCompiler isNil ifTrue:['Compiler'] ifFalse:[aCompiler class name]. |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
741 |
asWarning ifTrue:[ |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
742 |
lbl := lbl , ' Warning' |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
743 |
] ifFalse:[ |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
744 |
lbl := lbl , ' Error'. |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
745 |
]. |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
746 |
box label:lbl. |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
747 |
box image:(WarningBox iconBitmap). |
2799
4d9967d1052e
support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents:
2794
diff
changeset
|
748 |
|
3480
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
749 |
(aCompiler notNil and:[aCompiler class doNotShowCompilerWarningAgainActionQuery isHandled]) ifTrue:[ |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
750 |
doNotShowAgainHolder := false asValue. |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
751 |
box addCheckBox:'Do not show this dialog again (reenable via Launchers Settings Dialog)' on:doNotShowAgainHolder. |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
752 |
]. |
3007 | 753 |
|
3480
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
754 |
answer := box confirm. |
3007 | 755 |
|
3480
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
756 |
doNotShowAgainHolder value == true ifTrue:[ |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
757 |
aCompiler class doNotShowCompilerWarningAgainActionQuery actionQuery value |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
758 |
]. |
3007 | 759 |
|
3480
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
760 |
box destroy. |
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
761 |
]. |
2799
4d9967d1052e
support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents:
2794
diff
changeset
|
762 |
|
201 | 763 |
" |
764 |
do the abort if we have to |
|
765 |
" |
|
3397 | 766 |
answer ifFalse:[ |
3480
9defe040ef4a
AbortSignal->AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents:
3429
diff
changeset
|
767 |
AbortOperationRequest raise. |
201 | 768 |
]. |
769 |
^ false |
|
213
6286d3f36c14
raise warningSignal if handled (allows warnBoxes from compiler to be suppressed in debugger)
Claus Gittinger <cg@exept.de>
parents:
208
diff
changeset
|
770 |
|
2471
fc8c179c4228
finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents:
2470
diff
changeset
|
771 |
"Created: / 24.11.1995 / 22:56:34 / cg" |
2477
8a324269ee7a
class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents:
2471
diff
changeset
|
772 |
"Modified: / 16.11.2001 / 17:39:31 / cg" |
201 | 773 |
! |
774 |
||
2663 | 775 |
highlightingErrorLine:lineNr do:aBlock |
776 |
"evaluate aBlock while some selection is shown highlighted with error colors." |
|
777 |
||
778 |
|linePosition| |
|
779 |
||
780 |
linePosition := self characterPositionOfLine:lineNr col:1. |
|
781 |
self highlightingErrorPosition:linePosition to:nil do:aBlock |
|
782 |
! |
|
783 |
||
59 | 784 |
highlightingErrorPosition:relPos to:relEndPos do:aBlock |
785 |
"evaluate aBlock while some selection is shown highlighted with error colors." |
|
58 | 786 |
|
3007 | 787 |
self |
788 |
highlightingErrorPosition:relPos to:relEndPos |
|
789 |
withForeground:(self errorForegroundColor) andBackground:(self errorBackgroundColor) |
|
790 |
do:aBlock |
|
791 |
! |
|
792 |
||
793 |
highlightingErrorPosition:relPos to:relEndPos withForeground:hilightFg andBackground:hilightBg do:aBlock |
|
794 |
"evaluate aBlock while some selection is shown highlighted with colors passed as args." |
|
795 |
||
796 |
|absPosition oldFg oldBg| |
|
0 | 797 |
|
58 | 798 |
" |
799 |
change color of selection & hide cursor |
|
800 |
" |
|
3007 | 801 |
oldFg := selectionFgColor. |
802 |
oldBg := selectionBgColor. |
|
803 |
selectionBgColor := hilightBg. |
|
804 |
selectionFgColor := hilightFg. |
|
58 | 805 |
self hideCursor. |
0 | 806 |
|
58 | 807 |
" |
808 |
select the text - relEndPos may be nil in which case the whole line is selected |
|
809 |
we have to adjust the positions given by the compiler, since they |
|
810 |
are relative to the texts start (the compiler did stream-read the code). |
|
811 |
" |
|
0 | 812 |
codeStartPosition isNil ifTrue:[codeStartPosition := 1]. |
3427 | 813 |
absPosition := codeStartPosition + (relPos ? 1) - 1. |
0 | 814 |
relEndPos isNil ifTrue:[ |
2519
a088ad3bb1e5
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
815 |
self selectLineWhereCharacterPosition:absPosition |
0 | 816 |
] ifFalse:[ |
3427 | 817 |
self selectFromCharacterPosition:absPosition to:(codeStartPosition + (relEndPos ? 1) - 1) |
0 | 818 |
]. |
819 |
self makeSelectionVisible. |
|
820 |
||
155 | 821 |
device flush. |
58 | 822 |
|
2519
a088ad3bb1e5
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
823 |
aBlock ensure:[ |
a088ad3bb1e5
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
824 |
" |
a088ad3bb1e5
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
825 |
undo selection color change and show cursor again |
a088ad3bb1e5
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
826 |
" |
3007 | 827 |
selectionFgColor := oldFg. |
828 |
selectionBgColor := oldBg. |
|
2519
a088ad3bb1e5
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
829 |
self showCursor. |
0 | 830 |
]. |
3427 | 831 |
|
832 |
"Modified: / 16-11-2006 / 16:37:34 / cg" |
|
0 | 833 |
! |
834 |
||
3007 | 835 |
highlightingWarningPosition:relPos to:relEndPos do:aBlock |
836 |
"evaluate aBlock while some selection is shown highlighted with warning colors." |
|
837 |
||
838 |
self |
|
839 |
highlightingErrorPosition:relPos to:relEndPos |
|
840 |
withForeground:(self warningForegroundColor) andBackground:(self warningBackgroundColor) |
|
841 |
do:aBlock |
|
842 |
! |
|
843 |
||
2386
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
844 |
unusedVariableWarning:aString position:relPos to:relEndPos from:aCompiler |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
845 |
"compiler notifies us of a (or some) unused variables; |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
846 |
hilight the error (relPos to relEndPos) and show a Box asking for continue/correct/abort; |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
847 |
this method should return true to the compiler if user wants the error |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
848 |
to be corrected; false otherwise" |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
849 |
|
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
850 |
|action| |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
851 |
|
3007 | 852 |
self highlightingWarningPosition:relPos to:relEndPos do:[ |
2386
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
853 |
action := OptionBox |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
854 |
request:aString |
3593
0de12c5b752a
changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents:
3592
diff
changeset
|
855 |
label:(resources string:'Warning') |
2990
1373f301a694
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
2983
diff
changeset
|
856 |
image:(WarningBox iconBitmap) |
3593
0de12c5b752a
changed #correctableError:position:to:from:
Claus Gittinger <cg@exept.de>
parents:
3592
diff
changeset
|
857 |
buttonLabels:(resources array:#('Cancel' 'Remove Variable(s)' 'Continue')) |
2470
240b6d2d5511
finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents:
2462
diff
changeset
|
858 |
values:#(#abort #correct #continue) |
2386
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
859 |
default:#continue. |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
860 |
]. |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
861 |
|
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
862 |
action == #abort ifTrue:[ |
2477
8a324269ee7a
class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents:
2471
diff
changeset
|
863 |
AbortOperationRequest raise. |
2386
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
864 |
^ false |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
865 |
]. |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
866 |
^ action == #correct |
2470
240b6d2d5511
finished remove unused vars;
Claus Gittinger <cg@exept.de>
parents:
2462
diff
changeset
|
867 |
|
2477
8a324269ee7a
class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents:
2471
diff
changeset
|
868 |
"Modified: / 16.11.2001 / 17:39:34 / cg" |
2386
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
869 |
! |
ace953bac401
unusedVariables - correct by deleting
Claus Gittinger <cg@exept.de>
parents:
2338
diff
changeset
|
870 |
|
116 | 871 |
warning:aString position:relPos to:relEndPos from:aCompiler |
32 | 872 |
"compiler notifies us of a warning - same behavior as error" |
0 | 873 |
|
2277 | 874 |
self error:aString position:relPos to:relEndPos from:aCompiler asWarning:true |
0 | 875 |
! ! |
876 |
||
3396 | 877 |
!Workspace methodsFor:'drag & drop'! |
878 |
||
879 |
canDrop:aDropContext |
|
880 |
"Any object can be dropped into workspace..." |
|
881 |
||
3428 | 882 |
allowValueDrop ifFalse:[ |
883 |
self isReadOnly ifTrue:[^ false]. |
|
884 |
^ aDropContext dropObjects |
|
885 |
contains:[:someObject| (someObject isTextObject or:[ someObject isFileObject ])]. |
|
886 |
]. |
|
887 |
||
3396 | 888 |
^ true |
889 |
||
890 |
"Created: / 16-08-2005 / 22:01:13 / janfrog" |
|
3428 | 891 |
"Modified: / 28-11-2006 / 16:18:51 / cg" |
3396 | 892 |
! |
893 |
||
3414 | 894 |
doDrop:aDropContext |
3739 | 895 |
self halt:'should no longer be reached'. |
3428 | 896 |
self drop:aDropContext |
3414 | 897 |
|
3428 | 898 |
"Modified: / 28-11-2006 / 16:14:51 / cg" |
3414 | 899 |
! |
900 |
||
901 |
drop:aDropContext |
|
902 |
"Any object can be dropped into workspace..." |
|
903 |
||
3870 | 904 |
|textObjects nonTextObjects answer text| |
905 |
||
906 |
textObjects := aDropContext dropObjects |
|
3887 | 907 |
select:[:dropObject | dropObject isTextObject |
908 |
or:[ dropObject isFileObject ]]. |
|
3870 | 909 |
nonTextObjects := aDropContext dropObjects |
3887 | 910 |
reject:[:dropObject | dropObject isTextObject |
911 |
or:[ dropObject isFileObject ]]. |
|
3870 | 912 |
|
913 |
self dropObjects:textObjects. |
|
3414 | 914 |
|
3870 | 915 |
nonTextObjects notEmpty ifTrue:[ |
916 |
answer := Dialog |
|
917 |
confirmWithCancel:(resources |
|
918 |
string:'Drop as textual representation or as object reference ?') |
|
919 |
labels:(resources array:#('Cancel' 'Reference' 'Name' 'Text')) |
|
920 |
values:#(nil #ref #name #text) |
|
921 |
default:4. |
|
922 |
answer isNil ifTrue:[^ self]. |
|
923 |
(answer == #text or:[answer == #name]) ifTrue:[ |
|
924 |
text := String streamContents:[:s | |
|
925 |
nonTextObjects do:[:dropObject | |
|
926 |
|obj| |
|
927 |
||
928 |
obj := dropObject theObject. |
|
929 |
obj isMethod ifTrue:[ |
|
930 |
s nextPutAll:(answer == #name ifTrue:[obj selector] ifFalse:[obj source]). |
|
931 |
] ifFalse:[ |
|
932 |
obj isClass ifTrue:[ |
|
933 |
s nextPutAll:(answer == #name ifTrue:[obj name] ifFalse:[obj source asString]) |
|
934 |
] ifFalse:[ |
|
935 |
s nextPutAll:(answer == #name ifTrue:[obj className] ifFalse:[obj printString]) . |
|
936 |
]. |
|
937 |
]. |
|
938 |
]. |
|
939 |
]. |
|
940 |
self paste:text. |
|
3414 | 941 |
] ifFalse:[ |
3870 | 942 |
nonTextObjects do:[:dropObject | |
943 |
name := Dialog |
|
944 |
request:(resources |
|
945 |
string:'Name of the new Workspace Variable (refers to the dropped %1):' |
|
946 |
with:dropObject theObject class name allBold |
|
947 |
) |
|
948 |
initialAnswer:'droppedObject' |
|
949 |
okLabel:'Add' |
|
950 |
title:'Enter Variable Name'. |
|
3414 | 951 |
|
3870 | 952 |
name notEmptyOrNil ifTrue:[ |
953 |
Workspace addWorkspaceVariable:name. |
|
954 |
(Workspace workspaceVariableAt:name) value:dropObject theObject. |
|
955 |
self paste:name. |
|
956 |
]. |
|
3414 | 957 |
]. |
3870 | 958 |
] |
3414 | 959 |
]. |
960 |
||
961 |
"Created: / 13-10-2006 / 17:34:07 / cg" |
|
3396 | 962 |
! ! |
963 |
||
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
964 |
!Workspace methodsFor:'editing'! |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
965 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
966 |
commentFrom:line1 to:line2 |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
967 |
"convenient function to comment out a block. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
968 |
All lines from line1 to line2 get an end-of-line comment |
1925 | 969 |
in the first col |
970 |
(if no eol comment is available, a bracketing comment is used)." |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
971 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
972 |
|eolComment opening closing| |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
973 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
974 |
eolComment := commentStrings at:1. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
975 |
eolComment isNil ifTrue:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
976 |
opening := (commentStrings at:2) at:1. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
977 |
closing := (commentStrings at:2) at:2. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
978 |
(opening isNil or:[closing isNil]) ifTrue:[^ self]. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
979 |
]. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
980 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
981 |
line1 to:line2 do:[:lineNr | |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
982 |
|l| |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
983 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
984 |
l := self listAt:lineNr. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
985 |
l isNil ifTrue:[l := '']. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
986 |
eolComment notNil ifTrue:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
987 |
l := eolComment , l |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
988 |
] ifFalse:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
989 |
l := opening , l , closing |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
990 |
]. |
3403 | 991 |
self replaceLine:lineNr with:l. |
992 |
widthOfWidestLine notNil ifTrue:[ |
|
993 |
widthOfWidestLine := widthOfWidestLine max:(self widthOfLineString:l). |
|
994 |
]. |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
995 |
]. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
996 |
self textChanged. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
997 |
|
3403 | 998 |
"Created: / 09-11-1997 / 01:05:35 / cg" |
999 |
"Modified: / 09-10-2006 / 10:46:44 / cg" |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1000 |
! |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1001 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1002 |
commentSelection |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1003 |
"convenient function to comment out a block. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1004 |
All lines from line1 to line2 get an end-of-line comment |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1005 |
in the first col." |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1006 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1007 |
|e commentPair opening closing| |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1008 |
|
1481 | 1009 |
(self checkModificationsAllowed) ifFalse:[ ^ self]. |
3210 | 1010 |
commentStrings isNil ifTrue:[ self beep. ^ self]. |
1011 |
||
3207
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1012 |
selectionStartLine isNil ifTrue:[ |
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1013 |
self |
3785 | 1014 |
undoableDo:[ self commentFrom:cursorLine to:cursorLine ] |
3543 | 1015 |
info:'Comment'. |
3207
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1016 |
^ self |
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1017 |
]. |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1018 |
|
3129 | 1019 |
self |
1020 |
undoableDo: |
|
1021 |
[ |
|
1022 |
(selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[ |
|
1023 |
self commentFrom:selectionStartLine to:selectionEndLine-1 |
|
1024 |
] ifFalse:[ |
|
3210 | 1025 |
commentPair := commentStrings at:2 ifAbsent:nil. |
1026 |
commentPair isNil ifTrue:[ |
|
1027 |
self beep. |
|
1028 |
] ifFalse:[ |
|
1029 |
opening := commentPair at:1. |
|
1030 |
closing := commentPair at:2. |
|
1031 |
(opening isNil or:[closing isNil]) ifTrue:[^ self]. |
|
3129 | 1032 |
|
3210 | 1033 |
e := selectionEndCol. |
1034 |
||
1035 |
self insertString:closing atLine:selectionEndLine col:e+1. |
|
1036 |
self insertString:opening atLine:selectionStartLine col:selectionStartCol. |
|
3129 | 1037 |
|
3210 | 1038 |
selectionStartLine == selectionEndLine ifTrue:[e := e + opening size]. |
1039 |
self selectFromLine:selectionStartLine col:selectionStartCol |
|
1040 |
toLine:selectionEndLine col:e+closing size. |
|
1041 |
] |
|
3129 | 1042 |
] |
1043 |
] |
|
1044 |
info:'comment' |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1045 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1046 |
"Created: / 9.11.1997 / 01:05:40 / cg" |
1481 | 1047 |
"Modified: / 5.4.1998 / 16:52:23 / cg" |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1048 |
! |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1049 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1050 |
uncommentFrom:line1 to:line2 |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1051 |
"convenient function to comment out a block. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1052 |
All lines from line1 to line2 get an end-of-line comment |
1925 | 1053 |
in the first col. |
1054 |
(if no eol comment is available, a bracketing comment is removed)" |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1055 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1056 |
|eolComment opening closing rest| |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1057 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1058 |
eolComment := commentStrings at:1. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1059 |
eolComment isNil ifTrue:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1060 |
opening := (commentStrings at:2) at:1. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1061 |
closing := (commentStrings at:2) at:2. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1062 |
(opening isNil or:[closing isNil]) ifTrue:[^ self]. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1063 |
] ifFalse:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1064 |
rest := eolComment size + 1. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1065 |
]. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1066 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1067 |
line1 to:line2 do:[:lineNr | |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1068 |
|l| |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1069 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1070 |
l := self listAt:lineNr. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1071 |
l notNil ifTrue:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1072 |
eolComment notNil ifTrue:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1073 |
(l startsWith:eolComment) ifTrue:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1074 |
l := l copyFrom:rest |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1075 |
] |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1076 |
] ifFalse:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1077 |
((l startsWith:opening) |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1078 |
and:[l endsWith:closing]) ifTrue:[ |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1079 |
l := l copyFrom:opening size + 1. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1080 |
l := l copyWithoutLast:closing size. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1081 |
] |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1082 |
]. |
3403 | 1083 |
self replaceLine:lineNr with:l. |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1084 |
] |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1085 |
]. |
3403 | 1086 |
widthOfWidestLine := nil. |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1087 |
self textChanged. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1088 |
|
3403 | 1089 |
"Created: / 09-11-1997 / 01:05:43 / cg" |
1090 |
"Modified: / 09-10-2006 / 10:46:59 / cg" |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1091 |
! |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1092 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1093 |
uncommentSelection |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1094 |
"convenient function to comment out a block. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1095 |
All lines from line1 to line2 get an end-of-line comment |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1096 |
in the first col." |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1097 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1098 |
|e commentPair opening closing sz1 sz2| |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1099 |
|
3129 | 1100 |
(self checkModificationsAllowed) ifFalse:[ ^ self]. |
3207
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1101 |
selectionStartLine isNil ifTrue:[ |
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1102 |
self |
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1103 |
undoableDo:[ |
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1104 |
self uncommentFrom:cursorLine to:cursorLine |
3543 | 1105 |
] |
1106 |
info:'Uncomment'. |
|
3207
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1107 |
^ self |
0088a1d4fb0e
without selection, comment/uncomment operate on the single cursor-line
Claus Gittinger <cg@exept.de>
parents:
3157
diff
changeset
|
1108 |
]. |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1109 |
|
3129 | 1110 |
self |
1111 |
undoableDo: |
|
1112 |
[ |
|
1113 |
(selectionStartCol == 1 and:[selectionEndCol == 0]) ifTrue:[ |
|
1114 |
self uncommentFrom:selectionStartLine to:selectionEndLine-1 |
|
1115 |
] ifFalse:[ |
|
1116 |
commentPair := commentStrings at:2. |
|
1117 |
opening := commentPair at:1. |
|
1118 |
closing := commentPair at:2. |
|
1119 |
(opening isNil or:[closing isNil]) ifTrue:[^ self]. |
|
1120 |
||
1121 |
sz1 := opening size. |
|
1122 |
sz2 := closing size. |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1123 |
|
3129 | 1124 |
((self |
1125 |
stringAtLine:selectionStartLine |
|
1126 |
from:selectionStartCol |
|
1127 |
to:selectionStartCol+sz1 - 1) = opening |
|
1128 |
and:[(self |
|
1129 |
stringAtLine:selectionEndLine |
|
1130 |
from:selectionEndCol - sz2 + 1 |
|
1131 |
to:selectionEndCol) = closing ]) ifTrue:[ |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1132 |
|
3129 | 1133 |
self deleteCharsAtLine:selectionEndLine fromCol:selectionEndCol-sz2+1 toCol:selectionEndCol. |
1134 |
self deleteCharsAtLine:selectionStartLine fromCol:selectionStartCol toCol:selectionStartCol+sz1-1. |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1135 |
|
3129 | 1136 |
e := selectionEndCol - sz2. |
1137 |
selectionStartLine == selectionEndLine ifTrue:[e := e - sz1]. |
|
1138 |
self selectFromLine:selectionStartLine col:selectionStartCol |
|
1139 |
toLine:selectionEndLine col:e. |
|
1140 |
] |
|
1141 |
] |
|
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1142 |
] |
3129 | 1143 |
info:'uncomment' |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1144 |
|
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1145 |
"Modified: / 7.1.1997 / 20:13:32 / cg" |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1146 |
"Created: / 9.11.1997 / 01:05:46 / cg" |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1147 |
! ! |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1148 |
|
3968
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1149 |
!Workspace methodsFor:'event handling'! |
3712 | 1150 |
|
0 | 1151 |
keyPress:key x:x y:y |
3712 | 1152 |
<resource: #keyboard (#DoIt #InspectIt #PrintIt #ReplaceIt #BrowseIt #ExpandIt)> |
60 | 1153 |
|
3800 | 1154 |
(key == #DoIt) ifTrue:[self doIt. ^ self]. |
1155 |
(key == #InspectIt) ifTrue:[self inspectIt. ^ self]. |
|
1156 |
(key == #PrintIt) ifTrue:[self printIt. ^ self]. |
|
1157 |
(key == #ReplaceIt) ifTrue:[self replaceIt. ^ self]. |
|
1158 |
(key == #BrowseIt) ifTrue:[self browseIt. ^ self]. |
|
1159 |
(key == #ImplementorsOfIt) ifTrue:[self browseImplementorsOfIt. ^ self]. |
|
1160 |
(key == #ExpandAbbreviation) ifTrue:[self expandAbbreviation. ^ self]. |
|
38 | 1161 |
|
0 | 1162 |
super keyPress:key x:x y:y |
3511 | 1163 |
|
1164 |
"Modified: / 08-11-2007 / 11:29:45 / cg" |
|
0 | 1165 |
! ! |
201 | 1166 |
|
2143 | 1167 |
!Workspace methodsFor:'executing'! |
201 | 1168 |
|
1501 | 1169 |
do:code withValueDo:aBlock |
418 | 1170 |
"helper for doIt, printIt and inspectIt. |
1171 |
Evaluate the selection and, if all went well, evaluate the argument, |
|
1172 |
aBlock with the value. |
|
1173 |
Most work is in preparing for proper cleanup in case of abort |
|
1174 |
or other exception while the evaluation is performed. |
|
1175 |
(restore cursor, selectionColors etc.)" |
|
201 | 1176 |
|
1501 | 1177 |
|selLine selCol endLine endCol cLine cCol cleanUp| |
201 | 1178 |
|
1179 |
code notNil ifTrue:[ |
|
2409 | 1180 |
code asString withoutSeparators isEmpty ifTrue:[ ^ self ]. |
2408 | 1181 |
|
257 | 1182 |
codeStartPosition := self characterPositionOfSelection. |
201 | 1183 |
|
257 | 1184 |
" |
1185 |
remember selection for later - if there is an error, |
|
1186 |
the notification method will highlight it. |
|
1187 |
thus destroying the current selection |
|
1188 |
" |
|
1189 |
selLine := selectionStartLine. |
|
1190 |
selCol := selectionStartCol. |
|
1191 |
endLine := selectionEndLine. |
|
1192 |
endCol := selectionEndCol. |
|
1193 |
cCol := cursorCol. |
|
1194 |
cLine := cursorLine. |
|
201 | 1195 |
|
257 | 1196 |
" |
1197 |
cleanup: restore previous selection and cursor positions |
|
1198 |
" |
|
1199 |
cleanUp := [ |
|
1200 |
self selectFromLine:selLine col:selCol toLine:endLine col:endCol. |
|
1201 |
cLine notNil ifTrue:[ |
|
1202 |
self cursorLine:cLine col:cCol |
|
1203 |
]. |
|
1204 |
]. |
|
201 | 1205 |
|
257 | 1206 |
" |
1207 |
perform the action. |
|
1208 |
Be careful to release the reference to the value; |
|
1209 |
otherwise, we could keep lots of garbage from being freed |
|
1210 |
until the view gets closed |
|
1211 |
" |
|
1212 |
self topView withExecuteCursorDo:[ |
|
1213 |
[ |
|
3008 | 1214 |
AbortOperationRequest handle:[:ex | |
3898 | 1215 |
"/ aBlock value:'** Abortsignal cought **'. |
257 | 1216 |
ex return |
1217 |
] do:[ |
|
929 | 1218 |
|value| |
1219 |
||
257 | 1220 |
doItAction notNil ifTrue:[ |
929 | 1221 |
value := doItAction value:(code asString). |
257 | 1222 |
cleanUp value. cleanUp := nil. |
1223 |
aBlock value:value. |
|
2726 | 1224 |
value := nil. |
2657 | 1225 |
self class rememberDoIt:code. |
257 | 1226 |
] |
1227 |
] |
|
2519
a088ad3bb1e5
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
1228 |
] ensure:[ |
929 | 1229 |
cleanUp notNil ifTrue:[ |
1230 |
cleanUp value. cleanUp := nil |
|
1231 |
]. |
|
257 | 1232 |
] |
1233 |
]. |
|
201 | 1234 |
] |
257 | 1235 |
|
1501 | 1236 |
"Modified: / 22.4.1998 / 21:56:13 / ca" |
1237 |
"Created: / 22.4.1998 / 21:57:05 / ca" |
|
2409 | 1238 |
"Modified: / 26.9.2001 / 17:32:59 / cg" |
201 | 1239 |
! ! |
1240 |
||
2751 | 1241 |
!Workspace methodsFor:'initialization & release'! |
201 | 1242 |
|
2733 | 1243 |
doItAction:aOneArgBlock |
1244 |
"define the action to be performed when 'doIt' is selected. |
|
1245 |
The block will be evaluated, passing the selection as a String argument. |
|
1246 |
A default doItAction is set for you in the initialize method." |
|
1247 |
||
1248 |
doItAction := aOneArgBlock |
|
1249 |
||
1250 |
"Modified: 27.2.1996 / 15:31:37 / cg" |
|
1251 |
! |
|
1252 |
||
1253 |
executeDoIt:theCode |
|
3537 | 1254 |
^ (self compilerClass new) moreSharedPools:poolsConsideredInDoIts; |
2733 | 1255 |
evaluate:theCode |
1256 |
in:nil |
|
1257 |
receiver:simulatedSelf |
|
1258 |
notifying:self |
|
1259 |
logged:true |
|
1260 |
ifFail:nil |
|
1261 |
! |
|
1262 |
||
201 | 1263 |
initStyle |
966 | 1264 |
"setup viewStyle specifics" |
1265 |
||
201 | 1266 |
super initStyle. |
1267 |
||
2492
740174c1be0f
allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents:
2489
diff
changeset
|
1268 |
DefaultViewBackground notNil ifTrue:[ |
740174c1be0f
allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents:
2489
diff
changeset
|
1269 |
viewBackground := DefaultViewBackground. |
740174c1be0f
allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents:
2489
diff
changeset
|
1270 |
self backgroundColor:viewBackground. |
740174c1be0f
allow separate bg-color from styleSheet
Claus Gittinger <cg@exept.de>
parents:
2489
diff
changeset
|
1271 |
]. |
201 | 1272 |
! |
1273 |
||
1274 |
initialize |
|
1275 |
super initialize. |
|
1276 |
||
2775 | 1277 |
scrollWhenUpdating := #beginOfText. |
201 | 1278 |
showMatchingParenthesis := true. |
3428 | 1279 |
allowValueDrop := true. |
1280 |
||
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1281 |
commentStrings := #( |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1282 |
'"/' |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1283 |
('"' '"') |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1284 |
). |
201 | 1285 |
|
1286 |
self initializeDoITAction. |
|
3396 | 1287 |
self initializeDragAndDrop. |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1288 |
|
3428 | 1289 |
"Modified: / 28-11-2006 / 16:11:55 / cg" |
201 | 1290 |
! |
1291 |
||
1292 |
initializeDoITAction |
|
1293 |
"set up the block to be evaluated for doIts. |
|
1294 |
This is done here in a separate method to allow easier |
|
1295 |
redefinition in subclasses" |
|
1296 |
||
2733 | 1297 |
doItAction := [:theCode | self executeDoIt:theCode]. |
3396 | 1298 |
! |
1299 |
||
1300 |
initializeDragAndDrop |
|
1301 |
|target| |
|
1302 |
||
1303 |
target := DropTarget |
|
1304 |
receiver:self |
|
1305 |
argument:nil |
|
3411 | 1306 |
dropSelector:#drop: |
3396 | 1307 |
canDropSelector:#canDrop:. |
1308 |
self dropTarget:target |
|
1309 |
||
1310 |
"Created: / 16-08-2005 / 22:03:36 / janfrog" |
|
3411 | 1311 |
"Modified: / 13-10-2006 / 12:37:18 / cg" |
201 | 1312 |
! ! |
1313 |
||
418 | 1314 |
!Workspace methodsFor:'menu & menu actions'! |
1315 |
||
2285 | 1316 |
browseClass |
1317 |
"user selected 'browseClass' from menu; evaluate the code |
|
1318 |
and open a browser on the resulting class (if it evaluates to one)" |
|
1319 |
||
1320 |
^ self |
|
3272 | 1321 |
do:(self selectionAsString) |
3910 | 1322 |
withValueDo:[:result | |
1323 |
result isBehavior ifTrue:[ |
|
1324 |
result browserClass openInClass:result selector:nil |
|
1325 |
] ifFalse:[ |
|
1326 |
self warn:'Selection does not evaluate to a class' |
|
1327 |
] |
|
1328 |
]. |
|
2285 | 1329 |
|
2410 | 1330 |
"Modified: / 26.9.2001 / 17:37:35 / cg" |
2285 | 1331 |
! |
1332 |
||
2451
ae246b6c4df7
added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents:
2440
diff
changeset
|
1333 |
browseImplementorsOfIt |
ae246b6c4df7
added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents:
2440
diff
changeset
|
1334 |
"open a browser on the implementors of the selected text" |
ae246b6c4df7
added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents:
2440
diff
changeset
|
1335 |
|
3895
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1336 |
|selectedText selector browserClass na| |
2457
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1337 |
|
2714 | 1338 |
selectedText := self selectionAsString. |
1339 |
selectedText size > 0 ifTrue:[ |
|
2457
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1340 |
self windowGroup withWaitCursorDo:[ |
3895
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1341 |
"/ hack, for now and expecco; must ask the Parser eventually... |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1342 |
(compilerClass notNil and:[compilerClass includesBehavior:JavaScriptParser]) ifTrue:[ |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1343 |
"/ selector is in one piece anyway |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1344 |
(selectedText includes:$_) ifFalse:[ |
3896 | 1345 |
"/ zero or one args - sigh (need to parse more to figure this out) |
3895
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1346 |
selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:1. |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1347 |
selectedText := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:0. |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1348 |
] ifTrue:[ |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1349 |
"/ count _#s plus one arg - sigh |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1350 |
na := (selectedText occurrencesOf:$_) + 1. |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1351 |
selector := JavaScriptParser basicNew translatedSmalltalkSelectorFor:selectedText numArgs:na |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1352 |
]. |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1353 |
] ifFalse:[ |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1354 |
selector := SystemBrowser extractSelectorFrom:selectedText. |
77476b56175b
browse-implementors also for javaScript
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
1355 |
]. |
2714 | 1356 |
browserClass := UserPreferences current systemBrowserClass. |
1357 |
||
3287 | 1358 |
(selector notNil and:[selector ~= selectedText]) ifTrue:[ |
3579
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1359 |
(SystemBrowser |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1360 |
findImplementorsOfAny:(Array with:selectedText) |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1361 |
in:(Smalltalk allClasses) |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1362 |
ignoreCase:false) isEmpty ifTrue:[ |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1363 |
browserClass browseImplementorsOf:selector |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1364 |
] ifFalse:[ |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1365 |
browserClass browseImplementorsOfAny:(Set with:selector with:selectedText) |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1366 |
]. |
2534
55df9165ddd7
findImplementorsOfAny if in doubt
Claus Gittinger <cg@exept.de>
parents:
2519
diff
changeset
|
1367 |
] ifFalse:[ |
2714 | 1368 |
browserClass browseImplementorsOf:(selector ? selectedText) |
2534
55df9165ddd7
findImplementorsOfAny if in doubt
Claus Gittinger <cg@exept.de>
parents:
2519
diff
changeset
|
1369 |
] |
2457
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1370 |
] |
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1371 |
]. |
2451
ae246b6c4df7
added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents:
2440
diff
changeset
|
1372 |
|
ae246b6c4df7
added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents:
2440
diff
changeset
|
1373 |
"Created: / 5.11.2001 / 17:32:23 / cg" |
2485
1e4ab722cb11
browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents:
2477
diff
changeset
|
1374 |
"Modified: / 19.11.2001 / 22:15:17 / cg" |
2451
ae246b6c4df7
added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents:
2440
diff
changeset
|
1375 |
! |
ae246b6c4df7
added browse implementors menu item
Claus Gittinger <cg@exept.de>
parents:
2440
diff
changeset
|
1376 |
|
2307 | 1377 |
browseIt |
1378 |
"evaluate the code and open a browser on the resulting class (if it evaluates to one), |
|
2713 | 1379 |
or the class of the resulting object (if it does not evaluate to a class). |
1380 |
||
1381 |
Added feature: if selection is of the form class >> selector, immediately switch to that selector." |
|
1382 |
||
3910 | 1383 |
|codeToEvaluate idx selector evaluatedValue classToBrowse| |
2713 | 1384 |
|
3596 | 1385 |
codeToEvaluate := (self selectionOrTextOfCursorLine ? '') withoutSeparators. |
2713 | 1386 |
idx := codeToEvaluate indexOfSubCollection:'>>'. |
1387 |
idx ~~ 0 ifTrue:[ |
|
2717 | 1388 |
selector := (codeToEvaluate copyFrom:idx+2) withoutSeparators string. |
3155 | 1389 |
(selector startsWith:'#') ifTrue:[ |
1390 |
selector := Symbol readFrom:selector. |
|
1391 |
]. |
|
2713 | 1392 |
codeToEvaluate := codeToEvaluate copyTo:idx-1. |
1393 |
]. |
|
2307 | 1394 |
|
3910 | 1395 |
Parser parseErrorSignal handle:[:ex | |
1396 |
|className| |
|
2410 | 1397 |
|
3910 | 1398 |
"/ fallback, if garbage is selected, look for matching classes. |
1399 |
className := SystemBrowser |
|
1400 |
askForClassNameMatching:codeToEvaluate |
|
1401 |
inEnvironment:nil |
|
1402 |
for:nil. |
|
1403 |
className isNil ifTrue:[^ self]. |
|
1404 |
] do:[ |
|
1405 |
self |
|
1406 |
do:codeToEvaluate |
|
1407 |
withValueDo:[:result | evaluatedValue := result] |
|
1408 |
]. |
|
1409 |
||
1410 |
evaluatedValue isNil ifTrue:[ |
|
1411 |
codeToEvaluate asCollectionOfWords size == 1 ifTrue:[ |
|
1412 |
codeToEvaluate isUppercaseFirst ifTrue:[ |
|
1413 |
Dialog information:(codeToEvaluate allBold , ' is unbound or nil'). |
|
1414 |
^ self. |
|
1415 |
]. |
|
1416 |
] |
|
1417 |
]. |
|
1418 |
||
1419 |
classToBrowse := evaluatedValue isBehavior |
|
1420 |
ifTrue:[ evaluatedValue ] |
|
1421 |
ifFalse:[ evaluatedValue class ]. |
|
1422 |
classToBrowse browserClass openInClass:classToBrowse selector:selector |
|
2307 | 1423 |
! |
1424 |
||
2285 | 1425 |
browseItsClass |
1426 |
"user selected 'browseItsClass' from menu; evaluate the code |
|
1427 |
and open a browser on the results class" |
|
1428 |
||
1429 |
^ self |
|
3272 | 1430 |
do:(self selectionAsString) |
2410 | 1431 |
withValueDo:[:result | |
1432 |
result class browserClass openInClass:result class selector:nil |
|
1433 |
] |
|
2285 | 1434 |
|
2410 | 1435 |
"Modified: / 26.9.2001 / 17:38:06 / cg" |
2285 | 1436 |
! |
1437 |
||
2454 | 1438 |
browseReferencesToIt |
1439 |
"open a browser on all references to the selected global" |
|
1440 |
||
2457
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1441 |
|sel| |
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1442 |
|
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1443 |
sel := self selectionAsString. |
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1444 |
sel size > 0 ifTrue:[ |
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1445 |
self windowGroup withWaitCursorDo:[ |
3959 | 1446 |
(Smalltalk includesKey:sel asSymbol) ifFalse:[ |
1447 |
sel := ((NameSpace allNameSpaces detect:[:ns | ns includesKey:sel asSymbol]) at:sel asSymbol) name. |
|
1448 |
]. |
|
2457
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1449 |
(UserPreferences current systemBrowserClass) |
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1450 |
browseReferendsOf:sel |
0c1beddda9cb
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
1451 |
]. |
2454 | 1452 |
]. |
1453 |
||
1454 |
"Created: / 5.11.2001 / 17:32:23 / cg" |
|
1455 |
"Modified: / 5.11.2001 / 17:32:38 / cg" |
|
1456 |
! |
|
1457 |
||
2462 | 1458 |
browseSendersOfIt |
1459 |
"open a browser on the senders of the selected text" |
|
1460 |
||
2715 | 1461 |
|selectedText selector| |
2462 | 1462 |
|
2715 | 1463 |
selectedText := self selectionAsString. |
1464 |
selectedText size > 0 ifTrue:[ |
|
2462 | 1465 |
self windowGroup withWaitCursorDo:[ |
3287 | 1466 |
selector := SystemBrowser extractSelectorFrom:selectedText. |
2462 | 1467 |
(UserPreferences current systemBrowserClass) |
2715 | 1468 |
browseAllCallsOn:(selector ? selectedText) |
2462 | 1469 |
] |
1470 |
]. |
|
1471 |
||
1472 |
"Created: / 5.11.2001 / 17:32:23 / cg" |
|
2485
1e4ab722cb11
browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents:
2477
diff
changeset
|
1473 |
"Modified: / 19.11.2001 / 22:15:27 / cg" |
2462 | 1474 |
! |
1475 |
||
418 | 1476 |
doIt |
1477 |
"user selected 'doIt' from menu; show a wait-cursor, evaluate the code |
|
1478 |
and finally restore cursor; return result of evaluation" |
|
1479 |
||
1521
e2bb7811e4db
removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents:
1516
diff
changeset
|
1480 |
^ self |
3272 | 1481 |
do:(self selectionOrTextOfCursorLine) |
1521
e2bb7811e4db
removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents:
1516
diff
changeset
|
1482 |
withValueDo:[:result | ] |
e2bb7811e4db
removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents:
1516
diff
changeset
|
1483 |
|
e2bb7811e4db
removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents:
1516
diff
changeset
|
1484 |
"Modified: / 16.5.1998 / 16:45:01 / cg" |
418 | 1485 |
! |
1486 |
||
1487 |
editMenu |
|
1107 | 1488 |
"return my popUpMenu; thats the superclasses menu |
1489 |
PLUS st-evaluation items: doIt, printIt and inspectIt." |
|
1490 |
||
2459 | 1491 |
<resource: #keyboard (#DoIt #PrintIt #InspectIt |
1492 |
#CommentSelection #UncommentSelection |
|
2573
52c995a1ea78
accelerators for browseIt and implementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
2571
diff
changeset
|
1493 |
#BrowseIt #ImplementorsOfIt |
2459 | 1494 |
)> |
1262
d69149b5be1f
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1251
diff
changeset
|
1495 |
<resource: #programMenu> |
489 | 1496 |
|
2867 | 1497 |
|m sub subsub idx sensor s s2| |
418 | 1498 |
|
1499 |
m := super editMenu. |
|
3252 | 1500 |
((sensor := self sensor) notNil and:[sensor ctrlDown and:[sensor shiftDown not]]) ifTrue:[ |
2459 | 1501 |
sub := m. |
1502 |
m := nil. |
|
1503 |
] ifFalse:[ |
|
1504 |
sub := m subMenuAt:#others. |
|
1505 |
]. |
|
418 | 1506 |
|
2459 | 1507 |
sub notNil ifTrue:[ |
2867 | 1508 |
|
2459 | 1509 |
" |
2867 | 1510 |
workspaces support #browse, implementors etc. add them after paste. |
2459 | 1511 |
" |
2867 | 1512 |
sub |
1513 |
addItemList:#( |
|
1514 |
('-' ) |
|
3910 | 1515 |
('Browse' browseIt BrowseIt ) |
1516 |
('Senders of It' browseSendersOfIt ) |
|
1517 |
('Implementors of It' browseImplementorsOfIt ImplementorsOfIt ) |
|
1518 |
('References to It' browseReferencesToIt ) |
|
1519 |
"/ ('Classes Containing It in Name' browseClassesContainingItInName ) |
|
1520 |
"/ ('Methods Contaníning It in Name' browseMethodsContainingItInName ) |
|
1521 |
"/ ('Methods Contaníning It in Source' browseMethodsContainingItInSource ) |
|
2867 | 1522 |
('-' ) |
1523 |
('TimeIt' timeIt ) |
|
1524 |
('SpyOnIt' spyOnIt )) |
|
2922
70e3f3ec7980
oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
1525 |
resources:resources |
2459 | 1526 |
after:#gotoLine. |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1527 |
|
2867 | 1528 |
subsub := sub subMenuAt:#tools. |
1529 |
subsub notNil ifTrue:[ |
|
1530 |
subsub |
|
1531 |
addItemList:#( |
|
1532 |
('-' ) |
|
1533 |
('Comment' commentSelection CommentSelection ) |
|
1534 |
('Uncomment' uncommentSelection UncommentSelection )) |
|
2922
70e3f3ec7980
oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
1535 |
resources:resources |
2867 | 1536 |
after:#'indent'. |
1537 |
]. |
|
1538 |
||
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1539 |
self hasSelection ifFalse:[ |
3272 | 1540 |
sub disableAll:#(browseImplementorsOfIt browseSendersOfIt browseReferencesToIt timeIt spyOnIt |
1541 |
commentSelection uncommentSelection ) |
|
2454 | 1542 |
] ifTrue:[ |
1543 |
s := self selectionAsString. |
|
2485
1e4ab722cb11
browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents:
2477
diff
changeset
|
1544 |
s notNil ifTrue:[ |
3579
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1545 |
s asSymbolIfInterned isNil ifTrue:[ |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1546 |
s2 := SystemBrowser extractSelectorFrom:s. |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1547 |
s2 notNil ifTrue:[ |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1548 |
s2 := s2 asSymbolIfInterned. |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1549 |
]. |
3923810267b6
better implementorsOf selector extraction
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
1550 |
]. |
2454 | 1551 |
]. |
2487
47e0a1faf544
disabling of impl/senders menu
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
1552 |
(s2 isNil and:[s isNil]) ifTrue:[ |
2485
1e4ab722cb11
browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents:
2477
diff
changeset
|
1553 |
sub disableAll:#(browseImplementorsOfIt browseSendersOfIt). |
1e4ab722cb11
browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents:
2477
diff
changeset
|
1554 |
]. |
3959 | 1555 |
"/ a global or namespace-var selected ? |
1556 |
(s notNil |
|
1557 |
and:[s asSymbolIfInterned notNil |
|
1558 |
and:[ (Smalltalk includesKey:s asSymbol) |
|
1559 |
or:[ (NameSpace allNameSpaces contains:[:ns | ns includesKey:s asSymbol]) ]]]) |
|
1560 |
ifFalse:[ |
|
2485
1e4ab722cb11
browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents:
2477
diff
changeset
|
1561 |
sub disable:#browseReferencesToIt. |
1e4ab722cb11
browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents:
2477
diff
changeset
|
1562 |
]. |
2595 | 1563 |
self isReadOnly ifTrue:[ |
2641 | 1564 |
sub disableAll:#(commentSelection uncommentSelection) |
2595 | 1565 |
]. |
1395
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1566 |
]. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1567 |
]. |
cbadcf93c173
moved comment stuff from CodeView to here.
Claus Gittinger <cg@exept.de>
parents:
1354
diff
changeset
|
1568 |
|
2459 | 1569 |
m notNil ifTrue:[ |
1570 |
" |
|
1571 |
workspaces support #doIt, #printIt and #inspectIt |
|
1572 |
add them after paste. |
|
1573 |
" |
|
1574 |
idx := m indexOf:#paste. |
|
1575 |
idx == 0 ifTrue:[idx := m indexOf:#pasteOrReplace]. |
|
1576 |
idx ~~ 0 ifTrue:[ |
|
2867 | 1577 |
m |
1578 |
addItemList:#( |
|
1579 |
('-' ) |
|
1580 |
('DoIt' doIt DoIt ) |
|
1581 |
('PrintIt' printIt PrintIt ) |
|
1582 |
('InspectIt' inspectIt InspectIt)) |
|
2922
70e3f3ec7980
oops - doIt and friends were not translated
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
1583 |
resources:resources |
2459 | 1584 |
after:idx. |
1585 |
||
1586 |
]. |
|
1587 |
||
3279
087a9e32c714
oops - autoselect for doIt was done too early
Claus Gittinger <cg@exept.de>
parents:
3272
diff
changeset
|
1588 |
(self hasSelectionOrTextInCursorLine) ifFalse:[ |
3272 | 1589 |
|lNr line| |
1590 |
||
1591 |
lNr := self cursorLine. |
|
1592 |
line := self listAt:lNr. |
|
1593 |
line isEmptyOrNil ifTrue:[ |
|
1594 |
m disableAll:#(printIt doIt inspectIt browseIt) |
|
1595 |
]. |
|
2459 | 1596 |
]. |
2595 | 1597 |
self isReadOnly ifTrue:[ |
1598 |
m disable:#printIt |
|
1599 |
]. |
|
418 | 1600 |
]. |
1601 |
||
2459 | 1602 |
^ m ? sub. |
430 | 1603 |
|
1501 | 1604 |
"Modified: / 22.4.1998 / 21:49:06 / ca" |
2485
1e4ab722cb11
browse senders/implementors: better selector check
Claus Gittinger <cg@exept.de>
parents:
2477
diff
changeset
|
1605 |
"Modified: / 19.11.2001 / 23:12:01 / cg" |
418 | 1606 |
! |
1607 |
||
1608 |
inspectIt |
|
1609 |
"user selected 'inspectIt' from menu; use doIt to evaluate the code |
|
1610 |
and start an inspector on the result" |
|
1611 |
||
2981
75abc5efbf67
shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents:
2980
diff
changeset
|
1612 |
|shifted| |
75abc5efbf67
shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents:
2980
diff
changeset
|
1613 |
|
75abc5efbf67
shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents:
2980
diff
changeset
|
1614 |
shifted := self sensor shiftDown. |
75abc5efbf67
shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents:
2980
diff
changeset
|
1615 |
|
1521
e2bb7811e4db
removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents:
1516
diff
changeset
|
1616 |
^ self |
3272 | 1617 |
do:(self selectionOrTextOfCursorLine) |
2982
9a831ab53acc
shift-inspect (= basicInspect)
Claus Gittinger <cg@exept.de>
parents:
2981
diff
changeset
|
1618 |
withValueDo:[:result | shifted ifTrue:[result basicInspect] ifFalse:[result inspect] ] |
1521
e2bb7811e4db
removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents:
1516
diff
changeset
|
1619 |
|
e2bb7811e4db
removed useless intermediate invoke (looks better in debugView)
Claus Gittinger <cg@exept.de>
parents:
1516
diff
changeset
|
1620 |
"Modified: / 16.5.1998 / 16:44:56 / cg" |
418 | 1621 |
! |
1622 |
||
1623 |
printIt |
|
1624 |
"user selected 'printIt' from menu; use doIt to evaluate the code |
|
1625 |
and insert result of evaluation into my text. |
|
1626 |
If the text is readOnly, do nothing." |
|
1627 |
||
1734 | 1628 |
self isReadOnly ifTrue:[ |
3511 | 1629 |
self beep. |
1630 |
^ self. |
|
1631 |
]. |
|
1632 |
self |
|
1633 |
undoableDo:[ |
|
1634 |
self |
|
1635 |
do:(self selectionOrTextOfCursorLine) |
|
1636 |
withValueDo:[:result | |
|
1637 |
self cursorLine:selectionEndLine col:(selectionEndCol + 1). |
|
1638 |
self insertSelectedStringAtCursor:(result displayString "printString") |
|
1639 |
] |
|
1640 |
] |
|
1641 |
info:'PrintIt' |
|
1642 |
||
1643 |
"Modified: / 08-11-2007 / 11:35:31 / cg" |
|
1644 |
! |
|
418 | 1645 |
|
3511 | 1646 |
replaceIt |
1647 |
"like printIt, but replace the selection with the result, instead of |
|
1648 |
pasting it after the selection." |
|
1649 |
||
1650 |
self isReadOnly ifTrue:[ |
|
1651 |
self beep. |
|
1652 |
^ self |
|
1653 |
]. |
|
1654 |
||
1655 |
self |
|
1656 |
undoableDo:[ |
|
1657 |
self |
|
1658 |
do:(self selectionOrTextOfCursorLine) |
|
1659 |
withValueDo:[:result | |
|
1660 |
self replaceSelectionBy:(result displayString "printString") |
|
1661 |
]. |
|
1662 |
undoSupport actionInfo:'ReplaceIt'. |
|
1663 |
] |
|
1664 |
info:'ReplaceIt' |
|
1665 |
||
1666 |
"Created: / 08-11-2007 / 11:31:54 / cg" |
|
1501 | 1667 |
! |
1668 |
||
1669 |
spyOnIt |
|
1670 |
"user selected 'spyOnIt' from menu; show a wait-cursor, evaluate the code |
|
1671 |
and finally restore cursor; return result of evaluation" |
|
1672 |
||
1673 |
|code| |
|
1674 |
||
3511 | 1675 |
code := 'MessageTally spyDetailOn:[' , self selectionAsString, ']'. |
1501 | 1676 |
self do:code withValueDo:[:result | ] |
1677 |
||
3511 | 1678 |
"Modified: / 22-04-1998 / 22:03:53 / ca" |
1679 |
"Modified: / 08-11-2007 / 11:36:38 / cg" |
|
1501 | 1680 |
! |
1681 |
||
1682 |
timeIt |
|
1683 |
"user selected 'timeIt' from menu; show a wait-cursor, evaluate the code |
|
1684 |
and finally restore cursor; return result of evaluation" |
|
1685 |
||
1686 |
|code| |
|
1687 |
||
3272 | 1688 |
code := '|t| t := Time millisecondsToRun:[' , self selectionAsString, ']. |
3141 | 1689 |
|
1690 |
Transcript showCR:''execution time: '' , t printString , '' ms''.'. |
|
1501 | 1691 |
self do:code withValueDo:[:result | ] |
1692 |
||
1693 |
"Modified: / 22.4.1998 / 22:03:51 / ca" |
|
418 | 1694 |
! ! |
1695 |
||
3968
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1696 |
!Workspace methodsFor:'misc'! |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1697 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1698 |
expandAbbreviation |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1699 |
"after receiving an Alt-shift key-event, look for the string before the |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1700 |
cursor, find an abbrev for it and expand." |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1701 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1702 |
|expandedString abortExpandAction oldSelectionStartLine oldSelectionStartCol oldSelectionEndLine oldSelectionEndCol oldCursorLine oldCursorCol |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1703 |
newCursorPos replStartCol| |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1704 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1705 |
oldCursorLine := self cursorLine. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1706 |
oldCursorCol := self cursorCol. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1707 |
oldSelectionStartLine := self selectionStartLine. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1708 |
oldSelectionStartCol := self selectionStartCol. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1709 |
oldSelectionEndLine := self selectionEndLine. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1710 |
oldSelectionEndCol := self selectionEndCol. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1711 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1712 |
abortExpandAction := [ |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1713 |
self selectFromLine:oldSelectionStartLine |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1714 |
col:oldSelectionStartCol |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1715 |
toLine:oldSelectionEndLine |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1716 |
col:oldSelectionEndCol. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1717 |
self cursorLine: oldCursorLine col: oldCursorCol. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1718 |
]. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1719 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1720 |
expandedString := self findAbbreviationKeyBeforeCursor. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1721 |
expandedString isNil ifTrue:[ |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1722 |
abortExpandAction value. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1723 |
^ self |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1724 |
]. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1725 |
newCursorPos := expandedString indexOf:$!!. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1726 |
newCursorPos ~~ 0 ifTrue:[ |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1727 |
expandedString := expandedString copyWithout:$!!. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1728 |
]. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1729 |
replStartCol := self selectionStartCol. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1730 |
self |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1731 |
undoableDo:[ |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1732 |
self replaceSelectionWith: expandedString] |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1733 |
info:'Replace'. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1734 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1735 |
newCursorPos == 0 ifTrue:[ |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1736 |
"/ cursor already fine (at the end) |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1737 |
] ifFalse:[ |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1738 |
self cursorCol:replStartCol+newCursorPos-1 |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1739 |
] |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1740 |
! |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1741 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1742 |
findAbbreviationKeyBeforeCursor |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1743 |
"after receiving an Alt-shift key-event, look for the string before the |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1744 |
cursor, find an abbrev for it and expand." |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1745 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1746 |
|sniplets keys minMax maxKeyLen minKeyLen line stringBeforeCursor| |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1747 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1748 |
sniplets := self class sniplets. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1749 |
keys := sniplets keys. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1750 |
minMax := (keys collect:[:k | k size]) minMax. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1751 |
minKeyLen := minMax first. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1752 |
maxKeyLen := minMax second. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1753 |
line := (self at:cursorLine) ? ''. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1754 |
stringBeforeCursor := line string copyTo:((cursorCol-1) min:line size). |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1755 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1756 |
maxKeyLen := maxKeyLen min:stringBeforeCursor size. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1757 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1758 |
(maxKeyLen to:minKeyLen by:-1) do:[:l | |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1759 |
|lCharactersBeforeCursor expandedString| |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1760 |
|
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1761 |
lCharactersBeforeCursor := stringBeforeCursor last:l. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1762 |
expandedString := sniplets at:lCharactersBeforeCursor ifAbsent:nil. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1763 |
expandedString notNil ifTrue:[ |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1764 |
self selectFromLine:cursorLine col:cursorCol-l toLine:cursorLine col:cursorCol-1. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1765 |
^ expandedString |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1766 |
]. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1767 |
]. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1768 |
^ nil. |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1769 |
! ! |
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1770 |
|
2646 | 1771 |
!Workspace methodsFor:'queries'! |
1772 |
||
1773 |
isWorkspace |
|
1774 |
^ true |
|
1775 |
! ! |
|
1776 |
||
206 | 1777 |
!Workspace class methodsFor:'documentation'! |
1778 |
||
1779 |
version |
|
3968
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1780 |
^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.209 2009-10-12 11:39:01 cg Exp $' |
3959 | 1781 |
! |
1782 |
||
1783 |
version_CVS |
|
3968
37af1e95c4b4
category and comment changes
Claus Gittinger <cg@exept.de>
parents:
3959
diff
changeset
|
1784 |
^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.209 2009-10-12 11:39:01 cg Exp $' |
858 | 1785 |
! ! |