Chris Muller uploaded a new version of PackageInfo-Base to project The Trunk:
http://source.squeak.org/trunk/PackageInfo-Base-cmm.49.mcz ==================== Summary ==================== Name: PackageInfo-Base-cmm.49 Author: cmm Time: 11 January 2011, 6:54:27.431 pm UUID: deb3b211-f90b-41d6-bb1a-be8534595b64 Ancestors: PackageInfo-Base-cmm.48 - Ensure that PackageInfo subclasses are always returned from PackageInfo class>>#named:, even if a generic PackageInfo is already present in PackageInfo allPackages. - PackageInfo subclass instances should announce their presence by overriding #packageName on the *class* side. Their 'packageName' variable will be populated in their instance with that name. - Packages that do not have a custom PackageInfo subclass will still get an instance of the generic PackageInfo, normally. =============== Diff against PackageInfo-Base-cmm.48 =============== Item was added: + ----- Method: PackageInfo class>>classFor: (in category 'private') ----- + classFor: packageNameString + self + allSubclassesDo: [:each | each packageName = packageNameString + ifTrue: [^ each]]. + ^ self! Item was changed: ----- Method: PackageInfo class>>named: (in category 'packages access') ----- + named: aString + "Alternative to #named: that provides allows you to register your own + PackageInfo subclasses." + | firstTry | + firstTry := PackageOrganizer default + packageNamed: aString + ifAbsent: [nil]. + ^ (firstTry isNil + or: [firstTry class + ~= (self classFor: aString)]) + ifTrue: [(self newNamed: aString) register] + ifFalse: [firstTry]! - named: aString - ^ PackageOrganizer default packageNamed: aString ifAbsent: [(self new packageName: aString) register]! Item was added: + ----- Method: PackageInfo class>>newNamed: (in category 'private') ----- + newNamed: aString + ^ (self classFor: aString) new packageName: aString; + register; + yourself! Item was added: + ----- Method: PackageInfo class>>packageName (in category 'packages access') ----- + packageName + "Subclasses announce their presence for a particular package by + overriding this method, answering the packageName of the package + they wish to represent. This is useful for the #classFor: factory + method. " + ^ nil! Item was changed: + ----- Method: PackageInfo class>>registerPackage: (in category 'registration / unregistration') ----- - ----- Method: PackageInfo class>>registerPackage: (in category 'as yet unclassified') ----- registerPackage: aString "for compatibility with old fileOuts" ^ Smalltalk at: #FilePackageManager ifPresent: [:p | p registerPackage: aString]! Item was changed: + ----- Method: PackageInfo class>>registerPackageName: (in category 'registration / unregistration') ----- - ----- Method: PackageInfo class>>registerPackageName: (in category 'packages access') ----- registerPackageName: aString ^ PackageOrganizer default registerPackageNamed: aString! Item was changed: ----- Method: PackageInfo>>packageName (in category 'naming') ----- packageName + ^ packageName + ifNil: [packageName := self class packageName + ifNil: [self categoryName]]! - ^ packageName ifNil: [packageName := self categoryName]! |
Free forum by Nabble | Edit this page |