author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 01 Jul 2010 19:21:34 +0100 | |
branch | jv |
changeset 17772 | 6e0b3c06c364 |
parent 17767 | a4a32df3aa5e |
child 17780 | b6e42c92eba0 |
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 |
" |
|
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
40 |
Warning is the superclass of all warning signals in the system. |
7038 | 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 |
||
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
120 |
!Warning class methodsFor:'misc ui support'! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
121 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
122 |
iconInBrowserSymbol |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
123 |
<resource: #programImage> |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
124 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
125 |
^ #warningClassBrowserIcon |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
126 |
! ! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
127 |
|
4446 | 128 |
!Warning methodsFor:'default actions'! |
129 |
||
4525 | 130 |
defaultAction |
5295 | 131 |
"Default action for warnings: open a warn box with description" |
4446 | 132 |
|
4500
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
133 |
|text| |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
134 |
|
5295 | 135 |
text := self description. |
4446 | 136 |
|
10517
160835ef7978
changed #defaultAction - use #hasDialog
Stefan Vogel <sv@exept.de>
parents:
8681
diff
changeset
|
137 |
self hasDialog ifTrue:[ |
4500
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
138 |
Dialog warn:text. |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
139 |
] ifFalse:[ |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
140 |
" |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
141 |
on systems without GUI, simply show |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
142 |
the message on the Transcript. |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
143 |
" |
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
144 |
Transcript show:'warning: '; showCR:text. |
4500
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
145 |
]. |
be0fe7e7e21b
Write to transcript if Dialog is not available.
Stefan Vogel <sv@exept.de>
parents:
4466
diff
changeset
|
146 |
self proceed. |
4446 | 147 |
|
148 |
" |
|
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
149 |
Warning raiseRequestErrorString:' abc' |
4446 | 150 |
" |
151 |
||
4508 | 152 |
"Modified: / 3.8.1999 / 14:06:41 / stefan" |
4446 | 153 |
! ! |
154 |
||
155 |
!Warning class methodsFor:'documentation'! |
|
156 |
||
157 |
version |
|
17772
6e0b3c06c364
Method reverted to r10532
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17767
diff
changeset
|
158 |
^ '$Id: Warning.st 10534 2010-07-01 18:21:34Z vranyj1 $' |
17732
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
159 |
! |
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
160 |
|
a1892eeca6c0
trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17711
diff
changeset
|
161 |
version_CVS |
17772
6e0b3c06c364
Method reverted to r10532
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17767
diff
changeset
|
162 |
^ 'Header: /cvs/stx/stx/libbasic/Warning.st,v 1.14 2009/10/14 17:34:52 cg Exp ยง' |
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
163 |
! |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
164 |
|
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
165 |
version_SVN |
17772
6e0b3c06c364
Method reverted to r10532
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17767
diff
changeset
|
166 |
^ '$Id: Warning.st 10534 2010-07-01 18:21:34Z vranyj1 $' |
4446 | 167 |
! ! |
7032
3c0246b4e602
Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents:
6427
diff
changeset
|
168 |
|
4446 | 169 |
Warning initialize! |
17767 | 170 |
|
17772
6e0b3c06c364
Method reverted to r10532
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17767
diff
changeset
|
171 |