--- a/LibraryDefinition.st Fri Aug 11 14:11:48 2006 +0200
+++ b/LibraryDefinition.st Fri Aug 11 14:43:27 2006 +0200
@@ -38,53 +38,61 @@
!ProjectDefinition class methodsFor:'instance creation'!
definitionClassForPackage:aPackageID
- |classes|
+ ^ self definitionClassForPackage:aPackageID createIfAbsent:false
- ^ Smalltalk at:(aPackageID asString copy replaceAny:':/' with:$_) asSymbol.
+ "Modified: / 11-08-2006 / 14:29:21 / cg"
+!
+
+definitionClassForPackage:aPackageID createIfAbsent:doCreateIfAbsent
+ |class|
-"/ classes := OrderedCollection new.
-"/ Smalltalk allClassesInPackage:aPackageID
-"/ do:[:eachClass |
-"/ eachClass isLoaded ifFalse:[
-"/ eachClass autoload
-"/ ].
-"/ (eachClass isSubclassOf:ProjectDefinition) ifTrue:[
-"/ classes add:eachClass
-"/ ]
-"/ ].
-"/
-"/ classes isEmpty ifTrue:[
-"/ ^ nil
-"/ ].
-"/ classes size > 1 ifTrue:[
-"/ self error:'OOPS - multiple projectDefinitions' mayProceed:true.
-"/ ^ classes first.
-"/ ].
-"/ ^ classes first
+ class := Smalltalk at:(aPackageID asString copy replaceAny:':/' with:$_) asSymbol.
+ class isNil ifTrue:[
+ doCreateIfAbsent ifTrue:[
+ ^ self newForPackage:aPackageID
+ ]
+ ].
+ ^ class.
- "Created: / 09-08-2006 / 17:27:32 / fm"
- "Modified: / 11-08-2006 / 13:45:56 / cg"
+ "Created: / 11-08-2006 / 14:28:51 / cg"
+!
+
+newForPackage:packageID
+ ^ self
+ newNamed:(self initialClassNameForDefinitionOf:packageID)
+ package:packageID.
+
+ "Created: / 11-08-2006 / 14:27:19 / cg"
!
newNamed:newName package:packageID
|newClass|
+ "/ for now, we are strict.
+ self assert:(self initialClassNameForDefinitionOf:packageID) = newName.
newClass := self
subclass:(newName asSymbol)
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
- category:'* Projects *'.
+ category:(self defaultCategory).
newClass package:packageID asSymbol.
^ newClass
"Created: / 09-08-2006 / 17:57:37 / fm"
"Modified: / 09-08-2006 / 19:27:53 / fm"
+ "Modified: / 11-08-2006 / 14:18:01 / cg"
! !
!ProjectDefinition class methodsFor:'accessing'!
+defaultCategory
+ ^'* Projects *'
+
+ "Created: / 11-08-2006 / 14:16:49 / cg"
+!
+
initialClassNameForDefinitionOf:aPackageId
|s|
@@ -1520,6 +1528,5 @@
!ProjectDefinition class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/LibraryDefinition.st,v 1.12 2006-08-11 12:09:45 cg Exp $'
-
+ ^ '$Header: /cvs/stx/stx/libbasic/LibraryDefinition.st,v 1.13 2006-08-11 12:43:27 cg Exp $'
! !