#REFACTORING by cg
class: ApplicationModel
changed:
#closeDownViews
#closeRequest
#commonPostOpen
#postBuildWith:
super-annotation
--- a/ApplicationModel.st Wed Feb 08 00:50:05 2017 +0100
+++ b/ApplicationModel.st Wed Feb 08 00:50:25 2017 +0100
@@ -2704,13 +2704,17 @@
!
commonPostOpen
- "a common hook for postOpenWith:, postOpenAsSubcanvasWith: and postOpenAsDialogWith:."
-
+ "a common hook for postOpenWith:, postOpenAsSubcanvasWith: and postOpenAsDialogWith:.
+ Notice: redefined methods should do a super send.
+ otherwise resources might be undefined."
+
+ <modifier: #super>
+
resources isNil ifTrue:[
resources := self resources
].
-
- "Modified (comment): / 07-07-2011 / 17:13:39 / cg"
+
+ "Modified: / 07-02-2017 / 18:43:35 / cg"
!
commonPreBuild
@@ -2783,7 +2787,11 @@
Can be redefined in subclasses for additional setup after
the view has been built, but not yet opened."
+ <modifier: #super> "must be called if redefined"
+
self commonPostBuild
+
+ "Modified: / 08-02-2017 / 00:22:38 / cg"
!
postOpenAsSubcanvasWith:aBuilder
@@ -3792,6 +3800,8 @@
closeDownViews
"close down the application's view(s)"
+ <modifier: #super> "must be called if redefined"
+
|wg wgProcess window|
self release.
@@ -3800,45 +3810,47 @@
window := self window.
self shouldRememberLastExtent ifTrue:[
- self rememberLastExtent.
+ self rememberLastExtent.
].
((wg := self windowGroup) notNil
and:[ wg isModal not ]) ifTrue:[
- wgProcess := wg process.
- (Processor activeProcess ~~ wgProcess
- and:[wgProcess notNil]) ifTrue:[
- wgProcess terminate
- ] ifFalse:[
- wg closeDownViews.
- ]
+ wgProcess := wg process.
+ (Processor activeProcess ~~ wgProcess
+ and:[wgProcess notNil]) ifTrue:[
+ wgProcess terminate
+ ] ifFalse:[
+ wg closeDownViews.
+ ]
] ifFalse:[
- window notNil ifTrue:[
- window destroy.
- ]
+ window notNil ifTrue:[
+ window destroy.
+ ]
].
- "Modified: / 31-07-2013 / 17:41:08 / cg"
+ "Modified: / 08-02-2017 / 00:24:14 / cg"
!
closeRequest
"this is sent by my topView when about to be closed by the windowManager.
Could be redefined in subclasses to suppress close or confirm."
+ <modifier: #super> "must be called if redefined"
+
|sav window|
window := self window.
window isNil ifTrue:[
- 'ApplicationModel [warning]: oops - closeRequest for non-view application arrived' infoPrintCR.
- ^ self
+ 'ApplicationModel [warning]: oops - closeRequest for non-view application arrived' infoPrintCR.
+ ^ self
].
window isTopView ifFalse:[
- window topView isModal ifTrue:[
- WindowGroup leaveSignal raise.
- ].
-
- 'ApplicationModel [warning]: oops - closeRequest for non-TopView arrived' infoPrintCR.
- ^ self
+ window topView isModal ifTrue:[
+ WindowGroup leaveSignal raise.
+ ].
+
+ 'ApplicationModel [warning]: oops - closeRequest for non-TopView arrived' infoPrintCR.
+ ^ self
].
"/ In multiView apps, tell my master.
@@ -3846,33 +3858,33 @@
(masterApplication notNil
and:[window isModal not]) ifTrue:[
- "/ temporary clear my masterApplication to prevent
- "/ endless recursion, in case the master sends me
- "/ a closeRequest (although, it is supposed to
- "/ send me a closeDownViews ...)
-
- sav := masterApplication.
- masterApplication := nil.
- sav closeRequestFor:window.
-
- "/ restore - in case master did not want me to close ...
- masterApplication := sav.
+ "/ temporary clear my masterApplication to prevent
+ "/ endless recursion, in case the master sends me
+ "/ a closeRequest (although, it is supposed to
+ "/ send me a closeDownViews ...)
+
+ sav := masterApplication.
+ masterApplication := nil.
+ sav closeRequestFor:window.
+
+ "/ restore - in case master did not want me to close ...
+ masterApplication := sav.
] ifFalse:[
- "/ ST/X does close-check by redefining this message without
- "/ a supersend;
- "/ VW does it by returning false from requestForWindowClose
- "/ sigh.
-
- self requestForWindowClose ifTrue:[
- window isSlave ifTrue:[
- window destroy
- ] ifFalse:[
- self closeDownViews
- ]
- ]
+ "/ ST/X does close-check by redefining this message without
+ "/ a supersend;
+ "/ VW does it by returning false from requestForWindowClose
+ "/ sigh.
+
+ self requestForWindowClose ifTrue:[
+ window isSlave ifTrue:[
+ window destroy
+ ] ifFalse:[
+ self closeDownViews
+ ]
+ ]
].
- "Modified: / 19.6.1998 / 01:37:17 / cg"
+ "Modified: / 08-02-2017 / 00:25:11 / cg"
!
closeRequestFor:aTopView