Notification.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 20:55:17 +0200
changeset 24417 03b083548da2
parent 24021 d0173ca4be64
child 24732 26eebb19b868
permissions -rw-r--r--
#REFACTORING by exept class: Smalltalk class changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels: Transcript showCR:(... bindWith:...) -> Transcript showCR:... with:...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22888
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
     1
"{ Encoding: utf8 }"
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
     2
4466
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     3
"
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     4
 COPYRIGHT (c) 1999 by eXept Software AG
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     5
              All Rights Reserved
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     6
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     7
 This software is furnished under a license and may be used
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     8
 only in accordance with the terms of that license and with the
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    10
 be provided or otherwise made available to, or used by, any
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    11
 other person.  No title to or ownership of the software is
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    12
 hereby transferred.
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    13
"
6206
59d1ec1e1ed5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5227
diff changeset
    14
"{ Package: 'stx:libbasic' }"
59d1ec1e1ed5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5227
diff changeset
    15
17598
7618f46602ea class: Notification
sr
parents: 16283
diff changeset
    16
"{ NameSpace: Smalltalk }"
7618f46602ea class: Notification
sr
parents: 16283
diff changeset
    17
8817
387971ee2b30 Notification is not an exception.
Claus Gittinger <cg@exept.de>
parents: 8778
diff changeset
    18
GenericException subclass:#Notification
13674
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
    19
	instanceVariableNames:'tag'
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    22
	category:'Kernel-Exceptions'
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    23
!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    24
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    25
!Notification class methodsFor:'documentation'!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    26
4466
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    27
copyright
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    28
"
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    29
 COPYRIGHT (c) 1999 by eXept Software AG
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    30
              All Rights Reserved
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    31
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    32
 This software is furnished under a license and may be used
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    33
 only in accordance with the terms of that license and with the
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    35
 be provided or otherwise made available to, or used by, any
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    36
 other person.  No title to or ownership of the software is
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    37
 hereby transferred.
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    38
"
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    39
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    40
!
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    41
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    42
documentation
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    43
"    
12277
29a16650c9f4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12084
diff changeset
    44
    Notification is the superclass of all notification signals in the system.
11200
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    45
    contrast to regular exceptions, Notifications are ignored, if no handler is present
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    46
    and a default value is returned from the raise.
15680
9b6fca4e1eb9 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15668
diff changeset
    47
    When a handler finishes, the do-block is proceeded with the exception handler's value
8701
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
    48
    (an Exception does a return in this case.).
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    49
11200
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    50
    Thanks to proceedable exceptions, Notifications allow for non-GUI model code to provide
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    51
    user notifications which are optionally shown.
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    52
    Very useful, for example to provide progress information from a method which can be
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    53
    invoked both from a GUI-Tool (where notifications are wanted) and also from the system,
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    54
    where such notifications are not desired.
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    55
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    56
    [author:]
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    57
        Stefan Vogel
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    58
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    59
    [see also:]
15668
d91b53dd8c85 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15285
diff changeset
    60
        Signal QuerySignal Query
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    61
"
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    62
!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    63
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    64
examples 
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    65
"
6431
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
    66
  an up-notification from a deeply nested operation to a higher level:
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    67
                                                                        [exBegin]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    68
    |zero|
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    69
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    70
    zero := 0.
6431
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
    71
    Notification handle:[:n |
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
    72
        Transcript showCR:'Please note that: ' , n description.
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
    73
        n proceedWith:true
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    74
    ] do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    75
        'nesting'.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    76
        [
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    77
            [
8516
14ec9e1d3b39 example
Stefan Vogel <sv@exept.de>
parents: 6451
diff changeset
    78
                Error handle:[:ex |
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    79
                    Transcript showCR:'some error: ' , ex errorString.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    80
                    ex proceed
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    81
                ] do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    82
                    [
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    83
                        1 // zero.  'an error which is caught in the handler'.
6431
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
    84
                        Notification notify:'hello world'
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    85
                    ] value
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    86
                ]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    87
            ] value
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    88
        ] value
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    89
    ]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    90
                                                                        [exEnd]
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    91
"
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    92
! !
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    93
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    94
!Notification class methodsFor:'initialization'!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    95
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    96
initialize
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    97
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    98
    NotifierString := 'Notification:'
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    99
! !
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   100
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   101
!Notification class methodsFor:'answering queries'!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   102
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   103
answer:someAnswer do:aBlock
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   104
    "evaluate the argument, aBlock.
