Skip to content

Commit

Permalink
[feenkcom/gtoolkit#4120] add slots related examples
Browse files Browse the repository at this point in the history
  • Loading branch information
syrel committed Oct 25, 2024
1 parent 7a8673b commit 7254593
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/GT-PackageWithSuperclasses/GtCoderDummySuperclass.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,25 @@ GtCoderDummySuperclass class >> instanceCreationMethod [
^ self new
]

{ #category : #'methods reading slots' }
GtCoderDummySuperclass class >> methodReadingClassVarA [
^ classVarA
]

{ #category : #api }
GtCoderDummySuperclass >> methodInApiProtocol [
]

{ #category : #'methods reading slots' }
GtCoderDummySuperclass >> methodReadingStaticVarA [
^ staticVarA
]

{ #category : #'methods reading slots' }
GtCoderDummySuperclass >> methodReadingVarA [
^ varA
]

{ #category : #api }
GtCoderDummySuperclass >> methodWithSubclassResponsibility [
self subclassResponsibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,26 @@ GtCoderNavigationPackagesTagsClassesModelExamples >> navigateToClass_03_selectCl
self assert: (slotsToShow detect: [ :each| each name = #classVarA ]) isNotNil.
self assert: (slotsToShow detect: [ :each| each name = #staticVarA ]) isNotNil.

^ slotsToShow
^ aModel
]

{ #category : #'examples - navigate to class' }
GtCoderNavigationPackagesTagsClassesModelExamples >> navigateToClass_04_selectSlot [
<gtExample>
| aModel aSlotToSelect |


aModel := self navigateToClass_03_selectClass.

aSlotToSelect := aModel slotsToShow detect: [ :each | each name = #varA ].
aModel selectSlot: aSlotToSelect.

self assert: aModel hasSelectedProtocol not.
self assert: aModel hasSelectedMethod not.

self assert: aModel selectedSlot equals: aSlotToSelect.

^ aModel
]

{ #category : #'examples - navigate to extensions' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,21 @@ GtCoderNavigationPackagesTagsClassesModel >> privateJustSelectProtocol: aGtPharo
^ true
]

{ #category : #'private - selection' }
GtCoderNavigationPackagesTagsClassesModel >> privateJustSelectSlot: aSlot source: aSourceObject [
"Just select a slot a notify about the changes"
self
assert: [ aSlot isNotNil ]
description: [ 'Slot must not be nil' ].

selectedSlot = aSlot
ifTrue: [ ^ false ].

selectedSlot := aSlot.
self notifySlotSelected: aSlot source: aSourceObject.
^ true
]

{ #category : #'private - accessing' }
GtCoderNavigationPackagesTagsClassesModel >> privateProtocolOfMethod: aCompiledMethod [
| aProtocol |
Expand Down Expand Up @@ -898,11 +913,21 @@ GtCoderNavigationPackagesTagsClassesModel >> selectProtocol: aPharoProtocol sour
self notifyMethodsToShowChanged
]

{ #category : #'api - selection' }
GtCoderNavigationPackagesTagsClassesModel >> selectSlot: aSlot [
self
selectSlot: aSlot
source: self
]

{ #category : #'api - selection' }
GtCoderNavigationPackagesTagsClassesModel >> selectSlot: aSlot source: aSource [
selectedSlot := aSlot.
selectedProtocol := nil.
self notifySlotSelected: aSlot source: aSource
(self privateJustSelectSlot: aSlot source: aSource)
ifFalse: [ ^ self ].

self privateJustDeselectProtocol.
self deselectMethod.
self notifyMethodsToShowChanged.
]

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

0 comments on commit 7254593

Please sign in to comment.