Reputation: 1820
In Pharo 9, how do I create a package that has a hierarchy of sub-packages like in "Announcements-Core" where there is an expanding and collapsing arrow?
I thought that it might be based on the names of the packages but when I tried with the following messages to create two classes they just show up as separate packages. What I want is for there to be a package "T-base" that has sub packages "type1" and "type2"?
Object subclass: #T1 instanceVariableNames: '' classVariableNames: '' package: 'T-base-type1'
Object subclass: #T2 instanceVariableNames: '' classVariableNames: '' package: 'T-base-type2'
Upvotes: 1
Views: 111
Reputation: 1820
To add to Leandro's answer, to do this in smalltalk code you can do this:
t1 := Object subclass: #T1
instanceVariableNames: ''
classVariableNames: ''
package: 'T-base-type1'.
t2 := Object subclass: #T2
instanceVariableNames: ''
classVariableNames: ''
package: 'T-base-type2'.
t1 class package addClassDefinition: t1 toClassTag: #type1.
t2 class package addClassDefinition: t2 toClassTag: #type2.
t1 class package
gives you the RPackage
instance and you can then add the class to a tag. I also found that you need to have the final part of the package name (eg. type1) be the same as the tag name, otherwise there is an error that the class is "uncategorized".
There is another way as well: You can create the class without the final part of the package name and then send the category:
message to the class to add it on
t1 := Object subclass: #T1
instanceVariableNames: ''
classVariableNames: ''
package: 'T-base'.
t1 category: 'T-base-type1'.
Upvotes: 1
Reputation: 14858
To create a new package and a (so called) tag inside it use the right-click menu items New package
and New tag
. Packages are instances of RPackage
and tags of ClyTaggedClassGroup
.
Upvotes: 1