YesToAllConfirmation.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 19 Jan 2012 11:46:00 +0000
branchjv
changeset 17911 a99f15c5efa5
parent 17910 8d796ca8bd1d
child 18011 deb0c3355881
permissions -rw-r--r--
Updated with /trunk
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
"
17807
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
    35
!
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
    36
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
    37
documentation
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
    38
"
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
    39
    used with confirmation dialogs, especially from the filebrowser and compilers
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
    40
    to up-notify that further such confirmations are not wanted by the user.
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
    41
"
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8386
diff changeset
    42
! !
8385
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
11204
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    44
!YesToAllConfirmation class methodsFor:'queries'!
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
notify
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    47
    "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
    48
     query to return true"
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    49
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    50
    ^ self raiseRequestWith:#yesToAll.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    51
! !
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
!YesToAllConfirmation class methodsFor:'utilities'!
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
handleConfirmationIn:aBlock
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    56
    "evaluate aBlock;
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    57
     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
    58
     answer it as required."
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
    |alreadyAnswered|
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    61
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    62
    alreadyAnswered := false.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    63
    self handle:[:ex |
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    64
        ex parameter == #yesToAll ifTrue:[
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    65
            alreadyAnswered := true.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    66
        ].
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    67
        ex proceedWith:alreadyAnswered
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    68
    ] do:aBlock.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    69
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    70
    "
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    71
      YesToAllConfirmation
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    72
        handleConfirmationIn:[
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    73
            1 to:5 do:[:i |
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    74
                |confirmed|
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    75
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    76
                YesToAllConfirmation query ifFalse:[
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    77
                    confirmed := OptionBox
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    78
                                  request:(i printString)
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    79
                                  label:('Ask again and again')
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    80
                                  image:(YesNoBox iconBitmap)
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    81
                                  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
    82
                                  values:#(nil false true #yesToAll)
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    83
                                  default:false
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    84
                                  onCancel:false.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    85
                    confirmed == #yesToAll ifTrue:[
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    86
                        YesToAllConfirmation notify
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
                ].
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    89
                Transcript showCR:i.
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    90
            ].
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    91
        ].
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
! !
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    94
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    95
!YesToAllConfirmation methodsFor:'defaults'!
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    96
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    97
defaultResumeValue
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    98
    ^ false
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
    99
! !
c6c94c53df21 utility which does the ok-to-all for me
Claus Gittinger <cg@exept.de>
parents: 11199
diff changeset
   100
8385
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
!YesToAllConfirmation class methodsFor:'documentation'!
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
bb10cbfae774 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
version
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   104
    ^ '$Header: /cvs/stx/stx/libbasic/YesToAllConfirmation.st,v 1.6 2010/10/14 08:38:03 cg Exp $'
17807
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
   105
!
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
   106
06cc6c49e291 merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17761
diff changeset
   107
version_CVS
17845
7e0cfaac936d Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17841
diff changeset
   108
    ^ '§Header: /cvs/stx/stx/libbasic/YesToAllConfirmation.st,v 1.6 2010/10/14 08:38:03 cg Exp §'
17865
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
   109
!
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
   110
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
   111
version_SVN
17911
a99f15c5efa5 Updated with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17910
diff changeset
   112
    ^ '$Id: YesToAllConfirmation.st 10761 2012-01-19 11:46:00Z vranyj1 $'
17846
24edc476ac18 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17845
diff changeset
   113
! !
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   114
17910
8d796ca8bd1d Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17892
diff changeset
   115
17911
a99f15c5efa5 Updated with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17910
diff changeset
   116