12060
49c65efc6abb changed: #answer:do:
Claus Gittinger <cg@exept.de>
parents: 12042
diff changeset
   105
     If the receiver is queried during evaluation, answer and proceed with someAnswer.
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   106
     This is a wrapper for #handle:do: for lazy typists; no new functionality."
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   107
8698
948da171e6e5 Make #handle - contexts also #return-able
Stefan Vogel <sv@exept.de>
parents: 8692
diff changeset
   108
    <context: #return>
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   109
    <exception: #handle>
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   110
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   111
    "/ thisContext markForHandle. -- same as above pragma
5227
73a2dc34cb42 #answer:do: now returns the evaluated blocks value
Claus Gittinger <cg@exept.de>
parents: 4605
diff changeset
   112
    ^ aBlock value.  "the real logic is in Exception>>doRaise"
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   113
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   114
    "
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   115
     Notification answer:true do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   116
        Transcript showCR:'query answers: ' , (Query query printString).
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   117
     ]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   118
    "
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   119
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   120
    "
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   121
     Notification answer:false do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   122
        Transcript showCR:'first query answers: ' , (Query query printString).
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   123
        Query answer:true do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   124
            Transcript showCR:'second query answers: ' , (Query query printString).
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   125
        ]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   126
     ]
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   127
    "
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   128
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   129
    "Created: / 10.7.1996 / 15:08:20 / cg"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   130
    "Modified: / 14.10.1996 / 16:59:18 / cg"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   131
    "Modified: / 25.7.1999 / 23:12:19 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   132
! !
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   133
12084
8cdb5d246455 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12060
diff changeset
   134
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   135
!Notification class methodsFor:'queries'!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   136
23304
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   137
accepts:aSignalOrExceptionClass
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   138
    "return true, if the receiver accepts the argument, aSignal.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   139
     (i.e. the receiver is aSignal or a parent of it). False otherwise."
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   140
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   141
    |s|
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   142
23304
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   143
    self == aSignalOrExceptionClass ifTrue:[^ true].
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   144
    aSignalOrExceptionClass isQuerySignal ifFalse:[^ false].
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   145
23304
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   146
    s := aSignalOrExceptionClass.
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   147
    [(s := s parent) notNil] whileTrue:[
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   148
        self == s ifTrue:[^ true].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   149
    ].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   150
    ^ false
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   151
23304
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   152
    "Modified: / 22-03-1999 / 12:45:32 / stefan"
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   153
    "Created: / 23-07-1999 / 15:18:00 / stefan"
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   154
    "Modified (format): / 28-08-2018 / 11:15:50 / Claus Gittinger"
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   155
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   156
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   157
defaultAnswer
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   158
    "Return the default answer to the Query. This method is called,
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   159
     if nobody catches the signal.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   160
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   161
     Subclasses may redefine this method."
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   162
19778
de6ffd31401f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19777
diff changeset
   163
    "Calling raiseRequest here will execute the exception's action method
de6ffd31401f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19777
diff changeset
   164
     which returns the defaultResumeValue."    
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   165
19778
de6ffd31401f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19777
diff changeset
   166
    ^ super raiseRequest
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   167
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   168
    "Created: / 23.7.1999 / 15:16:03 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   169
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   170
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   171
handlerForSignal:signal context:theContext originator:originator
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   172
    "answer the handler block for the signal from originator.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   173
     The block is retrieved from aContext.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   174
     Answer nil if the signal is not handled"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   175
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   176
    |arg|
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   177
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   178
    theContext selector == #'answer:do:' ifTrue:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   179
        (self == signal or:[self accepts:signal]) ifTrue:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   180
            arg := theContext argAt:1.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   181
            ^ [:ex| ex proceedWith:arg].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   182
        ]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   183
    ] ifFalse:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   184
        ^ super handlerForSignal:signal context:theContext originator:originator.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   185
    ].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   186
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   187
    ^ nil
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   188
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   189
    "Created: / 25.7.1999 / 23:11:55 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   190
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   191
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   192
handles:anException
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   193
    "return true, if the receiver handles the argument, anException.
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   194
     (i.e. the receiver is anExceptions signal or a parent of it)"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   195
23304
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   196
    ^ self accepts:(anException creator).
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   197
23304
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   198
"/    |signal|
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   199
"/
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   200
"/    signal := anException creator.
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   201
"/
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   202
"/    self == signal ifTrue:[^ true].               "quick check"
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   203
"/    anException isNotification ifFalse:[^ false]. "speed up non-queries by not traversing the parent chain"
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   204
"/
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   205
"/    [(signal := signal parent) notNil] whileTrue:[
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   206
"/        self == signal ifTrue:[^ true].
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   207
"/    ].
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   208
"/    ^ false
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   209
23304
eb5349cc3973 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22888
diff changeset
   210
    "Modified: / 28-08-2018 / 11:26:39 / Claus Gittinger"
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   211
!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   212
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   213
isQuerySignal
4605
7d5e97290c97 comment only
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   214
    "return true, if this is a querySignal - always return true here"
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   215
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   216
    ^ true
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   217
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   218
    "Created: / 23.7.1999 / 14:59:50 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   219
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   220
6431
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   221
notify:aMessageString
15680
9b6fca4e1eb9 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15668
diff changeset
   222
    "raise the query - return the handler's value, or the default
