author | Stefan Vogel <sv@exept.de> |
Mon, 16 Apr 2007 15:42:20 +0200 | |
changeset 10517 | 160835ef7978 |
parent 8681 | 38aa963476a5 |
child 12083 | 079b2535924f |
child 17711 | 39faaaf888b4 |
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 |
||
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
14 |
UserNotification subclass:#Warning |
4446 | 15 |
instanceVariableNames:'' |
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Kernel-Exceptions' |
|
19 |
! |
|
20 |
||
21 |
!Warning class methodsFor:'documentation'! |
|
22 |
||
4466
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
23 |
copyright |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
24 |
" |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
25 |
COPYRIGHT (c) 1999 by eXept Software AG |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
26 |
All Rights Reserved |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
27 |
|
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
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:
4446
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:
4446
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:
4446
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:
4446
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:
4446
diff
changeset
|
33 |
hereby transferred. |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
34 |
" |
9cba6f4ecec4
copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents:
4446
diff
changeset
|
35 |
|
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 |
|
4446 | 38 |
documentation |
39 |
" |
|
7038 | 40 |
Warning is the superclass of all warning exceptions in the system. |
41 |
The default beavior for an unhandled Warning is to display a warn |
|
42 |
box with the error decription. If no display is available, the error |
|
43 |
description is written to the Transcript. |
|
4446 | 44 |
|
45 |
[author:] |
|
46 |
Stefan Vogel |
|
47 |
||
48 |
[see also:] |
|
49 |
Signal |
|
50 |
" |
|
51 |
! |
|
52 |
||
53 |
examples |
|
54 |
" |
|
6427 | 55 |
show a warning: |
4446 | 56 |
[exBegin] |
6427 | 57 |
Transcript showCR:'1 - now raising'. |
58 |
Warning raiseRequest. |
|
59 |
Transcript showCR:'2 - after the raise'. |
|
60 |
[exEnd] |
|
61 |
||
62 |
passing an errorString: |
|
63 |
[exBegin] |
|
64 |
Warning raiseRequestErrorString:'hello world' |
|
65 |
[exEnd] |
|
66 |
||
67 |
provide a handler for warnings: |
|
68 |
[exBegin] |
|
69 |
Warning handle:[:ex | |
|
70 |
Transcript showCR:'WARNING: ' , ex description |
|
71 |
] do:[ |
|
72 |
'...'. |
|
73 |
Warning raiseRequest. |
|
74 |
'...'. |
|
75 |
]. |
|
76 |
||
77 |
Warning handle:[:ex | |
|
78 |
Transcript showCR:'WARNING: ' , ex description |
|
79 |
] do:[ |
|
80 |
'...'. |
|
81 |
Warning raiseRequestErrorString:'hello world'. |
|
82 |
'...'. |
|
83 |
] |
|
84 |
[exEnd] |
|
85 |
||
86 |
ignore warnings during some evaluation: |
|
87 |
[exBegin] |
|
88 |
Warning ignoreIn:[ |
|
89 |
'...'. |
|
90 |
Warning raiseRequest. |
|
91 |
'...'. |
|
92 |
] |
|
93 |
[exEnd] |
|
94 |
||
95 |
defer a warning to some later time: |
|
96 |
[exBegin] |
|
97 |
Warning deferAfter:[ |
|
98 |
Transcript showCR:'1 - no warning here ...'. |
|
99 |
Warning raiseRequestErrorString:'this warning is deferred'. |
|
100 |
Transcript showCR:'2 - but in a second...'. |
|
101 |
]. |
|
102 |
Transcript showCR:'3 - after warning-protected block'. |
|
4446 | 103 |
[exEnd] |
104 |
" |
|
105 |
! ! |
|
106 |
||
107 |
!Warning class methodsFor:'initialization'! |
|
108 |
||
109 |
initialize |
|
110 |
||
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
111 |
NotifierString := 'Warning:'. |
4446 | 112 |
|
113 |
" |
|
114 |
self initialize |
|
115 |
" |
|
116 |
||
117 |
"Created: / 23.7.1999 / 15:34:27 / stefan" |
|
118 |
! ! |
|
119 |
||
120 |
!Warning methodsFor:'default actions'! |
|
121 |
||
4525 | 122 |
defaultAction |
5295 | 123 |
"Default action for warnings: open a warn box with description" |
4446 | 124 |
|
4500
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
125 |
|text| |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
126 |
|
5295 | 127 |
text := self description. |
4446 | 128 |
|
10517
160835ef7978
changed #defaultAction - use #hasDialog
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
129 |
self hasDialog ifTrue:[ |
4500
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
130 |
Dialog warn:text. |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
131 |
] ifFalse:[ |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
132 |
" |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
133 |
on systems without GUI, simply show |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
134 |
the message on the Transcript. |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
135 |
" |
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
136 |
Transcript show:'warning: '; showCR:text. |
4500
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
137 |
]. |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
138 |
self proceed. |
4446 | 139 |
|
140 |
" |
|
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
141 |
Warning raiseRequestErrorString:' abc' |
4446 | 142 |
" |
143 |
||
4508 | 144 |
"Modified: / 3.8.1999 / 14:06:41 / stefan" |
4446 | 145 |
! ! |
146 |
||
147 |
!Warning class methodsFor:'documentation'! |
|
148 |
||
149 |
version |
|
10517
160835ef7978
changed #defaultAction - use #hasDialog
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
150 |
^ '$Header: /cvs/stx/stx/libbasic/Warning.st,v 1.12 2007-04-16 13:42:20 stefan Exp $' |
4446 | 151 |
! ! |
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
152 |
|
4446 | 153 |
Warning initialize! |