--- a/Tools__InlineMessageDialog.st Thu Feb 09 15:37:12 2012 +0000
+++ b/Tools__InlineMessageDialog.st Fri Feb 10 11:02:29 2012 +0000
@@ -28,7 +28,8 @@
"{ NameSpace: Tools }"
ApplicationModel subclass:#InlineMessageDialog
- instanceVariableNames:'messageHolder progressHolder specHolder'
+ instanceVariableNames:'messageHolder progressHolder progressView specHolder worker
+ layout'
classVariableNames:''
poolDictionaries:''
category:'Interface-Tools'
@@ -163,6 +164,7 @@
model: progressHolder
foregroundColor: (Color 52.156862745098 37.2549019607843 0.0)
backgroundColor: (Color 100.0 91.3725490196078 70.1960784313726)
+ postBuildCallback: postBuildProgressView:
)
(ActionButtonSpec
label: 'Abort'
@@ -242,18 +244,26 @@
!InlineMessageDialog methodsFor:'actions'!
doAbort
- <resource: #uiCallback>
-
- "automatically generated by UIPainter..."
- "*** the code below performs no action"
- "*** (except for some feedback on the Transcript)"
- "*** Please change as required and accept in the browser."
- "*** (and replace this comment by something more useful ;-)"
+ worker isNil ifTrue:[ self hide. ^ self ].
+ worker interruptWith:[
+ NoHandlerError handle:[:ex |
+ ex parameter signal == AbortOperationRequest ifTrue:[
+ ex return.
+ ].
+ ex reject.
+ ] do:[
+ AbortOperationRequest raise.
+ ].
+ ].
+ (worker notNil and:[worker isDead]) ifTrue:[
+ worker := nil.
+ worker terminate.
+ "/ raise its prio to make it terminate quickly
+ worker priority:(Processor userSchedulingPriority + 1)
+ ].
- "action to be defined here..."
-
- Transcript showCR:self class name, ': action for doAbort ...'.
+ "Modified: / 10-02-2012 / 10:49:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
doOK
@@ -315,6 +325,41 @@
"Modified: / 28-10-2010 / 18:29:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!InlineMessageDialog methodsFor:'informing'!
+
+progress: label while: block
+
+ worker := [
+ self message: label.
+ self progress: nil.
+ self show: #progressInfoSpec.
+ [
+ block value.
+ ] on: ProgressNotification do:[:ex|
+ self progress: ex progressValue
+ ].
+ ] newProcess.
+ worker addExitAction:[
+ self hide.
+ worker := nil.
+ ].
+ worker resume.
+
+ "Created: / 10-02-2012 / 10:34:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!InlineMessageDialog methodsFor:'initializing'!
+
+postBuildProgressView: aView
+
+ aView showBusyIndication:
+ (BlockValue
+ with: [:p|p value isNil]
+ argument: self progressHolder)
+
+ "Created: / 10-02-2012 / 10:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!InlineMessageDialog methodsFor:'private'!
getMyView
@@ -347,8 +392,7 @@
myView isVisible ifFalse:[^self]."/already hidden"
myView isVisible: false.
- otherView layout:
- (otherView layout topOffset: 0; yourself)
+ otherView layout: layout
"Created: / 29-10-2010 / 11:55:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
@@ -359,9 +403,10 @@
myView := self getMyView.
otherView := self getOtherView.
myView isVisible ifTrue:[^self]."/already shown"
+ layout := otherView layout copy.
myView isVisible: true.
otherView layout:
- (otherView layout topOffset: 40; yourself).
+ (layout copy topOffset: layout topOffset + 40; yourself).
self specHolder value: spec.
"Created: / 29-10-2010 / 11:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -374,5 +419,5 @@
!
version_SVN
- ^ '$Id: Tools__InlineMessageDialog.st 7854 2012-01-30 17:49:41Z vranyj1 $'
-! !
\ No newline at end of file
+ ^ '$Id: Tools__InlineMessageDialog.st 7879 2012-02-10 11:02:29Z vranyj1 $'
+! !