6431
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   223
     value, if there is no handler."
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   224
16283
f5d92aa70835 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15849
diff changeset
   225
    "/ cg: must be redefined, so we get a reasonable originator
22092
0ddced7926e5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 19796
diff changeset
   226
    "/ some apps depend on an originator being the non-exception context here.
16283
f5d92aa70835 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15849
diff changeset
   227
    "/ (do not do a self raiseRequestErrorString: here)
f5d92aa70835 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15849
diff changeset
   228
    ^ self basicNew
f5d92aa70835 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15849
diff changeset
   229
        raiseRequestErrorString:aMessageString in:thisContext sender
22092
0ddced7926e5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 19796
diff changeset
   230
0ddced7926e5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 19796
diff changeset
   231
    "Modified (comment): / 25-07-2017 / 09:53:25 / stefan"
6431
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   232
!
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   233
19796
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   234
notify:aMessageString with:aParameter
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   235
    "raise the query - return the handler's value, or the default
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   236
     value, if there is no handler."
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   237
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   238
    "/ cg: must be redefined, so we get a reasonable originator
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   239
    "/ some apps depend on an originator being the non-exception context here.
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   240
    "/ (do not do a self raiseRequestErrorString: here)
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   241
    ^ self basicNew
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   242
        parameter:aParameter;
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   243
        raiseRequestErrorString:aMessageString in:thisContext sender
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   244
!
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   245
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   246
query
15680
9b6fca4e1eb9 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15668
diff changeset
   247
    "raise the query - return the handler's value, or the default
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   248
     value, if there is no handler.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   249
     Invoking the handler is exactly the functionality of Signal>>raiseRequest,
8778
a71a9d3c1344 comment
Claus Gittinger <cg@exept.de>
parents: 8701
diff changeset
   250
     but we can do it faster here (avoiding the construction of an exception instance)."
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   251
19777
6e16198576c7 #REFACTORING by sr
sr
parents: 19200
diff changeset
   252
    ^ self raiseAsQuery
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   253
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   254
22888
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
   255
queryWith:aParameter
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
   256
    "raise the query - return the handler's value, or the default
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
   257
     value, if there is no handler.
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
   258
     Invoking the handler is exactly the functionality of Signal>>raiseRequest,
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
   259
     but we can do it faster here (avoiding the construction of an exception instance)."
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
   260
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
   261
    ^ self raiseRequestWith:aParameter
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
   262
!
fd3825a9dc9e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22092
diff changeset
   263
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   264
raise
15849
e752f846dea6 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15680
diff changeset
   265
    "Notifications are proceedable by definition,
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   266
     so they should be raised with #query or #raiseRequest"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   267
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   268
    ^ self shouldNotImplement
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   269
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   270
    "Created: / 23.7.1999 / 15:19:17 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   271
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   272
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   273
raiseRequest
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   274
    "redefined to use #query"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   275
19777
6e16198576c7 #REFACTORING by sr
sr
parents: 19200
diff changeset
   276
    ^ self raiseAsQuery
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   277
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   278
    "Created: / 25.7.1999 / 23:25:59 / stefan"
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   279
! !
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   280
15849
e752f846dea6 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15680
diff changeset
   281
!Notification class methodsFor:'utilities'!
e752f846dea6 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15680
diff changeset
   282
e752f846dea6 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15680
diff changeset
   283
deprecated
e752f846dea6 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15680
diff changeset
   284
    "invoked by some open source packages (SOAP and YAXO, for example)"
e752f846dea6 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15680
diff changeset
   285
e752f846dea6 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15680
diff changeset
   286
    self notify:'called deprecated interface'
e752f846dea6 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15680
diff changeset
   287
! !
e752f846dea6 class: Notification
Claus Gittinger <cg@exept.de>
parents: 15680
diff changeset
   288
13674
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   289
!Notification methodsFor:'accessing'!
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   290
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   291
tag
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   292
    "for squeak compatibility"
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   293
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   294
    ^ tag
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   295
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   296
    "Modified (comment): / 11-09-2011 / 16:40:54 / cg"
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   297
!
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   298
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   299
tag:aSzmbol
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   300
    "for squeak compatibility"
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   301
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   302
    tag := aSzmbol.
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   303
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   304
    "Modified (format): / 11-09-2011 / 16:41:01 / cg"
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   305
! !
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   306
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   307
!Notification methodsFor:'default actions'!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   308
4525
999e680a29ca Make error classes public.
Stefan Vogel <sv@exept.de>
parents: 4508
diff changeset
   309
