Notification.st
author Claus Gittinger <cg@exept.de>
Mon, 25 Mar 2013 14:57:51 +0100
changeset 14948 c792f4a1ceea
parent 13674 89734bcfdb32
child 15114 77142b5c937a
child 18040 a11a12546f23
permissions -rw-r--r--
class: Notification moved: #hasDialog
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4466
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     1
"
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     2
 COPYRIGHT (c) 1999 by eXept Software AG
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     3
              All Rights Reserved
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
     4
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
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: 4443
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: 4443
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: 4443
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: 4443
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: 4443
diff changeset
    10
 hereby transferred.
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    11
"
6206
59d1ec1e1ed5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5227
diff changeset
    12
"{ Package: 'stx:libbasic' }"
59d1ec1e1ed5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5227
diff changeset
    13
8817
387971ee2b30 Notification is not an exception.
Claus Gittinger <cg@exept.de>
parents: 8778
diff changeset
    14
GenericException subclass:#Notification
13674
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
    15
	instanceVariableNames:'tag'
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    18
	category:'Kernel-Exceptions'
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    19
!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    20
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
!Notification class methodsFor:'documentation'!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    22
4466
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    23
copyright
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    24
"
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    25
 COPYRIGHT (c) 1999 by eXept Software AG
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    26
              All Rights Reserved
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    27
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
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: 4443
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: 4443
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: 4443
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: 4443
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: 4443
diff changeset
    33
 hereby transferred.
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    34
"
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    35
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    36
!
9cba6f4ecec4 copyrights added; typo in docu
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
    37
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    38
documentation
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    39
"    
12277
29a16650c9f4 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12084
diff changeset
    40
    Notification is the superclass of all notification signals in the system.
11200
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    41
    contrast to regular exceptions, Notifications are ignored, if no handler is present
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    42
    and a default value is returned from the raise.
8701
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
    43
    When a handler finishes, the do-block is proceeded with the exception handlers value
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
    44
    (an Exception does a return in this case.).
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    45
11200
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    46
    Thanks to proceedable exceptions, Notifications allow for non-GUI model code to provide
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    47
    user notifications which are optionally shown.
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    48
    Very useful, for example to provide progress information from a method which can be
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    49
    invoked both from a GUI-Tool (where notifications are wanted) and also from the system,
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    50
    where such notifications are not desired.
Claus Gittinger <cg@exept.de>
parents: 8817
diff changeset
    51
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    52
    [author:]
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    53
        Stefan Vogel
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    54
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    55
    [see also:]
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    56
        Signal QuerySignal
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    57
"
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    58
!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    59
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    60
examples 
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    61
"
6431
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
    62
  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
    63
                                                                        [exBegin]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    64
    |zero|
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    65
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    66
    zero := 0.
6431
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
    67
    Notification handle:[:n |
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
    68
        Transcript showCR:'Please note that: ' , n description.
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
    69
        n proceedWith:true
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    70
    ] do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    71
        'nesting'.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    72
        [
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    73
            [
8516
14ec9e1d3b39 example
Stefan Vogel <sv@exept.de>
parents: 6451
diff changeset
    74
                Error handle:[:ex |
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    75
                    Transcript showCR:'some error: ' , ex errorString.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    76
                    ex proceed
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    77
                ] do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    78
                    [
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    79
                        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
    80
                        Notification notify:'hello world'
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    81
                    ] value
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
            ] value
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    84
        ] value
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    85
    ]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    86
                                                                        [exEnd]
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    87
"
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    88
! !
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    89
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    90
!Notification class methodsFor:'initialization'!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    91
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    92
initialize
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    93
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    94
    NotifierString := 'Notification:'
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    95
! !
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    96
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    97
!Notification class methodsFor:'answering queries'!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    98
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
    99
answer:someAnswer do:aBlock
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   100
    "evaluate the argument, aBlock.
12060
49c65efc6abb changed: #answer:do:
Claus Gittinger <cg@exept.de>
parents: 12042
diff changeset
   101
     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
   102
     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
   103
