[squeak-dev] The Trunk: Tools-ct.1177.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Oct 15 18:08:20 UTC 2022
Christoph Thiede uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-ct.1177.mcz
==================== Summary ====================
Name: Tools-ct.1177
Author: ct
Time: 15 October 2022, 8:08:17.803171 pm
UUID: d0aef212-fcd5-9747-ba97-c167788fa1fb
Ancestors: Tools-ct.1176
Fixes and revises PackagePaneBrowser for case mismatches between a system category and the associated package name. Improves the short label for categories that equal the package name (without a suffix). If no category is selected, shows all classes from the package.
Thanks to Jakob (jr) for the assistance! See: https://lists.squeakfoundation.org/pipermail/squeak-dev/2022-September/222214.html
=============== Diff against Tools-ct.1176 ===============
Item was changed:
----- Method: PackagePaneBrowser>>classList (in category 'class list') -----
classList
- "Answer an array of the class names of the selected category. Answer an
- empty array if no selection exists."
+ self hasSystemCategorySelected ifTrue:
+ [| thisPackage thisCatSufix categories |
+ thisPackage := self package.
+ thisCatSufix := self selectedSystemCategoryWithoutPackage.
+ categories := systemOrganizer categories select: [:eachCat |
+ eachCat size >= thisPackage size
+ and: ["package prefix may occur in different cases, because they are assembled in the same package"
+ ((eachCat first: thisPackage size) compare: thisPackage caseSensitive: false) = 2]
+ and: ["rest of system category must have exact case, because it is discrimnated by the system category list"
+ (eachCat allButFirst: thisPackage size) = thisCatSufix]].
+ ^ categories gather: [:eachCat |
+ systemOrganizer listAtCategoryNamed: eachCat]].
+
+ self hasPackageSelected ifTrue:
+ [^ self packageClasses].
+
+ ^ systemOrganizer allElements!
- ^ self hasSystemCategorySelected
- ifFalse: [self packageClasses]
- ifTrue: [systemOrganizer listAtCategoryNamed: self selectedSystemCategory]!
Item was changed:
----- Method: PackagePaneBrowser>>packageClasses (in category 'class list') -----
packageClasses
+
+ ^ self packageInfo classes collect: [:class | class name]!
- ^ self categoryExistsForPackage
- ifFalse: [Array new]
- ifTrue:
- [systemOrganizer listAtCategoryNumber:
- (systemOrganizer categories indexOf: self package asSymbol)]!
Item was added:
+ ----- Method: PackagePaneBrowser>>packageInfo (in category 'accessing') -----
+ packageInfo
+
+ ^ PackageInfo named: (self package ifNil: [^ nil])!
Item was changed:
----- Method: PackagePaneBrowser>>selectedSystemCategory (in category 'system category list') -----
selectedSystemCategory
+ "Answer the full name of the selected system category or nil. Opposite of #systemCategoryList."
- "Answer the name of the selected system category or nil."
+ | thisCatSuffix |
self hasSystemCategorySelected
+ ifFalse: [^ nil].
+ thisCatSuffix := self selectedSystemCategoryWithoutPackage.
- ifFalse: [^nil].
packageListIndex = 0
+ ifTrue: [^ thisCatSuffix].
+ ^ self package , thisCatSuffix!
- ifTrue: [^ super selectedSystemCategory ].
- ^ self package , '-' , super selectedSystemCategory!
Item was added:
+ ----- Method: PackagePaneBrowser>>selectedSystemCategoryWithoutPackage (in category 'system category list') -----
+ selectedSystemCategoryWithoutPackage
+ "Answer the name of the selected system category without package prefix or nil. Opposite of #systemCategoryList."
+
+ | shortCat |
+ self hasSystemCategorySelected
+ ifFalse: [^ nil].
+ shortCat := super selectedSystemCategory.
+ packageListIndex = 0
+ ifTrue: [^ shortCat].
+ shortCat = '(default category)' translated
+ ifTrue: [^ ''].
+ shortCat = '-'
+ ifTrue: [^ '-'].
+ ^ '-' , shortCat!
Item was changed:
----- Method: PackagePaneBrowser>>systemCategoryList (in category 'system category list') -----
systemCategoryList
+ "Answer the sequenceable collection containing the class categories that the receiver accesses."
- "Answer the sequenceable collection containing the class categories that
- the receiver accesses."
| prefix |
packageListIndex = 0 ifTrue: [^ systemOrganizer categories].
+ prefix := self package.
+ ^ (self packageInfo systemCategories
+ collect: [:cat |
+ | shortCat |
+ shortCat := cat allButFirst: prefix size.
+ (shortCat size > 1 and: [shortCat first = $-])
+ ifTrue: [shortCat allButFirst]
+ ifFalse: [shortCat ifEmpty: ['(default category)' translated]]])
+ withoutDuplicates "different cases of the same category possible"
+
+ "The following class organization for the package MyPackage should be properly viewable in a PackagePaneBrowser:
+ ('mypackage' MyClassLowerCase)
+ ('Mypackage' MyClassMixedCase)
+ ('mypackage3' MyClassNotContained)
+ ('MyPackage' MyClass)
+ ('MyPackage-' MyClassDash)
+ ('Mypackage-foo' MyTestLowerSuffix)
+ ('Mypackage-Foo' MyTestUpperSuffix)
+ "!
- prefix := self package, '-'.
- ^ Array streamContents:
- [:strm |
- systemOrganizer categories do:
- [ :cat | (cat beginsWith: prefix) ifTrue:
- [strm nextPut: (cat copyFrom: prefix size + 1 to: cat size)]]]!
More information about the Squeak-dev
mailing list
|