keep windowSpec methods category if it already exists
authorClaus Gittinger <cg@exept.de>
Tue, 24 Jun 1997 19:14:46 +0200
changeset 178 fb8451053c96
parent 177 eefd69a52f5b
child 179 72eec92090f6
keep windowSpec methods category if it already exists
UIPainterView.st
--- a/UIPainterView.st	Tue Jun 24 19:13:55 1997 +0200
+++ b/UIPainterView.st	Tue Jun 24 19:14:46 1997 +0200
@@ -17,16 +17,16 @@
 	category:'Interface-UIPainter'
 !
 
-MultiSelectionInList subclass:#ListHolder
-	instanceVariableNames:'painter propertyList masterElement disabledChanged'
-	classVariableNames:''
+Object subclass:#ViewProperty
+	instanceVariableNames:'view spec identifier'
+	classVariableNames:'Identifier'
 	poolDictionaries:''
 	privateIn:UIPainterView
 !
 
-Object subclass:#ViewProperty
-	instanceVariableNames:'view spec identifier'
-	classVariableNames:'Identifier'
+MultiSelectionInList subclass:#ListHolder
+	instanceVariableNames:'painter propertyList masterElement disabledChanged'
+	classVariableNames:''
 	poolDictionaries:''
 	privateIn:UIPainterView
 !
@@ -622,7 +622,7 @@
 !
 
 generateWindowSpecMethodSource
-    |t s spec specArray str code|
+    |t s spec specArray str code category cls mthd|
 
     specArray := OrderedCollection new.
 
@@ -638,8 +638,17 @@
     str := WriteStream on:String new.
     UISpecification prettyPrintSpecArray:specArray on:str indent:5.
 
+    "/ if that method already exists, do not overwrite the category
+
+    category := 'interface specs'.
+    (cls := Smalltalk classNamed:className) notNil ifTrue:[
+        (mthd := cls class compiledMethodAt:methodName asSymbol) notNil ifTrue:[
+            category := mthd category.
+        ]
+    ].
+
     code := Character excla asString 
-            , className , ' class methodsFor:''interface specs'''
+            , className , ' class methodsFor:' , category storeString
             , Character excla asString , '\\'
 
             , methodName , '\'
@@ -668,6 +677,7 @@
     ^ code withCRs
 
     "Modified: 5.9.1995 / 21:01:35 / claus"
+    "Modified: 24.6.1997 / 19:12:44 / cg"
 ! !
 
 !UIPainterView methodsFor:'initialization'!
@@ -1163,6 +1173,105 @@
 
 ! !
 
+!UIPainterView::ViewProperty class methodsFor:'documentation'!
+
+version
+    ^ '$Header$'
+! !
+
+!UIPainterView::ViewProperty class methodsFor:'instance creation'!
+
+new
+    Identifier notNil ifTrue:[Identifier := Identifier + 1]
+                     ifFalse:[Identifier := 1].
+
+  ^ self basicNew initialize
+! !
+
+!UIPainterView::ViewProperty methodsFor:'accessing'!
+
+identifier
+    "return the unique identifier assigned to property
+    "
+    ^ identifier
+!
+
+identifier:anIdentifier
+    "set the unique identifier assigned to property; called after an restore of
+     a deleted instance
+    "
+    identifier := anIdentifier
+!
+
+spec
+    "return the value of the instance variable 'spec' (automatically generated)"
+
+    ^ spec!
+
+spec:something
+    "set the value of the instance variable 'spec' (automatically generated)"
+
+    spec := something.!
+
+view
+    "return the value of the instance variable 'view' (automatically generated)"
+
+    ^ view!
+
+view:something
+    "set the value of the instance variable 'view' (automatically generated)"
+
+    view := something.! !
+
+!UIPainterView::ViewProperty methodsFor:'initialization'!
+
+initialize
+    super initialize.
+    identifier := Identifier
+! !
+
+!UIPainterView::ViewProperty methodsFor:'misc'!
+
+extractNumberStartingAt:anIndex
+    "return the number from the name starting at anIndex or 0.
+    "
+    |val|
+
+    val := 0.
+
+    self name from:anIndex do:[:c|
+        c isDigit ifTrue:[val := val * 10 + c digitValue]
+                 ifFalse:[^ 0]
+    ].
+    ^ val
+        
+! !
+
+!UIPainterView::ViewProperty methodsFor:'spec messages'!
+
+doesNotUnderstand:aMessage
+    spec notNil ifTrue:[
+        (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec]
+    ].
+    ^ nil
+!
+
+layout
+    spec layout
+!
+
+layout:aLayout
+    spec layout:aLayout
+!
+
+name
+    ^ spec name
+!
+
+name:aName
+    spec name:aName
+! !
+
 !UIPainterView::ListHolder class methodsFor:'instance creation'!
 
 for:aPainter
@@ -1496,105 +1605,6 @@
     super selectionIndex:aSel
 ! !
 
-!UIPainterView::ViewProperty class methodsFor:'documentation'!
-
-version
-    ^ '$Header$'
-! !
-
-!UIPainterView::ViewProperty class methodsFor:'instance creation'!
-
-new
-    Identifier notNil ifTrue:[Identifier := Identifier + 1]
-                     ifFalse:[Identifier := 1].
-
-  ^ self basicNew initialize
-! !
-
-!UIPainterView::ViewProperty methodsFor:'accessing'!
-
-identifier
-    "return the unique identifier assigned to property
-    "
-    ^ identifier
-!
-
-identifier:anIdentifier
-    "set the unique identifier assigned to property; called after an restore of
-     a deleted instance
-    "
-    identifier := anIdentifier
-!
-
-spec
-    "return the value of the instance variable 'spec' (automatically generated)"
-
-    ^ spec!
-
-spec:something
-    "set the value of the instance variable 'spec' (automatically generated)"
-
-    spec := something.!
-
-view
-    "return the value of the instance variable 'view' (automatically generated)"
-
-    ^ view!
-
-view:something
-    "set the value of the instance variable 'view' (automatically generated)"
-
-    view := something.! !
-
-!UIPainterView::ViewProperty methodsFor:'initialization'!
-
-initialize
-    super initialize.
-    identifier := Identifier
-! !
-
-!UIPainterView::ViewProperty methodsFor:'misc'!
-
-extractNumberStartingAt:anIndex
-    "return the number from the name starting at anIndex or 0.
-    "
-    |val|
-
-    val := 0.
-
-    self name from:anIndex do:[:c|
-        c isDigit ifTrue:[val := val * 10 + c digitValue]
-                 ifFalse:[^ 0]
-    ].
-    ^ val
-        
-! !
-
-!UIPainterView::ViewProperty methodsFor:'spec messages'!
-
-doesNotUnderstand:aMessage
-    spec notNil ifTrue:[
-        (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec]
-    ].
-    ^ nil
-!
-
-layout
-    spec layout
-!
-
-layout:aLayout
-    spec layout:aLayout
-!
-
-name
-    ^ spec name
-!
-
-name:aName
-    spec name:aName
-! !
-
 !UIPainterView class methodsFor:'documentation'!
 
 version