8698
948da171e6e5 Make #handle - contexts also #return-able
Stefan Vogel <sv@exept.de>
parents: 8692
diff changeset
   104
    <context: #return>
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   105
    <exception: #handle>
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   106
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   107
    "/ 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
   108
    ^ aBlock value.  "the real logic is in Exception>>doRaise"
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   109
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
     Notification answer:true do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   112
        Transcript showCR:'query answers: ' , (Query query printString).
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
    "
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   115
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   116
    "
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   117
     Notification answer:false do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   118
        Transcript showCR:'first query answers: ' , (Query query printString).
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   119
        Query answer:true do:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   120
            Transcript showCR:'second query answers: ' , (Query query printString).
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   121
        ]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   122
     ]
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   123
    "
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   124
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   125
    "Created: / 10.7.1996 / 15:08:20 / cg"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   126
    "Modified: / 14.10.1996 / 16:59:18 / cg"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   127
    "Modified: / 25.7.1999 / 23:12:19 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   128
! !
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   129
12084
8cdb5d246455 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12060
diff changeset
   130
!Notification class methodsFor:'misc ui support'!
8cdb5d246455 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12060
diff changeset
   131
8cdb5d246455 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12060
diff changeset
   132
iconInBrowserSymbol
8cdb5d246455 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12060
diff changeset
   133
    <resource: #programImage>
8cdb5d246455 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12060
diff changeset
   134
8cdb5d246455 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12060
diff changeset
   135
    ^ #notificationClassBrowserIcon
8cdb5d246455 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12060
diff changeset
   136