defaultAction
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   310
    "the default action is to return the default value.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   311
     Subclasses may redefine this"
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   312
8683
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   313
    |handlerBlock|
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   314
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   315
    "try per signal handler.
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   316
     I may have been created from a QuerySignal"
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   317
15285
7c7d4ed8296d class: Notification
Stefan Vogel <sv@exept.de>
parents: 15114
diff changeset
   318
    (handlerBlock := self creator handlerBlock) notNil ifTrue:[
8683
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   319
        "... and call it"
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   320
        ^ handlerBlock value:self.
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   321
    ].
6451
f22b12c0349a renamed #defaultValue -> #defaultResumeValue (vw54 compat.)
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
   322
    ^ self defaultResumeValue
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   323
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   324
    "Modified: / 23.7.1999 / 15:13:34 / stefan"
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   325
! !
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   326
14948
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   327
!Notification methodsFor:'helpers'!
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   328
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   329
hasDialog
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   330
    "answer true, if we can use a Dialog window"
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   331
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   332
    (Smalltalk isInitialized 
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   333
     and:[Dialog notNil
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   334
     and:[Screen notNil
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   335
     and:[Screen current notNil
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   336
     and:[Screen current isOpenAndDispatching
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   337
    ]]]]) ifTrue:[
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   338
        Dialog autoload.        "in case its autoloaded"
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   339
        ^ true.
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   340
    ].
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   341
    ^ false
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   342
! !
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   343
12042
324365132b54 added: #query
fm
parents: 11200
diff changeset
   344
!Notification methodsFor:'queries'!
324365132b54 added: #query
fm
parents: 11200
diff changeset
   345
19796
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   346
notify
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   347
    "notice the implementation on the class-side: if no additional parameters are to be passed,
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   348
     we do not even arrive here, because query has inlined the raiseRequest code"
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   349
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   350
    ^ self raiseRequestIn:thisContext sender
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   351
!
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   352
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   353
notify:aMessageString
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   354
    "notice the implementation on the class-side: if no additional parameters are to be passed,
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   355
     we do not even arrive here, because query has inlined the raiseRequest code"
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   356
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   357
    ^ self raiseRequestErrorString:aMessageString in:thisContext sender
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   358
!
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   359
12042
324365132b54 added: #query
fm
parents: 11200
diff changeset
   360
query
324365132b54 added: #query
fm
parents: 11200
diff changeset
   361
    "notice the implementation on the class-side: if no additional parameters are to be passed,
324365132b54 added: #query
fm
parents: 11200
diff changeset
   362
     we do not even arrive here, because query has inlined the raiseRequest code"
324365132b54 added: #query
fm
parents: 11200
diff changeset
   363
19796
f08240ae07ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19778
diff changeset
   364
    ^ self raiseRequestIn:thisContext sender
12042
324365132b54 added: #query
fm
parents: 11200
diff changeset
   365
! !
324365132b54 added: #query
fm
parents: 11200
diff changeset
   366
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   367
!Notification methodsFor:'testing'!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   368
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   369
isNotification
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   370
    ^ true
24021
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   371
!
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   372
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   373
suppressDialogIfUnhandled
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   374
    "controls if a dialog is to be shown 
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   375
     in the default action when unhandled, or not.
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   376
     Can be redefined by subclasses"
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   377
    
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   378
    ^ false
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   379
d0173ca4be64 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23304
diff changeset
   380
    "Created: / 29-03-2019 / 10:55:19 / Claus Gittinger"
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   381
! !
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   382
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   383
!Notification class methodsFor:'documentation'!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   384
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   385
version
18675
2a0bff29806f class: Notification
Claus Gittinger <cg@exept.de>
parents: 17598
diff changeset
   386
    ^ '$Header$'
12042
324365132b54 added: #query
fm
parents: 11200
diff changeset
   387
!
324365132b54 added: #query
fm
parents: 11200
diff changeset
   388
324365132b54 added: #query
fm
parents: 11200
diff changeset
   389
version_CVS
18675
2a0bff29806f class: Notification
Claus Gittinger <cg@exept.de>
parents: 17598
diff changeset
   390
    ^ '$Header$'
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   391
! !
8516
14ec9e1d3b39 example
Stefan Vogel <sv@exept.de>
parents: 6451
diff changeset
   392
14948
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   393
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   394
Notification initialize!