[Cuis-dev] [IMPROV] Better initial answer for new system categories.

Gerald Klix cuis.01 at klix.ch
Thu Nov 5 03:47:50 PST 2020


Hi all, Hi Juan, Hi Hernan,

I create new packages on a regular basis. I often press browse in the 
Installed Packages browser and get an empty browser. If I then
press 'add item... (a)' in the system category
list and make a slight typo I have a browser
being still empty and a wrong category lingering
around.

Here comes a small change set, that provides a
sensible default for the SinglePackgeBrowser model. I think it's more 
newbie (old
fart^H^H^H^H senior programmer) friendly
that way.


HTH and Best Regards,

Gerald
-------------- next part --------------
'From Cuis 5.0 [latest update: #4438] on 5 November 2020 at 12:32:31 pm'!

!Browser methodsFor: 'system category functions' stamp: 'KLG 11/5/2020 12:23:10'!
newSystemCategoryNameInitialAnswer
	"Make a suggestion for a new sytems category.
	
	Can be redefined in subclasses to provide something meore meaningfull."

	^ 'Category-Name'.
! !


!SinglePackageBrowser methodsFor: 'system category functions' stamp: 'KLG 11/5/2020 12:28:53'!
newSystemCategoryNameInitialAnswer
	"Make a suggestion for a new sytems category.
	
	Provide something more usefull, e.g. the package name or a sensible derivate of it."

	| packageName | 
	^ self systemCategoryList includes: (packageName _ package packageName) ::
		ifTrue: [ packageName, ' - Sub-Category-Name' ]
		ifFalse: [ packageName ]
! !


!Browser methodsFor: 'system category functions' stamp: 'KLG 11/5/2020 12:23:23'!
newSystemCategoryNameIfNone: aNoneBlock

	| newName |
	
	newName _ self
		request: 'New category name?'
		initialAnswer: self newSystemCategoryNameInitialAnswer.
	
	^newName isEmpty
		ifTrue: aNoneBlock 
		ifFalse: [newName asSymbol].! !


!SinglePackageBrowser reorganize!
('accessing' defaultBrowserTitle package:)
('lists' defaultClassList messageCategoryList messageList rawMessageCategoryList systemCategoryList)
('system category functions' newSystemCategoryNameInitialAnswer)
!



More information about the Cuis-dev mailing list