Object.st
changeset 579 2d26193415b5
parent 530 07d0bce293c9
child 589 963cf8bab358
--- a/Object.st	Mon Nov 20 13:42:18 1995 +0100
+++ b/Object.st	Mon Nov 20 14:15:04 1995 +0100
@@ -17,7 +17,7 @@
 			   RecursionInterruptSignal ExceptionInterruptSignal
 			   SubscriptOutOfBoundsSignal NonIntegerIndexSignal
 			   NotFoundSignal KeyNotFoundSignal ElementOutOfBoundsSignal
-			   InformationSignal PrimitiveFailureSignal
+			   InformationSignal WarningSignal PrimitiveFailureSignal
 			   DeepCopyErrorSignal
 			   AbortSignal
 			   ErrorRecursion Dependencies
@@ -43,7 +43,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.69 1995-11-11 15:25:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.70 1995-11-20 13:15:04 cg Exp $'
 !
 
 documentation
@@ -151,6 +151,10 @@
 	InformationSignal nameClass:self message:#informationSignal.
 	InformationSignal notifierString:'information'.
 
+	WarningSignal := ErrorSignal newSignalMayProceed:true.
+	WarningSignal nameClass:self message:#warnungSignal.
+	WarningSignal notifierString:'warning'.
+
 	DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true.
 	DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal.
 	DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'.
@@ -262,6 +266,12 @@
     ^ InformationSignal
 !
 
+warningSignal 
+    "return the signal used for warnings"
+
+    ^ WarningSignal
+!
+
 deepCopyErrorSignal 
     "return the signal raised when a deepcopy is asked for
      an object which cannot do this (for example, BlockClosures
@@ -2025,7 +2035,13 @@
 !
 
 information:aString
-    "launch an InfoBox, telling user something"
+    "launch an InfoBox, telling user something. 
+     These info-boxes can be suppressed by
+     handling the InformationSignal and proceeding in the handler."
+
+    InformationSignal isHandled ifTrue:[
+	^ InformationSignal raiseRequestWith:aString
+    ].
 
     Dialog isNil ifTrue:[
 	"
@@ -2041,11 +2057,27 @@
     "
      nil information:'hello there'
      self information:'hello there'
+
+     InformationSignal handle:[:ex |
+	ex proceed.
+     ] do:[
+	'hello' printNL.
+	self information:'some info'.
+	'world' printNL.
+     ]
     "
+
+    "Created: 20.11.1995 / 11:24:24 / cg"
 !
 
 warn:aString
-    "launch a WarningBox, telling user something"
+    "launch a WarningBox, telling user something.
+     These warn-boxes can be suppressed by
+     handling the WarningSignal and proceeding in the handler."
+
+    WarningSignal isHandled ifTrue:[
+	^ WarningSignal raiseRequestWith:aString
+    ].
 
     Dialog isNil ifTrue:[
 	"
@@ -2061,6 +2093,14 @@
     "
      nil warn:'hello there'
      self warn:'hello there'
+
+     WarningSignal handle:[:ex |
+	ex proceed.
+     ] do:[
+	'hello' printNL.
+	self warn:'some info'.
+	'world' printNL.
+     ]
     "
 !