! !
8cdb5d246455 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12060
diff changeset
   137
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   138
!Notification class methodsFor:'queries'!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   139
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   140
accepts:aSignal
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   141
    "return true, if the receiver accepts the argument, aSignal.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   142
     (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
   143
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   144
    |s|
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   145
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   146
    self == aSignal ifTrue:[^ true].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   147
    aSignal isQuerySignal ifFalse:[^ false].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   148
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   149
    s := aSignal parent.
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   150
    [s notNil] whileTrue:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   151
        self == s ifTrue:[^ true].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   152
        s := s parent
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   153
    ].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   154
    ^ false
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
    "Modified: / 22.3.1999 / 12:45:32 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   157
    "Created: / 23.7.1999 / 15:18:00 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   158
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   159
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   160
defaultAnswer
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   161
    "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
   162
     if nobody catches the signal.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   163
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   164
     Subclasses may redefine this method."
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   165
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   166
    "Calling raiseRequest here will execute the exception's action method"    
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
    ^ super raiseRequest
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
    "Created: / 23.7.1999 / 15:16:03 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   171
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   172
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   173
handlerForSignal:signal context:theContext originator:originator
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   174
    "answer the handler block for the signal from originator.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   175
     The block is retrieved from aContext.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   176
     Answer nil if the signal is not handled"
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
    |arg|
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   179
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   180
    theContext selector == #'answer:do:' ifTrue:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   181
        (self == signal or:[self accepts:signal]) ifTrue:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   182
            arg := theContext argAt:1.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   183
            ^ [:ex| ex proceedWith:arg].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   184
        ]
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   185
    ] ifFalse:[
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   186
        ^ super handlerForSignal:signal context:theContext originator:originator.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   187
    ].
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
    ^ nil
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
    "Created: / 25.7.1999 / 23:11:55 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   192
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   193
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   194
handles:anException
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   195
    "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
   196
     (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
   197
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   198
    |signal|
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   199
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   200
    signal := anException signal.
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   201
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   202
    self == signal ifTrue:[^ true].               "quick check"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   203
    anException isNotification ifFalse:[^ false]. "speed up non-queries by not traversing the parent chain"
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   204
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   205
    [(signal := signal parent) notNil] whileTrue:[
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   206
        self == signal ifTrue:[^ true].
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   207
    ].
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   208
    ^ false
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   209
!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   210
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   211
isQuerySignal
4605
7d5e97290c97 comment only
Claus Gittinger <cg@exept.de>
parents: 4554
diff changeset
   212
    "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
   213
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   214
    ^ true
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
    "Created: / 23.7.1999 / 14:59:50 / stefan"
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
6431
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   219
notify:aMessageString
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   220
    "raise the query - return the handlers value, or the default
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   221
     value, if there is no handler."
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   222
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   223
    ^ self raiseRequestErrorString:aMessageString
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   224
!
584b4b6e231c common code with Query
Claus Gittinger <cg@exept.de>
parents: 6206
diff changeset
   225
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   226
query
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   227
    "raise the query - return the handlers value, or the default
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   228
     value, if there is no handler.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   229
     Invoking the handler is exactly the functionality of Signal>>raiseRequest,
8778
a71a9d3c1344 comment
Claus Gittinger <cg@exept.de>
parents: 8701
diff changeset
   230
     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
   231
8683
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   232
    |con signal|
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   233
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   234
    con := Context findFirstSpecialHandle:true raise:false.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   235
    [con notNil] whileTrue:[
8692
3abb4811f5b2 When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents: 8683
diff changeset
   236
        (con selector ~~ #answer:do:) ifTrue:[
13363
070b1c3087bc changed comment in:
Stefan Vogel <sv@exept.de>
parents: 12277
diff changeset
   237
            "there is another handler block, maybe it will return the answer.
070b1c3087bc changed comment in:
Stefan Vogel <sv@exept.de>
parents: 12277
diff changeset
   238
             Call it via raiseRequest"
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   239
            ^ super raiseRequest
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   240
        ].
8683
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   241
        signal := con receiver.
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   242
        signal == self ifTrue:[
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   243
            ^ con argAt:1
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   244
        ].
8692
3abb4811f5b2 When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents: 8683
diff changeset
   245
        signal isNil ifTrue:[
3abb4811f5b2 When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents: 8683
diff changeset
   246
            self error:'nil receiver in #answer:do: - send'.
3abb4811f5b2 When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents: 8683
diff changeset
   247
        ].
8683
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   248
        (signal accepts:self) ifTrue:[
8692
3abb4811f5b2 When sending #query do a shortcut for #answer:do: - contexts if the
Stefan Vogel <sv@exept.de>
parents: 8683
diff changeset
   249
            ^ con argAt:1
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   250
        ].
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   251
        con := con findSpecialHandle:true raise:false.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   252
    ].
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
    "/ no handler found - return the default value
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   255
    ^ self defaultAnswer
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   256
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   257
    "Modified: / 15.6.1998 / 21:27:37 / cg"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   258
    "Modified: / 25.7.1999 / 23:15:16 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   259
!
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   260
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   261
raise
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   262
    "QuerySignals are proceedable by definition,
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   263
     so they should be raised with #query or #raiseRequest"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   264
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   265
    ^ self shouldNotImplement
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   266
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   267
    "Created: / 23.7.1999 / 15:19:17 / stefan"
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   268
!
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
raiseRequest
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   271
    "redefined to use #query"
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
    ^ self query
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   274
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   275
    "Created: / 25.7.1999 / 23:25:59 / stefan"
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   276
! !
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   277
13674
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   278
!Notification methodsFor:'accessing'!
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   279
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   280
tag
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   281
    "for squeak compatibility"
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   282
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   283
    ^ tag
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   284
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   285
    "Modified (comment): / 11-09-2011 / 16:40:54 / cg"
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   286
!
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   287
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   288
tag:aSzmbol
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   289
    "for squeak compatibility"
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 := aSzmbol.
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   292
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   293
    "Modified (format): / 11-09-2011 / 16:41:01 / cg"
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   294
! !
89734bcfdb32 class definition
Claus Gittinger <cg@exept.de>
parents: 13363
diff changeset
   295
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   296
!Notification methodsFor:'default actions'!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   297
4525
999e680a29ca Make error classes public.
Stefan Vogel <sv@exept.de>
parents: 4508
diff changeset
   298
defaultAction
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   299
    "the default action is to return the default value.
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   300
     Subclasses may redefine this"
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   301
8683
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   302
    |handlerBlock|
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   303
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   304
    "try per signal handler.
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   305
     I may have been created from a QuerySignal"
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   306
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   307
    (handlerBlock := signal handlerBlock) notNil ifTrue:[
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   308
        "... and call it"
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   309
        ^ handlerBlock value:self.
a162510a0408 QuerySignal generates Notifications instead of Exceptions.
Stefan Vogel <sv@exept.de>
parents: 8681
diff changeset
   310
    ].
6451
f22b12c0349a renamed #defaultValue -> #defaultResumeValue (vw54 compat.)
Claus Gittinger <cg@exept.de>
parents: 6431
diff changeset
   311
    ^ self defaultResumeValue
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   312
4550
66adee5e8491 Renamed from Query.st
Stefan Vogel <sv@exept.de>
parents: 4525
diff changeset
   313
    "Modified: / 23.7.1999 / 15:13:34 / stefan"
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   314
! !
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   315
14948
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   316
!Notification methodsFor:'helpers'!
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   317
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   318
hasDialog
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   319
    "answer true, if we can use a Dialog window"
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   320
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   321
    (Smalltalk isInitialized 
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   322
     and:[Dialog notNil
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   323
     and:[Screen notNil
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   324
     and:[Screen current notNil
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   325
     and:[Screen current isOpenAndDispatching
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   326
    ]]]]) ifTrue:[
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   327
        Dialog autoload.        "in case its autoloaded"
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   328
        ^ true.
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   329
    ].
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   330
    ^ false
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
8701
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   333
!Notification methodsFor:'private'!
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   334
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   335
LATERdoCallHandler:aHandlerBlock
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   336
"SV: Have to think about..."
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   337
    "call the handler proper
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   338
     - an extra method is needed to have a raise-marked context around.
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   339
       (see implementation of #reject and #proceed).
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   340
     Redefined from GenericException to do a proceed here"
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   341
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   342
    <context: #return>
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   343
    <exception: #raise>
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   344
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   345
    |val|
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   346
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   347
    aHandlerBlock argumentCount == 0 ifTrue:[
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   348
        "/ 0-arg handler - not interested in the ex - object
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   349
        val := aHandlerBlock value
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   350
    ] ifFalse:[
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   351
        "/ 1-arg handler - pass myself as exception argument
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   352
        val := aHandlerBlock value:self.
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   353
    ].
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   354
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   355
    "handler fall through - is just like a #proceedWith:(aHandlerBlock value)"
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   356
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   357
    self proceedWith:val
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   358
! !
bd5034470a47 Optional code to make the default handler action to proceed.
Stefan Vogel <sv@exept.de>
parents: 8698
diff changeset
   359
12042
324365132b54 added: #query
fm
parents: 11200
diff changeset
   360
!Notification methodsFor:'queries'!
324365132b54 added: #query
fm
parents: 11200
diff changeset
   361
324365132b54 added: #query
fm
parents: 11200
diff changeset
   362
query
324365132b54 added: #query
fm
parents: 11200
diff changeset
   363
    "notice the implementation on the class-side: if no additional parameters are to be passed,
324365132b54 added: #query
fm
parents: 11200
diff changeset
   364
     we do not even arrive here, because query has inlined the raiseRequest code"
324365132b54 added: #query
fm
parents: 11200
diff changeset
   365
324365132b54 added: #query
fm
parents: 11200
diff changeset
   366
    ^ self raiseRequest
324365132b54 added: #query
fm
parents: 11200
diff changeset
   367
! !
324365132b54 added: #query
fm
parents: 11200
diff changeset
   368
8681
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   369
!Notification methodsFor:'testing'!
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   370
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   371
isNotification
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   372
    ^ true
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   373
! !
38aa963476a5 Support for Block>>#on:do:on:do:
Stefan Vogel <sv@exept.de>
parents: 8516
diff changeset
   374
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   375
!Notification class methodsFor:'documentation'!
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   376
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   377
version
14948
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   378
    ^ '$Header: /cvs/stx/stx/libbasic/Notification.st,v 1.28 2013-03-25 13:57:51 cg Exp $'
12042
324365132b54 added: #query
fm
parents: 11200
diff changeset
   379
!
324365132b54 added: #query
fm
parents: 11200
diff changeset
   380
324365132b54 added: #query
fm
parents: 11200
diff changeset
   381
version_CVS
14948
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   382
    ^ '$Header: /cvs/stx/stx/libbasic/Notification.st,v 1.28 2013-03-25 13:57:51 cg Exp $'
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   383
! !
8516
14ec9e1d3b39 example
Stefan Vogel <sv@exept.de>
parents: 6451
diff changeset
   384
14948
c792f4a1ceea class: Notification
Claus Gittinger <cg@exept.de>
parents: 13674
diff changeset
   385
4443
6928884b4c8a initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   386
Notification initialize!