author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 29 Sep 2011 16:44:37 +0100 | |
branch | jv |
changeset 17869 | 9610c6c94e71 |
parent 17865 | 598963c6ff8e |
child 17892 | d86c8bd5ece3 |
permissions | -rw-r--r-- |
4466
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
1 |
" |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
2 |
COPYRIGHT (c) 1999 by eXept Software AG |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
3 |
All Rights Reserved |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
4 |
|
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
5 |
This software is furnished under a license and may be used |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
10 |
hereby transferred. |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
11 |
" |
6206 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
8817
387971ee2b30
Notification is not an exception.
Claus Gittinger <cg@exept.de>
parents:
8778
diff
changeset
|
14 |
GenericException subclass:#Notification |
17862 | 15 |
instanceVariableNames:'tag' |
4443 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Kernel-Exceptions' |
|
19 |
! |
|
20 |
||
21 |
!Notification class methodsFor:'documentation'! |
|
22 |
||
4466
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
23 |
copyright |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
24 |
" |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
25 |
COPYRIGHT (c) 1999 by eXept Software AG |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
26 |
All Rights Reserved |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
27 |
|
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
28 |
This software is furnished under a license and may be used |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
29 |
only in accordance with the terms of that license and with the |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
30 |
inclusion of the above copyright notice. This software may not |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
31 |
be provided or otherwise made available to, or used by, any |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
32 |
other person. No title to or ownership of the software is |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
33 |
hereby transferred. |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
34 |
" |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
35 |
|
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
36 |
! |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4443
diff
changeset
|
37 |
|
4443 | 38 |
documentation |
39 |
" |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
40 |
Notification is the superclass of all notification signals in the system. |
11200 | 41 |
contrast to regular exceptions, Notifications are ignored, if no handler is present |
42 |
and a default value is returned from the raise. |
|
8701
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
43 |
When a handler finishes, the do-block is proceeded with the exception handlers value |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
44 |
(an Exception does a return in this case.). |
4443 | 45 |
|
11200 | 46 |
Thanks to proceedable exceptions, Notifications allow for non-GUI model code to provide |
47 |
user notifications which are optionally shown. |
|
48 |
Very useful, for example to provide progress information from a method which can be |
|
49 |
invoked both from a GUI-Tool (where notifications are wanted) and also from the system, |
|
50 |
where such notifications are not desired. |
|
51 |
||
4443 | 52 |
[author:] |
53 |
Stefan Vogel |
|
54 |
||
55 |
[see also:] |
|
4550 | 56 |
Signal QuerySignal |
4443 | 57 |
" |
58 |
! |
|
59 |
||
4550 | 60 |
examples |
4443 | 61 |
" |
6431 | 62 |
an up-notification from a deeply nested operation to a higher level: |
4550 | 63 |
[exBegin] |
64 |
|zero| |
|
65 |
||
66 |
zero := 0. |
|
6431 | 67 |
Notification handle:[:n | |
68 |
Transcript showCR:'Please note that: ' , n description. |
|
69 |
n proceedWith:true |
|
4550 | 70 |
] do:[ |
71 |
'nesting'. |
|
72 |
[ |
|
73 |
[ |
|
8516 | 74 |
Error handle:[:ex | |
4550 | 75 |
Transcript showCR:'some error: ' , ex errorString. |
76 |
ex proceed |
|
77 |
] do:[ |
|
78 |
[ |
|
79 |
1 // zero. 'an error which is caught in the handler'. |
|
6431 | 80 |
Notification notify:'hello world' |
4550 | 81 |
] value |
82 |
] |
|
83 |
] value |
|
84 |
] value |
|
85 |
] |
|
86 |
[exEnd] |
|
4443 | 87 |
" |
88 |
! ! |
|
89 |
||
90 |
!Notification class methodsFor:'initialization'! |
|
91 |
||
92 |
initialize |
|
93 |
||
4550 | 94 |
NotifierString := 'Notification:' |
95 |
! ! |
|
96 |
||
97 |
!Notification class methodsFor:'answering queries'! |
|
98 |
||
99 |
answer:someAnswer do:aBlock |
|
100 |
"evaluate the argument, aBlock. |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
101 |
If the receiver is queried during evaluation, answer and proceed with someAnswer. |
4550 | 102 |
This is a wrapper for #handle:do: for lazy typists; no new functionality." |
103 |
||
8698
948da171e6e5
Make #handle - contexts also #return-able
Stefan Vogel <sv@exept.de>
parents:
8692
diff
changeset
|
104 |
<context: #return> |
4550 | 105 |
<exception: #handle> |
106 |
||
107 |
"/ thisContext markForHandle. -- same as above pragma |
|
5227
73a2dc34cb42
#answer:do: now returns the evaluated blocks value
Claus Gittinger <cg@exept.de>
parents:
4605
diff
changeset
|
108 |
^ aBlock value. "the real logic is in Exception>>doRaise" |
4550 | 109 |
|
110 |
" |
|
111 |
Notification answer:true do:[ |
|
112 |
Transcript showCR:'query answers: ' , (Query query printString). |
|
113 |
] |
|
114 |
" |
|
4443 | 115 |
|
116 |
" |
|
4550 | 117 |
Notification answer:false do:[ |
118 |
Transcript showCR:'first query answers: ' , (Query query printString). |
|
119 |
Query answer:true do:[ |
|
120 |
Transcript showCR:'second query answers: ' , (Query query printString). |
|
121 |
] |
|
122 |
] |
|
4443 | 123 |
" |
124 |
||
4550 | 125 |
"Created: / 10.7.1996 / 15:08:20 / cg" |
126 |
"Modified: / 14.10.1996 / 16:59:18 / cg" |
|
127 |
"Modified: / 25.7.1999 / 23:12:19 / stefan" |
|
128 |
! ! |
|
129 |
||
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
130 |
!Notification class methodsFor:'misc ui support'! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
131 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
132 |
iconInBrowserSymbol |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
133 |
<resource: #programImage> |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
134 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
135 |
^ #notificationClassBrowserIcon |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
136 |
! ! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
137 |
|
4550 | 138 |
!Notification class methodsFor:'queries'! |
139 |
||
140 |
accepts:aSignal |
|
141 |
"return true, if the receiver accepts the argument, aSignal. |
|
142 |
(i.e. the receiver is aSignal or a parent of it). False otherwise." |
|
143 |
||
144 |
|s| |
|
145 |
||
146 |
self == aSignal ifTrue:[^ true]. |
|
147 |
aSignal isQuerySignal ifFalse:[^ false]. |
|
148 |
||
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
149 |
s := aSignal parent. |
4550 | 150 |
[s notNil] whileTrue:[ |
151 |
self == s ifTrue:[^ true]. |
|
152 |
s := s parent |
|
153 |
]. |
|
154 |
^ false |
|
155 |
||
156 |
"Modified: / 22.3.1999 / 12:45:32 / stefan" |
|
157 |
"Created: / 23.7.1999 / 15:18:00 / stefan" |
|
158 |
! |
|
159 |
||
160 |
defaultAnswer |
|
161 |
"Return the default answer to the Query. This method is called, |
|
162 |
if nobody catches the signal. |
|
163 |
||
164 |
Subclasses may redefine this method." |
|
165 |
||
166 |
"Calling raiseRequest here will execute the exception's action method" |
|
167 |
||
168 |
^ super raiseRequest |
|
169 |
||
170 |
"Created: / 23.7.1999 / 15:16:03 / stefan" |
|
171 |
! |
|
172 |
||
173 |
handlerForSignal:signal context:theContext originator:originator |
|
174 |
"answer the handler block for the signal from originator. |
|
175 |
The block is retrieved from aContext. |
|
176 |
Answer nil if the signal is not handled" |
|
177 |
||
178 |
|arg| |
|
179 |
||
180 |
theContext selector == #'answer:do:' ifTrue:[ |
|
181 |
(self == signal or:[self accepts:signal]) ifTrue:[ |
|
182 |
arg := theContext argAt:1. |
|
183 |
^ [:ex| ex proceedWith:arg]. |
|
184 |
] |
|
185 |
] ifFalse:[ |
|
186 |
^ super handlerForSignal:signal context:theContext originator:originator. |
|
187 |
]. |
|
188 |
||
189 |
^ nil |
|
190 |
||
191 |
"Created: / 25.7.1999 / 23:11:55 / stefan" |
|
192 |
! |
|
193 |
||
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
194 |
handles:anException |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
195 |
"return true, if the receiver handles the argument, anException. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
196 |
(i.e. the receiver is anExceptions signal or a parent of it)" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
197 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
198 |
|signal| |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
199 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
200 |
signal := anException signal. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
201 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
202 |
self == signal ifTrue:[^ true]. "quick check" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
203 |
anException isNotification ifFalse:[^ false]. "speed up non-queries by not traversing the parent chain" |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
204 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
205 |
[(signal := signal parent) notNil] whileTrue:[ |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
206 |
self == signal ifTrue:[^ true]. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
207 |
]. |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
208 |
^ false |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
209 |
! |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
210 |
|
4550 | 211 |
isQuerySignal |
4605 | 212 |
"return true, if this is a querySignal - always return true here" |
4550 | 213 |
|
214 |
^ true |
|
215 |
||
216 |
"Created: / 23.7.1999 / 14:59:50 / stefan" |
|
217 |
! |
|
218 |
||
6431 | 219 |
notify:aMessageString |
220 |
"raise the query - return the handlers value, or the default |
|
221 |
value, if there is no handler." |
|
222 |
||
223 |
^ self raiseRequestErrorString:aMessageString |
|
224 |
! |
|
225 |
||
4550 | 226 |
query |
227 |
"raise the query - return the handlers value, or the default |
|
228 |
value, if there is no handler. |
|
229 |
Invoking the handler is exactly the functionality of Signal>>raiseRequest, |
|
8778 | 230 |
but we can do it faster here (avoiding the construction of an exception instance)." |
4550 | 231 |
|
8683
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
232 |
|con signal| |
4550 | 233 |
|
234 |
con := Context findFirstSpecialHandle:true raise:false. |
|
235 |
[con notNil] whileTrue:[ |
|
8692
3abb4811f5b2
When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents:
8683
diff
changeset
|
236 |
(con selector ~~ #answer:do:) ifTrue:[ |
17841 | 237 |
"there is another handler block, maybe it will return the answer. |
238 |
Call it via raiseRequest" |
|
4550 | 239 |
^ super raiseRequest |
240 |
]. |
|
8683
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
241 |
signal := con receiver. |
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
242 |
signal == self ifTrue:[ |
4550 | 243 |
^ con argAt:1 |
244 |
]. |
|
8692
3abb4811f5b2
When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents:
8683
diff
changeset
|
245 |
signal isNil ifTrue:[ |
3abb4811f5b2
When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents:
8683
diff
changeset
|
246 |
self error:'nil receiver in #answer:do: - send'. |
3abb4811f5b2
When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents:
8683
diff
changeset
|
247 |
]. |
8683
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
248 |
(signal accepts:self) ifTrue:[ |
8692
3abb4811f5b2
When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents:
8683
diff
changeset
|
249 |
^ con argAt:1 |
4550 | 250 |
]. |
251 |
con := con findSpecialHandle:true raise:false. |
|
252 |
]. |
|
253 |
||
254 |
"/ no handler found - return the default value |
|
255 |
^ self defaultAnswer |
|
256 |
||
257 |
"Modified: / 15.6.1998 / 21:27:37 / cg" |
|
258 |
"Modified: / 25.7.1999 / 23:15:16 / stefan" |
|
259 |
! |
|
260 |
||
261 |
raise |
|
262 |
"QuerySignals are proceedable by definition, |
|
263 |
so they should be raised with #query or #raiseRequest" |
|
264 |
||
265 |
^ self shouldNotImplement |
|
266 |
||
267 |
"Created: / 23.7.1999 / 15:19:17 / stefan" |
|
268 |
! |
|
269 |
||
270 |
raiseRequest |
|
271 |
"redefined to use #query" |
|
272 |
||
273 |
^ self query |
|
274 |
||
275 |
"Created: / 25.7.1999 / 23:25:59 / stefan" |
|
4443 | 276 |
! ! |
277 |
||
17862 | 278 |
!Notification methodsFor:'accessing'! |
279 |
||
280 |
tag |
|
281 |
"for squeak compatibility" |
|
282 |
||
283 |
^ tag |
|
284 |
||
285 |
"Modified (comment): / 11-09-2011 / 16:40:54 / cg" |
|
286 |
! |
|
287 |
||
288 |
tag:aSzmbol |
|
289 |
"for squeak compatibility" |
|
290 |
||
291 |
tag := aSzmbol. |
|
292 |
||
293 |
"Modified (format): / 11-09-2011 / 16:41:01 / cg" |
|
294 |
! ! |
|
295 |
||
4443 | 296 |
!Notification methodsFor:'default actions'! |
297 |
||
4525 | 298 |
defaultAction |
4550 | 299 |
"the default action is to return the default value. |
300 |
Subclasses may redefine this" |
|
4443 | 301 |
|
8683
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
302 |
|handlerBlock| |
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
303 |
|
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
304 |
"try per signal handler. |
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
305 |
I may have been created from a QuerySignal" |
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
306 |
|
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
307 |
(handlerBlock := signal handlerBlock) notNil ifTrue:[ |
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
308 |
"... and call it" |
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
309 |
^ handlerBlock value:self. |
a162510a0408
QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
310 |
]. |
6451
f22b12c0349a
renamed #defaultValue -> #defaultResumeValue (vw54 compat.)
Claus Gittinger <cg@exept.de>
parents:
6431
diff
changeset
|
311 |
^ self defaultResumeValue |
4443 | 312 |
|
4550 | 313 |
"Modified: / 23.7.1999 / 15:13:34 / stefan" |
4443 | 314 |
! ! |
315 |
||
8701
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
316 |
!Notification methodsFor:'private'! |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
317 |
|
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
318 |
LATERdoCallHandler:aHandlerBlock |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
319 |
"SV: Have to think about..." |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
320 |
"call the handler proper |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
321 |
- an extra method is needed to have a raise-marked context around. |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
322 |
(see implementation of #reject and #proceed). |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
323 |
Redefined from GenericException to do a proceed here" |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
324 |
|
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
325 |
<context: #return> |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
326 |
<exception: #raise> |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
327 |
|
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
328 |
|val| |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
329 |
|
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
330 |
aHandlerBlock argumentCount == 0 ifTrue:[ |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
331 |
"/ 0-arg handler - not interested in the ex - object |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
332 |
val := aHandlerBlock value |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
333 |
] ifFalse:[ |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
334 |
"/ 1-arg handler - pass myself as exception argument |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
335 |
val := aHandlerBlock value:self. |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
336 |
]. |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
337 |
|
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
338 |
"handler fall through - is just like a #proceedWith:(aHandlerBlock value)" |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
339 |
|
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
340 |
self proceedWith:val |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
341 |
! ! |
bd5034470a47
Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents:
8698
diff
changeset
|
342 |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
343 |
!Notification methodsFor:'queries'! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
344 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
345 |
query |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
346 |
"notice the implementation on the class-side: if no additional parameters are to be passed, |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
347 |
we do not even arrive here, because query has inlined the raiseRequest code" |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
348 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
349 |
^ self raiseRequest |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
350 |
! ! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
351 |
|
8681
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
352 |
!Notification methodsFor:'testing'! |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
353 |
|
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
354 |
isNotification |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
355 |
^ true |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
356 |
! ! |
38aa963476a5
Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents:
8516
diff
changeset
|
357 |
|
4443 | 358 |
!Notification class methodsFor:'documentation'! |
359 |
||
360 |
version |
|
17869 | 361 |
^ '$Id: Notification.st 10700 2011-09-29 15:44:37Z vranyj1 $' |
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
362 |
! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
363 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
364 |
version_CVS |
17862 | 365 |
^ '§Header: /cvs/stx/stx/libbasic/Notification.st,v 1.27 2011/09/11 14:41:10 cg Exp §' |
17865 | 366 |
! |
367 |
||
368 |
version_SVN |
|
17869 | 369 |
^ '$Id: Notification.st 10700 2011-09-29 15:44:37Z vranyj1 $' |
4443 | 370 |
! ! |
8516 | 371 |
|
17846 | 372 |
Notification initialize! |