--- a/UserConfirmation.st Tue Feb 04 21:09:59 2014 +0100
+++ b/UserConfirmation.st Wed Apr 01 10:20:10 2015 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 2007 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -23,7 +23,7 @@
copyright
"
COPYRIGHT (c) 2007 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -39,40 +39,39 @@
This confirmation query is used when a user confirmation is required
somewhere within a model's operation (i.e. in non-GUI code).
Instead of directly asking via Dialog confirm... messages,
- this should be raised.
+ this should be raised.
Its default behavior is the same as the above dialog.
- However, the query can be cought and answered by an exceoptn (a query-) handler,
+ However, the query can be caught and answered by an exceoptn (a query-) handler,
to suppress these GUI interactions in situations, where they are not wanted.
This is a much better approach to the alternatives:
- passing additional 'doConfirm' arguments down from the high level caller
- keeping the doConfirm settings in a passed down flag object
- keeping the flag in a global (very bad)
- keeping it in a class var (almost as bad)
+ passing additional 'doConfirm' arguments down from the high level caller
+ keeping the doConfirm settings in a passed down flag object
+ keeping the flag in a global (very bad)
+ keeping it in a class var (almost as bad)
Notice: that's one of the nice consequences of proceedable exceptions.
[authors:]
- Stefan Vogel
- Claus Gittinger
+ Stefan Vogel
+ Claus Gittinger
[see also:]
- Query Notification Exception
+ Query Notification Exception
"
! !
-
!UserConfirmation methodsFor:'accessing'!
aspect
- "the aspect the user is asked. Set this to a symbol.
+ "the aspect the user is asked. Set this to a symbol.
It can be used by a exception handler"
^ parameter
!
aspect:aSymbol
- "the aspect the user is asked. Set this to a symbol.
+ "the aspect the user is asked. Set this to a symbol.
It can be used by a exception handler"
parameter := aSymbol
@@ -105,7 +104,6 @@
defaultAnswer := aBooleanOrNil
! !
-
!UserConfirmation methodsFor:'default actions'!
defaultAction
@@ -117,34 +115,34 @@
text := self description.
self hasDialog ifTrue:[
- self canCancel ifTrue:[
- ^ Dialog confirmWithCancel:text default:defaultAnswer
- ] ifFalse:[
- ^ Dialog confirm:text default:defaultAnswer
- ].
+ self canCancel ifTrue:[
+ ^ Dialog confirmWithCancel:text default:defaultAnswer
+ ] ifFalse:[
+ ^ Dialog confirm:text default:defaultAnswer
+ ].
].
"
on systems without GUI, simply show
the message on the Transcript and assume, that he would have typed 'yes' (or the defaultAnswer).
"
- retVal := defaultAnswer notNil
- ifTrue:[ defaultAnswer ]
- ifFalse:[
- self canCancel
- ifTrue:[ nil ]
- ifFalse:[ true ]].
+ retVal := defaultAnswer notNil
+ ifTrue:[ defaultAnswer ]
+ ifFalse:[
+ self canCancel
+ ifTrue:[ nil ]
+ ifFalse:[ true ]].
retValText := retVal isNil
- ifTrue:[ 'cancel' ]
- ifFalse:[
- retVal
- ifTrue:[ 'yes' ]
- ifFalse:[ 'no' ]].
+ ifTrue:[ 'cancel' ]
+ ifFalse:[
+ retVal
+ ifTrue:[ 'yes' ]
+ ifFalse:[ 'no' ]].
- Transcript
- show:('User confirmation requested (assuming %1): ' bindWith:retValText);
- showCR:text.
+ Transcript
+ show:('User confirmation requested (assuming %1): ' bindWith:retValText);
+ showCR:text.
^ retVal
"
@@ -152,18 +150,12 @@
"
! !
-
!UserConfirmation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UserConfirmation.st,v 1.7 2013-03-25 14:00:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UserConfirmation.st,v 1.8 2014-06-10 10:21:16 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/UserConfirmation.st,v 1.7 2013-03-25 14:00:49 cg Exp $'
-!
-
-version_SVN
- ^ '$Id: UserConfirmation.st 10761 2012-01-19 11:46:00Z vranyj1 $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UserConfirmation.st,v 1.8 2014-06-10 10:21:16 cg Exp $'
! !
-