The Trunk: System-mt.1099.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-mt.1099.mcz

commits-2
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1099.mcz

==================== Summary ====================

Name: System-mt.1099
Author: mt
Time: 23 September 2019, 1:50:29.661954 pm
UUID: 03a1202a-fff6-c544-9024-514c94c22aa8
Ancestors: System-ct.1098

Revise previous addition of Project >> #close, which enables scriptable project closing.

The UI stuff is in #okToChange. The model-update stuff is in #delete. See SystemWindow >> #closeBotHit and #update:.

=============== Diff against System-ct.1098 ===============

Item was changed:
  ----- Method: Project>>close (in category 'release') -----
  close
+ "Close and delete this project. Try to trigger the close request through the UI first, do manually of not in the UI."
 
+ self topView
+ ifNotNil: [self changed: #close]
+ ifNil: [
+ self okToClose ifTrue: [
+ self windowIsClosing; release]].!
- (self isCurrentProject and: [self isTopProject])
- ifTrue: [
- self inform: 'Cannot close the top project'.
- ^ false].
- self okToClose ifFalse: [^ false].
-
- self isCurrentProject
- ifFalse: [self delete.]
- ifTrue: [
- self parent
- addDeferredUIMessage: [self delete];
- enter].
- ^ true!

Item was changed:
  ----- Method: Project>>delete (in category 'release') -----
  delete
+ "You should not call this method directly. Call #close instead to make relevant checks first and inform users with interactive dialogs."
 
+ self isTopProject ifTrue: [^ self].
- self isCurrentProject
- ifTrue: [^ Error signal: 'Cannot delete the current project.'].
 
+ self isCurrentProject ifTrue: [
+ self parent
+ addDeferredUIMessage: [self delete];
+ enter.
+ "Execution stops here."
+ Error signal].
+
  self removeChangeSetIfPossible.
 
  ProjectHistory forget: self.
  Project deletingProject: self.!

Item was changed:
  ----- Method: Project>>okToChange (in category 'release') -----
  okToChange
  "Answer whether the window in which the project is housed can be dismissed -- which is destructive. We never clobber a project without confirmation"
 
  | answer |
+ (self isCurrentProject and: [self isTopProject]) ifTrue: [
+ self inform: 'You cannot close the top project.'.
+ ^ false].
+
  (self confirm: ('Do you really want to delete the project\{1}\and all its content?' withCRs translated format:{self name}))
  ifFalse: [^ false].
 
  self subProjects ifNotEmpty: [:sp |
  answer := Project uiManager
  chooseFrom: #(
  "1" 'Lift all sub-projects'
  "2" 'Discard all sub-projects (NO UNDO!!)'
  "3 or 0" 'Cancel')
  lines: #(2)
  title: ('The project {1}\contains {2} sub-project(s).' withCRs translated format:{self name. sp size}).
 
  (answer = 0 or: [answer = 3]) ifTrue: [^ false].
  answer = 1 ifTrue: [self liftSubProjects. ^ true].
  answer = 2 ifTrue: [^ sp allSatisfy: [:ea | ea okToChange]]].
 
  ^ true!