author | Claus Gittinger <cg@exept.de> |
Thu, 07 Jun 2018 16:23:29 +0200 | |
changeset 23054 | 2f647561edc5 |
parent 19201 | b301ed05553d |
child 19227 | 5e949760a4e8 |
child 23777 | c1a7bebf28ab |
permissions | -rw-r--r-- |
4466
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
1 |
" |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
2 |
COPYRIGHT (c) 1999 by eXept Software AG |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
3 |
All Rights Reserved |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
4 |
|
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
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:
4446
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:
4446
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:
4446
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:
4446
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:
4446
diff
changeset
|
10 |
hereby transferred. |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
11 |
" |
6206 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
17307 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
16 |
UserNotification subclass:#Warning |
4446 | 17 |
instanceVariableNames:'' |
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Kernel-Exceptions' |
|
21 |
! |
|
22 |
||
23 |
!Warning class methodsFor:'documentation'! |
|
24 |
||
4466
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
25 |
copyright |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
26 |
" |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
27 |
COPYRIGHT (c) 1999 by eXept Software AG |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
28 |
All Rights Reserved |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
29 |
|
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
30 |
This software is furnished under a license and may be used |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
31 |
only in accordance with the terms of that license and with the |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
32 |
inclusion of the above copyright notice. This software may not |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
33 |
be provided or otherwise made available to, or used by, any |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
34 |
other person. No title to or ownership of the software is |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
35 |
hereby transferred. |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
36 |
" |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
37 |
|
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
38 |
! |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
39 |
|
4446 | 40 |
documentation |
41 |
" |
|
12279 | 42 |
Warning is the superclass of all warning signals in the system. |
7038 | 43 |
The default beavior for an unhandled Warning is to display a warn |
44 |
box with the error decription. If no display is available, the error |
|
45 |
description is written to the Transcript. |
|
4446 | 46 |
|
47 |
[author:] |
|
48 |
Stefan Vogel |
|
49 |
||
50 |
[see also:] |
|
51 |
Signal |
|
52 |
" |
|
53 |
! |
|
54 |
||
55 |
examples |
|
56 |
" |
|
6427 | 57 |
show a warning: |
4446 | 58 |
[exBegin] |
6427 | 59 |
Transcript showCR:'1 - now raising'. |
60 |
Warning raiseRequest. |
|
61 |
Transcript showCR:'2 - after the raise'. |
|
62 |
[exEnd] |
|
63 |
||
64 |
passing an errorString: |
|
65 |
[exBegin] |
|
66 |
Warning raiseRequestErrorString:'hello world' |
|
67 |
[exEnd] |
|
68 |
||
69 |
provide a handler for warnings: |
|
70 |
[exBegin] |
|
71 |
Warning handle:[:ex | |
|
72 |
Transcript showCR:'WARNING: ' , ex description |
|
73 |
] do:[ |
|
74 |
'...'. |
|
75 |
Warning raiseRequest. |
|
76 |
'...'. |
|
77 |
]. |
|
78 |
||
79 |
Warning handle:[:ex | |
|
80 |
Transcript showCR:'WARNING: ' , ex description |
|
81 |
] do:[ |
|
82 |
'...'. |
|
83 |
Warning raiseRequestErrorString:'hello world'. |
|
84 |
'...'. |
|
85 |
] |
|
86 |
[exEnd] |
|
87 |
||
88 |
ignore warnings during some evaluation: |
|
89 |
[exBegin] |
|
90 |
Warning ignoreIn:[ |
|
91 |
'...'. |
|
92 |
Warning raiseRequest. |
|
93 |
'...'. |
|
94 |
] |
|
95 |
[exEnd] |
|
96 |
||
97 |
defer a warning to some later time: |
|
98 |
[exBegin] |
|
99 |
Warning deferAfter:[ |
|
100 |
Transcript showCR:'1 - no warning here ...'. |
|
101 |
Warning raiseRequestErrorString:'this warning is deferred'. |
|
102 |
Transcript showCR:'2 - but in a second...'. |
|
103 |
]. |
|
104 |
Transcript showCR:'3 - after warning-protected block'. |
|
4446 | 105 |
[exEnd] |
106 |
" |
|
107 |
! ! |
|
108 |
||
109 |
!Warning class methodsFor:'initialization'! |
|
110 |
||
111 |
initialize |
|
112 |
||
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
113 |
NotifierString := 'Warning:'. |
4446 | 114 |
|
115 |
" |
|
116 |
self initialize |
|
117 |
" |
|
118 |
||
119 |
"Created: / 23.7.1999 / 15:34:27 / stefan" |
|
120 |
! ! |
|
121 |
||
12083 | 122 |
|
4446 | 123 |
!Warning methodsFor:'default actions'! |
124 |
||
4525 | 125 |
defaultAction |
5295 | 126 |
"Default action for warnings: open a warn box with description" |
4446 | 127 |
|
16423 | 128 |
self showWarnDialog. |
129 |
self proceed. |
|
130 |
||
131 |
" |
|
132 |
Warning raiseRequestErrorString:' abc' |
|
133 |
" |
|
134 |
||
135 |
"Modified: / 3.8.1999 / 14:06:41 / stefan" |
|
136 |
! |
|
137 |
||
138 |
showWarnDialog |
|
139 |
"open a warn box with description" |
|
140 |
||
4500
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
141 |
|text| |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
142 |
|
5295 | 143 |
text := self description. |
4446 | 144 |
|
10517
160835ef7978
changed #defaultAction - use #hasDialog
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
145 |
self hasDialog ifTrue:[ |
4500
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
146 |
Dialog warn:text. |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
147 |
] ifFalse:[ |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
148 |
" |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
149 |
on systems without GUI, simply show |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
150 |
the message on the Transcript. |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
151 |
" |
17307 | 152 |
Transcript show:'Warning: '; showCR:text. |
4500
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
153 |
]. |
4446 | 154 |
|
155 |
" |
|
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
156 |
Warning raiseRequestErrorString:' abc' |
4446 | 157 |
" |
158 |
||
4508 | 159 |
"Modified: / 3.8.1999 / 14:06:41 / stefan" |
4446 | 160 |
! ! |
161 |
||
162 |
!Warning class methodsFor:'documentation'! |
|
163 |
||
164 |
version |
|
19201
b301ed05553d
comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents:
17307
diff
changeset
|
165 |
^ '$Header$' |
12083 | 166 |
! |
167 |
||
168 |
version_CVS |
|
19201
b301ed05553d
comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents:
17307
diff
changeset
|
169 |
^ '$Header$' |
4446 | 170 |
! ! |
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
171 |
|
16423 | 172 |
|
4446 | 173 |
Warning initialize! |