Skip to content

Commit

Permalink
Fix browser deprecations in Pharo 11
Browse files Browse the repository at this point in the history
  • Loading branch information
marschall committed Jul 6, 2024
1 parent 3074c69 commit 1cd0101
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ contents
selectedMessageCategory isNil
ifTrue: [
"class definition"
self selectedClass definition ]
(self selectedClass respondsTo: #definitionString)
ifTrue: [ self selectedClass definitionString ]
ifFalse: [ self selectedClass definition ] ]

Check warning on line 21 in repository/Seaside-Pharo-Development.package/WARPackageBasedBrowser.class/instance/contents.st

View check run for this annotation

Codecov / codecov/patch

repository/Seaside-Pharo-Development.package/WARPackageBasedBrowser.class/instance/contents.st#L19-L21

Added lines #L19 - L21 were not covered by tests
ifFalse: [
"method template"
self selectedClass sourceCodeTemplate ] ] ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ messageCategoryList
| all categories unclassified |
all := #'-- all --'. "AllProtocol defaultName is fucked in Pharo 2.0"
self selectedClass ifNil: [ ^ Array with: all ].
categories := self selectedClass organization categories.
categories := (self selectedClass respondsTo: #protocolNames)
ifTrue: [ self selectedClass protocolNames ]
ifFalse: [ self selectedClass organization categories ].
(categories notEmpty and: [ categories first = all ]) ifFalse: [ "all is only in 3.0+"
categories := (Array with: all) , categories ].
unclassified := Protocol unclassified. "#unclassified only in 3.0+"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ messageList
ifTrue: [ #() ]
ifFalse: [ self selectedClass selectors ] ]
ifFalse: [
| organization organizer |
organization := self selectedClass organization.
organizer := (organization respondsTo: #protocolOrganizer) "Only in Pharo 3.0+"
ifTrue: [ organization protocolOrganizer ]
ifFalse: [
| classOrganization |
classOrganization := Smalltalk globals class name hasClassNamed: 'ClassOrganization'.
(classOrganization importFrom: self selectedClass organization) protocolOrganizer ].
organizer methodsInProtocolNamed: selectedMessageCategory ]) sorted
(self selectedClass respondsTo: #selectorsInProtocol:)
ifTrue: [ self selectedClass selectorsInProtocol: selectedMessageCategory ]
ifFalse: [
| organization organizer |
organization := self selectedClass organization.
organizer := (organization respondsTo: #protocolOrganizer) "Only in Pharo 3.0+"
ifTrue: [ organization protocolOrganizer ]
ifFalse: [
| classOrganization |
classOrganization := Smalltalk globals class name classNamed: 'ClassOrganization'.
(classOrganization importFrom: self selectedClass organization) protocolOrganizer ].
organizer methodsInProtocolNamed: selectedMessageCategory ] ]) sorted

Check warning on line 20 in repository/Seaside-Pharo-Development.package/WARPackageBasedBrowser.class/instance/messageList.st

View check run for this annotation

Codecov / codecov/patch

repository/Seaside-Pharo-Development.package/WARPackageBasedBrowser.class/instance/messageList.st#L9-L20

Added lines #L9 - L20 were not covered by tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
private
packageNameOf: aPackage
^ (aPackage respondsTo: #name)
ifTrue: [ aPackage name ]
ifFalse: [ aPackage packageName ]
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
private
packages
^ (Smalltalk at: #RPackage) organizer packages
| rPackage |
rPackage := Smalltalk at: #RPackage.
^ ((rPackage respondsTo: #packageOrganizer)
ifTrue: [ rPackage packageOrganizer ]
ifFalse: [ rPackage organizer ]) packages
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ selectedClass
| class |
class := selectedClass.
(class notNil and: [ showInstance not ]) ifTrue: [
class := class theMetaClass ].
class := (class respondsTo: #classSide)
ifTrue: [ class classSide ]
ifFalse: [ class theMetaClass ] ].
^ class
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
accessing
systemCategoryList
^ (self packages
collect: [ :each | each packageName ])
sorted

^ (self packages collect: [ :each | (self packageNameOf: each) ]) sorted
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
accessing
systemCategoryListIndex: anInteger
selectedPackage := ((self packages
sorted: [ :a :b | a packageName <= b packageName ]) at: anInteger).
sorted: [ :a :b | (self packageNameOf: a) <= (self packageNameOf: b) ]) at: anInteger).
selectedClass := nil.
self clearMessageAndProtoclSelection.
self changed: #systemCategoryListIndex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
systemCategoryListIndex
^ (self packages
sorted: [ :a :b | a packageName <= b packageName ])
sorted: [ :a :b | (self packageNameOf: a) <= (self packageNameOf: b) ])

Check warning on line 4 in repository/Seaside-Pharo-Development.package/WARPackageBasedBrowser.class/instance/systemCategoryListIndex.st

View check run for this annotation

Codecov / codecov/patch

repository/Seaside-Pharo-Development.package/WARPackageBasedBrowser.class/instance/systemCategoryListIndex.st#L4

Added line #L4 was not covered by tests
indexOf: selectedPackage
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
SystemOrganization addCategory: #'Seaside-Pharo-Development'!
SystemOrganization addCategory: #'Seaside-Pharo-Development-Core'!
SystemOrganization addCategory: #'Seaside-Pharo-Development-Core-Plugins'!
SystemOrganization addCategory: #'Seaside-Pharo-Development-Core-Profiler'!
self packageOrganizer ensurePackage: #'Seaside-Pharo-Development' withTags: #(#Core #'Core-Plugins' #'Core-Profiler')!

0 comments on commit 1cd0101

Please sign in to comment.