Skip to content

Commit

Permalink
[feenkcom/gtoolkit#4120] update slots grouped list when a new class i…
Browse files Browse the repository at this point in the history
…s selected
  • Loading branch information
syrel committed Oct 25, 2024
1 parent 81bec82 commit 2322a5c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Class {
#instVars : [
'varA'
],
#classVars : [
'staticVarA'
],
#classInstVars : [
'classVarA'
],
#category : #'GT-PackageWithSuperclasses-Classes'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ GtCoderNavigationPackagesTagsClassesModelExamples >> navigateToClass_03_selectCl
aModel selectClass: aClassToSelect.

self assertSelectedPackageTagClass: aModel ofClass: aClassToSelect.

classesToShow := aModel classesToShow.
self assert: (classesToShow includes: aClassToSelect).

protocolsToShow := aModel protocolsToShow collect: [ :each | each name ].

self assert: (protocolsToShow includes: 'All').
Expand All @@ -209,8 +209,11 @@ GtCoderNavigationPackagesTagsClassesModelExamples >> navigateToClass_03_selectCl
self assert: (methodsToShow includes: aClassToSelect class >> #instanceCreationMethod).

slotsToShow := aModel slotsToShow.
self assert: (slotsToShow detect: [ :each| each name = #varA ]) isNotNil.
self assert: (slotsToShow detect: [ :each| each name = #classVarA ]) isNotNil.
self assert: (slotsToShow detect: [ :each| each name = #staticVarA ]) isNotNil.

^ aModel
^ slotsToShow
]

{ #category : #'examples - navigate to extensions' }
Expand Down
10 changes: 5 additions & 5 deletions src/GToolkit-Pharo-Coder-UI/GtBehaviorCreationForm.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ GtBehaviorCreationForm >> classSlots: anObject [
GtBehaviorCreationForm >> classSlotsDescription [
<magritteDescription>
^ MAToManyRelationDescription new
label: 'Static vars';
priority: 10;
label: 'Class-side vars';
priority: 6;
accessor: #classSlots;
classes: {String};
labelAptitude: [ (BrGlamorousLabelAptitude new glamorousFormLabelStyle) + (BrGlamorousWithLabelTooltipAptitude new text: 'Variables whose values (memory) is shared across all instances of a class and its subclasses.') ];
labelAptitude: [ (BrGlamorousLabelAptitude new glamorousFormLabelStyle) + (BrGlamorousWithLabelTooltipAptitude new text: 'Variables whose values are shared across all instances of a class and that class itself. Subclasses allocate their own memory for the class-side vars of the superclasses and don''t inherit their values.') ];
blocListStencil: (self taggerStencilWithCompletion: nil andContextMenuBlock: nil);
addCondition: [ :aValue | aValue asSet size = aValue size ]
labelled: 'All slot names must be unique'
Expand Down Expand Up @@ -134,7 +134,7 @@ GtBehaviorCreationForm >> slotsDescription [
<magritteDescription>
^ MAToManyRelationDescription new
label: 'Instance-side vars';
priority: 5;
priority: 6;
accessor: #slots;
labelAptitude: [ BrGlamorousLabelAptitude new glamorousFormLabelStyle + (BrGlamorousWithLabelTooltipAptitude new text: 'Variables whose value is scoped to an instance of a class.')];
classes: {String};
Expand Down Expand Up @@ -187,7 +187,7 @@ GtBehaviorCreationForm >> traitsDescription [
<magritteDescription>
^ MAToManyRelationDescription new
label: 'Traits';
priority: 6;
priority: 5;
accessor: #traits;
classes: {String};
labelAptitude: [ BrGlamorousLabelAptitude new glamorousFormLabelStyle ];
Expand Down
8 changes: 4 additions & 4 deletions src/GToolkit-Pharo-Coder-UI/GtClassCreationForm.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ GtClassCreationForm >> classVars: anObject [
GtClassCreationForm >> classVarsDescription [
<magritteDescription>
^ MAToManyRelationDescription new
label: 'Class-side vars';
priority: 7;
label: 'Static vars';
priority: 8;
accessor: #classVars;
labelAptitude: [ (BrGlamorousLabelAptitude new glamorousFormLabelStyle) + (BrGlamorousWithLabelTooltipAptitude new text: 'Variables whose values are shared across all instances of a class and that class itself. Subclasses allocate their own memory for the class-side vars of the superclasses and don''t inherit their values.') ];
labelAptitude: [ (BrGlamorousLabelAptitude new glamorousFormLabelStyle) + (BrGlamorousWithLabelTooltipAptitude new text: 'Variables whose values (memory) is shared across all instances of a class and its subclasses.') ];
classes: {String};
blocListStencil: (self taggerStencilWithCompletion: nil andContextMenuBlock: nil)
]
Expand Down Expand Up @@ -111,7 +111,7 @@ GtClassCreationForm >> poolsDescription [
<magritteDescription>
^ MAToManyRelationDescription new
label: 'Shared var. pools';
priority: 7;
priority: 10;
accessor: #pools;
labelAptitude: [ BrGlamorousLabelAptitude new glamorousFormLabelStyle ];
classes: {String};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ GtCoderNavigationPackagesTagsClassesModel >> notifySlotSelected: aSlot source: a

{ #category : #'private - notifying' }
GtCoderNavigationPackagesTagsClassesModel >> notifySlotsToShowChanged [
self announce: (GtCoderNavigationSlotsToShowChanged new coder: coder)
]

{ #category : #'private - announcement handling' }
Expand Down Expand Up @@ -982,18 +983,18 @@ GtCoderNavigationPackagesTagsClassesModel >> showPackage: anRPackage [
{ #category : #'api - accessing' }
GtCoderNavigationPackagesTagsClassesModel >> slotsToShow [
<return: #Collection of: #GtPharoProtocol>
| currentClass instanceSlots classInstanceSlots classSlots |
| currentClass instanceSideSlots classSideSlots staticSlots |

self hasSelectedClass
ifFalse: [ ^ #() ].

currentClass := self selectedClass.

instanceSlots := currentClass instanceSide instanceVariables.
classInstanceSlots := currentClass classSide instanceVariables.
classSlots := currentClass classVariables.
instanceSideSlots := currentClass instanceSide instanceVariables.
classSideSlots := currentClass classSide instanceVariables.
staticSlots := currentClass classVariables.

^ instanceSlots, classInstanceSlots, classSlots
^ instanceSideSlots, classSideSlots, staticSlots
]

{ #category : #'api - subscriptions' }
Expand Down

0 comments on commit 2322a5c

Please sign in to comment.