accept before opening an editor
authorClaus Gittinger <cg@exept.de>
Thu, 01 Apr 1999 15:32:52 +0200
changeset 1103 ecc91379704b
parent 1102 abcdd3d5a67b
child 1104 cd4a620e6f94
accept before opening an editor
UIPainter.st
--- a/UIPainter.st	Thu Apr 01 15:30:20 1999 +0200
+++ b/UIPainter.st	Thu Apr 01 15:32:52 1999 +0200
@@ -1955,8 +1955,13 @@
     |cls loadedFromClass loadedFromSpec editor tableColumnsOrSelector|
 
     (cls := self resolveName:specClass) isNil ifTrue:[
-	self askForSaving ifFalse: [^self].
-	cls := self resolveName:specClass.
+        self askForSaving ifFalse: [^self].
+        cls := self resolveName:specClass.
+    ].
+    self modifiedChannel value ifTrue:[
+        (self confirm:'Accept changes made to spec ?') ifTrue:[
+            self accept
+        ]
     ].
 
     loadedFromSpec := loadedFromClass := false.
@@ -1966,34 +1971,34 @@
     editor rowClassName:(self specTool specification rowClassName).
     ((tableColumnsOrSelector := self specTool specification columnHolder) notNil and: 
     [cls class implements: tableColumnsOrSelector]) ifTrue: [
-	editor openModalOnClass: cls andSelector: tableColumnsOrSelector.
-	loadedFromClass := true.
+        editor openModalOnClass: cls andSelector: tableColumnsOrSelector.
+        loadedFromClass := true.
     ] ifFalse: [       
-	(tableColumnsOrSelector := self specTool specification columns) isNil ifTrue: [
-	    editor openModal
-	] ifFalse: [         
-	    editor openModalOnResourceSpec:tableColumnsOrSelector.
-	    loadedFromSpec := true
-	].
+        (tableColumnsOrSelector := self specTool specification columns) isNil ifTrue: [
+            editor openModal
+        ] ifFalse: [         
+            editor openModalOnResourceSpec:tableColumnsOrSelector.
+            loadedFromSpec := true
+        ].
     ].
 
     loadedFromClass ifTrue: [
-	self specTool specification columns:nil.
-	self specTool specification rowClassName:nil.
-	self modifiedChannel value:true.
-	self accept.
+        self specTool specification columns:nil.
+        self specTool specification rowClassName:nil.
+        self modifiedChannel value:true.
+        self accept.
     ].
 
     (loadedFromSpec not and: [editor hasSaved and:[editor specSelector ~= tableColumnsOrSelector]]) ifTrue:[
-	self specTool specification columnHolder:editor specSelector.
-	self modifiedChannel value:true.
-	self accept.
-	^self
+        self specTool specification columnHolder:editor specSelector.
+        self modifiedChannel value:true.
+        self accept.
+        ^self
     ].
     loadedFromClass ifFalse: [
-	self specTool specification columns:(editor columns).
-	self specTool specification rowClassName:(editor rowClassName).
-	self modifiedChannel value: editor modified.
+        self specTool specification columns:(editor columns).
+        self specTool specification rowClassName:(editor rowClassName).
+        self modifiedChannel value: editor modified.
     ].
 
 
@@ -2011,6 +2016,13 @@
 
     cls notNil ifTrue:[
         spec := self specTool specification.
+
+        self modifiedChannel value ifTrue:[
+            (self confirm:'Accept changes made to spec ?') ifTrue:[
+                self accept
+            ]
+        ].
+
         (selectorOrMenu := spec menuSelector) notNil ifTrue:[
             selectorOrMenu := selectorOrMenu asSymbol
         ] ifFalse:[
@@ -2170,30 +2182,30 @@
     |window|
 
     someObject == treeView model ifTrue:[
-	(something == #selection
-	or:[something == #selectionIndex]) ifTrue:[self treeSelection].
+        (something == #selection
+        or:[something == #selectionIndex]) ifTrue:[self treeSelection].
       ^ self
     ].
 
     someObject == self galleryShown ifTrue:[
-	"/ galleryShown toggle changed
-	window := selectionPanel window.
-	(someObject value) ifTrue:[
-	    self raiseUIView:window
-	] ifFalse:[
-	    self hideUIView:window
-	].
+        "/ galleryShown toggle changed
+        window := selectionPanel window.
+        (someObject value) ifTrue:[
+            self raiseUIView:window
+        ] ifFalse:[
+            self hideUIView:window
+        ].
       ^ self
     ].
 
     someObject == self painterShown ifTrue:[
-	"/ canvasShown toggle changed
-	window := self painter topView.
-	(someObject value) ifTrue:[
-	    self raiseUIView:window
-	] ifFalse:[
-	    self hideUIView:window
-	].
+        "/ canvasShown toggle changed
+        window := self painter topView.
+        (someObject value) ifTrue:[
+            self raiseUIView:window
+        ] ifFalse:[
+            self hideUIView:window
+        ].
       ^ self
     ].