ask first for saving before calling other editors
authortz
Thu, 23 Apr 1998 14:32:21 +0200
changeset 808 4e2ab5e77344
parent 807 b6f229e2ef70
child 809 6f127dd5e578
ask first for saving before calling other editors
UIPainter.st
--- a/UIPainter.st	Thu Apr 23 09:10:09 1998 +0200
+++ b/UIPainter.st	Thu Apr 23 14:32:21 1998 +0200
@@ -1828,7 +1828,7 @@
     |editor|
 
     (self resolveName:specClass) isNil ifTrue:[
-        ^ self information:'No application class defined yet!!'
+        self askForSaving ifFalse: [^self]
     ].
 
     editor := DataSetBuilder new.
@@ -1850,7 +1850,7 @@
     |cls selectorOrMenu editor selectedSpec|
 
     (cls := self resolveName:specClass) isNil ifTrue:[
-        ^ self warn:'No application class defined yet!!'
+        self askForSaving ifFalse: [^self]
     ].
 
     cls notNil ifTrue:[
@@ -1895,7 +1895,7 @@
     |selector editor|
 
     (self resolveName:specClass) isNil ifTrue:[
-        ^ self information:'No application class defined yet!!'
+        self askForSaving ifFalse: [^self]
     ].
 
     (selector := self specTool specification hierarchicalList) notNil ifTrue:[
@@ -1947,7 +1947,7 @@
     |selector editor|
 
     (self resolveName:specClass) isNil ifTrue:[
-        ^ self information:'No application class defined yet!!'
+        self askForSaving ifFalse: [^self]
     ].
 
     (selector := self specTool specification listSelector) isArray 
@@ -2072,6 +2072,22 @@
     ^true
 !
 
+askForSaving
+    "asks for defining an application class"
+
+    self askForSectionModification.    
+
+    ((YesNoBox title:'No application class defined yet!!')        
+        noText:'Cancel';
+        yesText:'Define';
+        showAtPointer;
+        accepted) ifFalse: [^false].
+
+    self doSave.
+
+    ^true
+!
+
 askForSectionModification
     "asks for section modification in the notebook"
 
@@ -3569,8 +3585,6 @@
                       width:dX
                      height:dX
     ]
-
-    "Modified: / 23.4.1998 / 09:08:50 / cg"
 ! !
 
 !UIPainter::TreeView methodsFor:'initialization'!