|
Class: Notification
Object
|
+--GenericException
|
+--Notification
|
+--Amb::FoundSolution
|
+--CascadingNotification
|
+--ClassDescription::PackageRedefinition
|
+--Dolphin::Notification
|
+--EndOfStreamNotification
|
+--HTTPInterface::RequestInformationSignal
|
+--HTTPInterface::TransferProgressNotificationSignal
|
+--HTTPInterface::TransferTimeoutNotificationSignal
|
+--HTTPRequest::ReprocessRequest
|
+--HTTPServer::TerminationRequest
|
+--IncrementNotification
|
+--NaiveRomanNumberFormatNotification
|
+--OSXOperatingSystem::SigUSR1Notification
|
+--ObjectFileLoader::ObjectFileLoadErrorNotification
|
+--ParseWarning
|
+--Parser::RestartCompilationSignal
|
+--ProceedingNotification
|
+--Query
|
+--RecursiveRestoreError
|
+--RecursiveStoreError
|
+--ResourcePack::DuplicateTranslation
|
+--ResourcePack::TranslationConflict
|
+--SocketErrorNotification
|
+--SystemNotification
|
+--TimeoutNotification
|
+--Tools::BreakpointService::FailedToSetBreakpointNotification
|
+--UndefinedVariableNotification
|
+--UnhandledAttributeInLiteralArrayErrorSignal
|
+--UserConfirmation
|
+--UserNotification
|
+--YesToAllConfirmation
- Package:
- stx:libbasic
- Category:
- Kernel-Exceptions
- Version:
- rev:
1.53
date: 2023/03/02 19:46:43
- user: stefan
- file: Notification.st directory: libbasic
- module: stx stc-classLibrary: libbasic
Notification is the superclass of all notification signals in the system.
In contrast to regular exceptions, Notifications are ignored if no handler is present
and a default value is returned from the raiseRequest.
When a handler is present and finishes, the exception handling block
is proceeded with the exception handler's value (an Exception does a #proceedWith: in this case.).
Thanks to proceedable exceptions, Notifications allow for non-GUI model code to provide
user notifications which are optionally shown.
This is implemented in the UserNotification class hierarchy.
copyrightCOPYRIGHT (c) 1999 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
accessing
-
defaultNotifierString
-
answering queries
-
answer: someAnswer do: aBlock
-
evaluate the argument, aBlock.
If the receiver is queried during evaluation, answer and proceed with someAnswer.
This is a wrapper for #handle:do: for lazy typists; no new functionality.
Usage example(s):
Notification answer:true do:[
Transcript showCR:'query answers: ' , (Query query printString).
]
|
Usage example(s):
Notification answer:false do:[
Transcript showCR:'first query answers: ' , (Query query printString).
Query answer:true do:[
Transcript showCR:'second query answers: ' , (Query query printString).
]
]
|
misc ui support
-
iconInBrowserSymbol
( an extension from the stx:libtool package )
-
the browser will use this as index into the toolbariconlibrary
queries
-
accepts: aSignalOrExceptionClass
-
return true, if the receiver accepts the argument, aSignal.
(i.e. the receiver is aSignal or a parent of it). False otherwise.
-
defaultAnswer
-
Return the default answer to the Query. This method is called,
if nobody catches the signal.
Subclasses may redefine this method.
-
handlerForSignal: exceptionCreator context: theContext originator: originator
-
answer the handler block for the signal from originator.
The block is retrieved from aContext.
Answer nil if the signal is not handled
-
handles: anException
-
return true, if the receiver handles the argument, anException.
(i.e. the receiver is anExceptions signal or a parent of it)
-
isQuerySignal
-
return true, if this is a querySignal - always return true here
-
notify: aMessageString
-
raise the query - return the handler's value, or the default
value, if there is no handler.
-
notify: aMessageString with: aParameter
-
raise the query - return the handler's value, or the default
value, if there is no handler.
-
query
-
raise the query - return the handler's value, or the default
value, if there is no handler.
Invoking the handler is exactly the functionality of Signal>>raiseRequest,
but we can do it faster here (avoiding the construction of an exception instance).
-
queryWith: aParameter
-
raise the query passing a parameter
- return the handler's value, or the default value, if there is no handler.
-
raise
-
Notifications are proceedable by definition,
so they should be raised with #query or #raiseRequest
-
raiseRequest
-
redefined to use #query
utilities
-
deprecated
-
invoked by some open source packages (SOAP and YAXO, for example)
accessing
-
tag
-
for squeak compatibility
-
tag: aSymbol
-
for squeak compatibility
default actions
-
defaultAction
-
the default action is to return the default value.
Subclasses may redefine this
queries
-
notify
-
notice the implementation on the class-side: if no additional parameters are to be passed,
we do not even arrive here, because query has inlined the raiseRequest code
-
notify: aMessageString
-
notice the implementation on the class-side: if no additional parameters are to be passed,
we do not even arrive here, because query has inlined the raiseRequest code
-
notify: aMessageString with: aParameter
-
-
query
-
notice the implementation on the class-side: if no additional parameters are to be passed,
we do not even arrive here, because query has inlined the raiseRequest code
testing
-
isNotification
-
an up-notification from a deeply nested operation to a higher level:
|zero|
zero := 0.
Notification handle:[:n |
Transcript showCR:'Please note that: ' , n description.
n proceedWith:true
] do:[
'nesting'.
[
[
Error handle:[:ex |
Transcript showCR:'some error: ' , ex errorString.
ex proceed
] do:[
[
1 // zero. 'an error which is caught in the handler'.
Notification notify:'hello world'
] value
]
] value
] value
]
|
|