YesToAllConfirmation.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 26 Apr 2010 19:26:38 +0100
branchjv
changeset 17761 b0e5971141bc
parent 17711 39faaaf888b4
child 17807 06cc6c49e291
permissions -rw-r--r--
Added Lookup and BuiltinLookup classes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
     1
"
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
     2
 COPYRIGHT (c) 2004 by eXept Software AG
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
     3
              All Rights Reserved
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
     4
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
     5
 This software is furnished under a license and may be used
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
     6
 only in accordance with the terms of that license and with the
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
     9
 other person.  No title to or ownership of the software is
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    10
 hereby transferred.
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    11
"
8385
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libbasic' }"
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
8386
d600ab917968 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8385
diff changeset
    14
Notification subclass:#YesToAllConfirmation
8385
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:''
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
11199
f3d476a2d45a category
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    18
	category:'Kernel-Exceptions-Notifications'
8385
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    21
!YesToAllConfirmation class methodsFor:'documentation'!
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    22
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    23
copyright
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    24
"
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    25
 COPYRIGHT (c) 2004 by eXept Software AG
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    26
              All Rights Reserved
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    27
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    28
 This software is furnished under a license and may be used
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    29
 only in accordance with the terms of that license and with the
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    31
 be provided or otherwise made available to, or used by, any
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    32
 other person.  No title to or ownership of the software is
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    33
 hereby transferred.
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    34
"
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    35
! !
8385
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
11204
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    37
!YesToAllConfirmation class methodsFor:'queries'!
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    38
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    39
notify
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    40
    "raise a notification; usually will be remembered in a handler for the next
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    41
     query to return true"
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    42
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    43
    ^ self raiseRequestWith:#yesToAll.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    44
! !
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    45
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    46
!YesToAllConfirmation class methodsFor:'utilities'!
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    47
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    48
handleConfirmationIn:aBlock
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    49
    "evaluate aBlock;
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    50
     if inside that block, a query for YesToAll is raised, remember it and
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    51
     answer it as required."
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    52
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    53
    |alreadyAnswered|
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    54
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    55
    alreadyAnswered := false.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    56
    self handle:[:ex |
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    57
        ex parameter == #yesToAll ifTrue:[
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    58
            alreadyAnswered := true.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    59
        ].
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    60
        ex proceedWith:alreadyAnswered
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    61
    ] do:aBlock.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    62
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    63
    "
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    64
      YesToAllConfirmation
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    65
        handleConfirmationIn:[
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    66
            1 to:5 do:[:i |
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    67
                |confirmed|
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    68
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    69
                YesToAllConfirmation query ifFalse:[
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    70
                    confirmed := OptionBox
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    71
                                  request:(i printString)
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    72
                                  label:('Ask again and again')
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    73
                                  image:(YesNoBox iconBitmap)
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    74
                                  buttonLabels:#('Cancel' 'No' 'Yes' 'Yes to All')
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    75
                                  values:#(nil false true #yesToAll)
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    76
                                  default:false
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    77
                                  onCancel:false.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    78
                    confirmed == #yesToAll ifTrue:[
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    79
                        YesToAllConfirmation notify
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    80
                    ].
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    81
                ].
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    82
                Transcript showCR:i.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    83
            ].
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    84
        ].
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    85
    "
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    86
! !
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    87
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    88
!YesToAllConfirmation methodsFor:'defaults'!
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    89
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    90
defaultResumeValue
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    91
    ^ false
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    92
! !
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    93
8385
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
!YesToAllConfirmation class methodsFor:'documentation'!
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
version
17761
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    97
    ^ '$Id: YesToAllConfirmation.st 10517 2010-04-26 18:26:38Z vranyj1 $'
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    98
!
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    99
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   100
version_SVN
b0e5971141bc Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   101
    ^ '$Id: YesToAllConfirmation.st 10517 2010-04-26 18:26:38Z vranyj1 $'
8385
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
! !