Skip to content

Commit

Permalink
Updates for Pharo 12
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed May 7, 2024
1 parent 1942565 commit c6e0eb8
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 126 deletions.
69 changes: 50 additions & 19 deletions repository/OpenPonk-Model/OPAnnouncableObject.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,66 @@ I am above the topmost model element to provide convenient announcer access.
Maybe I should be a Trait in the Element instead?
"
Class {
#name : #OPAnnouncableObject,
#superclass : #Object,
#name : 'OPAnnouncableObject',
#superclass : 'Object',
#instVars : [
'announcer'
],
#category : 'OpenPonk-Model-ModelObjects'
#category : 'OpenPonk-Model-ModelObjects',
#package : 'OpenPonk-Model',
#tag : 'ModelObjects'
}

{ #category : #ston }
{ #category : 'ston' }
OPAnnouncableObject class >> stonAllInstVarNames [
^ super stonAllInstVarNames copyWithout: #announcer
]

{ #category : #announcing }
{ #category : 'announcing' }
OPAnnouncableObject >> announce: anAnnouncement [
self announcer announce: anAnnouncement
]

{ #category : #announcing }
{ #category : 'announcing' }
OPAnnouncableObject >> announceAdded: anElement [
self announce: (OPElementAdded element: anElement).
self changed
]

{ #category : #announcing }
{ #category : 'announcing' }
OPAnnouncableObject >> announceChanged: anElement [
self announce: (OPElementChanged element: anElement)
]

{ #category : #announcing }
{ #category : 'announcing' }
OPAnnouncableObject >> announceRemoved: anElement [
self announce: (OPElementRemoved element: anElement).
anElement announce: (OPElementRemoved element: anElement).
self changed
]

{ #category : #accessing }
{ #category : 'accessing' }
OPAnnouncableObject >> announcer [
announcer ifNil: [ self announcer: Announcer new ].
^ announcer
]

{ #category : #accessing }
{ #category : 'accessing' }
OPAnnouncableObject >> announcer: anAnnouncer [
announcer := anAnnouncer
]

{ #category : #announcing }
{ #category : 'announcing' }
OPAnnouncableObject >> changed [
self announceChanged: self
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPAnnouncableObject >> fuelIgnoredInstanceVariableNames [
^ #(#announcer)
]

{ #category : #'announcement registration' }
{ #category : 'announcement registration' }
OPAnnouncableObject >> silentlyDo: aBlock [
| oldAnnouncer |
oldAnnouncer := announcer.
Expand All @@ -70,17 +72,46 @@ OPAnnouncableObject >> silentlyDo: aBlock [
announcer := oldAnnouncer
]

{ #category : #'announcement registration' }
OPAnnouncableObject >> when: anEvent do: aBlock [
self announcer when: anEvent do: aBlock
{ #category : 'announcement registration' }
OPAnnouncableObject >> when: anAnnouncementClass do: aValuable [

| subscriberForDeprecation |
aValuable receiver ifNil: [
self error:
'You must specify a subscriber object for this subscription. Please use #when:do:for: method.' ].

subscriberForDeprecation := thisContext sender receiver
= aValuable receiver
ifTrue: [ 'self' ]
ifFalse: [ '`@arg2 receiver' ].
self
deprecated:
'Since there are some block closures (Clean and Constant) without a receiver, the API of announcements was changed to send the subscriber explicitly.
We are deprecating this method because it was asking for the receiver of the block to use it as the subscriber.'
transformWith: '`@receiver when: `@arg1 do: `@arg2'
->
('`@receiver when: `@arg1 do: `@arg2 for: '
, subscriberForDeprecation).

^ self
when: anAnnouncementClass
do: aValuable
for: aValuable receiver
]

{ #category : #'announcement registration' }
{ #category : 'announcement registration' }
OPAnnouncableObject >> when: anEvent do: aBlock for: aReceiver [

self announcer when: anEvent do: aBlock for: aReceiver
]

{ #category : 'announcement registration' }
OPAnnouncableObject >> when: anAnnouncementClass send: aSelector to: anObject [
self announcer when: anAnnouncementClass send: aSelector to: anObject
]

{ #category : #'announcement registration' }
{ #category : 'announcement registration' }
OPAnnouncableObject >> whenChanged: aBlock [
self when: OPElementChanged do: aBlock

self when: OPElementChanged do: aBlock for: aBlock receiver
]
22 changes: 12 additions & 10 deletions repository/OpenPonk-Model/OPDirectedAssociation.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,54 @@
A DCEdge represents a oriented binary connection between two model objects.
"
Class {
#name : #OPDirectedAssociation,
#superclass : #OPModelObject,
#name : 'OPDirectedAssociation',
#superclass : 'OPModelObject',
#instVars : [
'source',
'target'
],
#category : 'OpenPonk-Model-ModelObjects'
#category : 'OpenPonk-Model-ModelObjects',
#package : 'OpenPonk-Model',
#tag : 'ModelObjects'
}

{ #category : #'instance creation' }
{ #category : 'instance creation' }
OPDirectedAssociation class >> from: aSourceObject to: aTargetObject [
^ self new
from: aSourceObject to: aTargetObject;
yourself
]

{ #category : #'instance creation' }
{ #category : 'instance creation' }
OPDirectedAssociation class >> from: aSourceObject to: aTargetObject named: aString [
^ self new
from: aSourceObject to: aTargetObject;
name: aString;
yourself
]

{ #category : #'instance creation' }
{ #category : 'instance creation' }
OPDirectedAssociation >> from: aSourceObject to: aTargetObject [
self source: aSourceObject.
self target: aTargetObject
]

{ #category : #accessing }
{ #category : 'accessing' }
OPDirectedAssociation >> source [
^ source
]

{ #category : #accessing }
{ #category : 'accessing' }
OPDirectedAssociation >> source: aModelObject [
source := aModelObject
]

{ #category : #accessing }
{ #category : 'accessing' }
OPDirectedAssociation >> target [
^ target
]

{ #category : #accessing }
{ #category : 'accessing' }
OPDirectedAssociation >> target: aModelObject [
target := aModelObject
]
8 changes: 5 additions & 3 deletions repository/OpenPonk-Model/OPElementAdded.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ I am an event where an element has been added.
"
Class {
#name : #OPElementAdded,
#superclass : #OPModelElementEvent,
#category : 'OpenPonk-Model-Announcements'
#name : 'OPElementAdded',
#superclass : 'OPModelElementEvent',
#category : 'OpenPonk-Model-Announcements',
#package : 'OpenPonk-Model',
#tag : 'Announcements'
}
8 changes: 5 additions & 3 deletions repository/OpenPonk-Model/OPElementChanged.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
I get announced when an element has changed (name, parameters and such).
"
Class {
#name : #OPElementChanged,
#superclass : #OPModelElementEvent,
#category : 'OpenPonk-Model-Announcements'
#name : 'OPElementChanged',
#superclass : 'OPModelElementEvent',
#category : 'OpenPonk-Model-Announcements',
#package : 'OpenPonk-Model',
#tag : 'Announcements'
}
8 changes: 5 additions & 3 deletions repository/OpenPonk-Model/OPElementRemoved.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ I am an event where an element has been removed.
"
Class {
#name : #OPElementRemoved,
#superclass : #OPModelElementEvent,
#category : 'OpenPonk-Model-Announcements'
#name : 'OPElementRemoved',
#superclass : 'OPModelElementEvent',
#category : 'OpenPonk-Model-Announcements',
#package : 'OpenPonk-Model',
#tag : 'Announcements'
}
8 changes: 5 additions & 3 deletions repository/OpenPonk-Model/OPEvent.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
I am a base class for all DynaCASE events.
"
Class {
#name : #OPEvent,
#superclass : #Announcement,
#category : 'OpenPonk-Model-Announcements'
#name : 'OPEvent',
#superclass : 'Announcement',
#category : 'OpenPonk-Model-Announcements',
#package : 'OpenPonk-Model',
#tag : 'Announcements'
}
16 changes: 9 additions & 7 deletions repository/OpenPonk-Model/OPMComment.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,34 @@
I am a comment associated with an element.
"
Class {
#name : #OPMComment,
#superclass : #Object,
#name : 'OPMComment',
#superclass : 'Object',
#instVars : [
'body'
],
#category : 'OpenPonk-Model-ModelObjects'
#category : 'OpenPonk-Model-ModelObjects',
#package : 'OpenPonk-Model',
#tag : 'ModelObjects'
}

{ #category : #'instance creation' }
{ #category : 'instance creation' }
OPMComment class >> body: aString [
^ self new
body: aString;
yourself
]

{ #category : #testing }
{ #category : 'testing' }
OPMComment class >> isDeprecated [
^ true
]

{ #category : #accessing }
{ #category : 'accessing' }
OPMComment >> body [
^ body
]

{ #category : #accessing }
{ #category : 'accessing' }
OPMComment >> body: aString [
body := aString
]
10 changes: 6 additions & 4 deletions repository/OpenPonk-Model/OPMElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
I represent the base class of all model elements.
"
Class {
#name : #OPMElement,
#superclass : #OPModelObject,
#category : #'OpenPonk-Model-ModelObjects'
#name : 'OPMElement',
#superclass : 'OPModelObject',
#category : 'OpenPonk-Model-ModelObjects',
#package : 'OpenPonk-Model',
#tag : 'ModelObjects'
}

{ #category : #testing }
{ #category : 'testing' }
OPMElement class >> isDeprecated [
"There is no difference between types of elements. Use OPModelObject instead (or don't use any class of this package)"

Expand Down
8 changes: 5 additions & 3 deletions repository/OpenPonk-Model/OPModelContentReplaced.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
I am an event that gets fired when the content of the associated model has changed so much that full rebuild is warrented.
"
Class {
#name : #OPModelContentReplaced,
#superclass : #OPModelEvent,
#category : 'OpenPonk-Model-Announcements'
#name : 'OPModelContentReplaced',
#superclass : 'OPModelEvent',
#category : 'OpenPonk-Model-Announcements',
#package : 'OpenPonk-Model',
#tag : 'Announcements'
}
10 changes: 6 additions & 4 deletions repository/OpenPonk-Model/OPModelElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
A DCNamedElement represents all possible elements of diagram (such as classes, states, associations). s
"
Class {
#name : #OPModelElement,
#superclass : #OPModelObject,
#category : 'OpenPonk-Model-ModelObjects'
#name : 'OPModelElement',
#superclass : 'OPModelObject',
#category : 'OpenPonk-Model-ModelObjects',
#package : 'OpenPonk-Model',
#tag : 'ModelObjects'
}

{ #category : #testing }
{ #category : 'testing' }
OPModelElement class >> isDeprecated [
"There is no difference between types of elements. Use OPModelObject instead (or don't use any class of this package)"

Expand Down
14 changes: 8 additions & 6 deletions repository/OpenPonk-Model/OPModelElementEvent.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@
I am a base class for model element events. I am announced when the element changes.
"
Class {
#name : #OPModelElementEvent,
#superclass : #OPModelEvent,
#name : 'OPModelElementEvent',
#superclass : 'OPModelEvent',
#instVars : [
'element'
],
#category : 'OpenPonk-Model-Announcements'
#category : 'OpenPonk-Model-Announcements',
#package : 'OpenPonk-Model',
#tag : 'Announcements'
}

{ #category : #'instance creation' }
{ #category : 'instance creation' }
OPModelElementEvent class >> element: anElement [
^ self new
element: anElement;
yourself
]

{ #category : #accessing }
{ #category : 'accessing' }
OPModelElementEvent >> element [
^ element
]

{ #category : #accessing }
{ #category : 'accessing' }
OPModelElementEvent >> element: anElement [
element := anElement
]
Loading

0 comments on commit c6e0eb8

Please sign in to comment.