-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a custom class builder that signals class changes once [feenkcom/…
- Loading branch information
1 parent
4a527c9
commit a4cb489
Showing
5 changed files
with
87 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Extension { #name : #FluidBuilder } | ||
|
||
{ #category : #'*GToolkit-Pharo-Extensions' } | ||
FluidBuilder >> install [ | ||
<gtPharoPatch: #Pharo> | ||
"Install the class in the system environment" | ||
|
||
^ GtShiftClassInstaller new makeWithBuilder: self shiftClassBuilder | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Extension { #name : #SmalltalkImage } | ||
|
||
{ #category : #'*GToolkit-Pharo-Extensions' } | ||
SmalltalkImage >> classInstaller [ | ||
<gtPharoPatch: #Pharo> | ||
"Answer the class responsible of creating classes in the system." | ||
|
||
^ GtShiftClassInstaller | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Class { | ||
#name : #GtClassRecompiled, | ||
#superclass : #ClassAnnouncement, | ||
#instVars : [ | ||
'classAffected' | ||
], | ||
#category : #'GToolkit-Pharo-Index' | ||
} | ||
|
||
{ #category : #accessing } | ||
GtClassRecompiled >> classAffected [ | ||
^ classAffected | ||
] | ||
|
||
{ #category : #accessing } | ||
GtClassRecompiled >> classAffected: aClass [ | ||
classAffected := aClass | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Class { | ||
#name : #GtShiftClassInstaller, | ||
#superclass : #ShiftClassInstaller, | ||
#category : #'GToolkit-Pharo-Index' | ||
} | ||
|
||
{ #category : #accessing } | ||
GtShiftClassInstaller >> make [ | ||
| newClass | | ||
|
||
self lookupOldClass. | ||
|
||
[ | ||
builder oldClass: oldClass. | ||
self copyClassSlotsFromExistingClass. | ||
newClass := builder build. | ||
|
||
self installInEnvironment: newClass. | ||
|
||
self installSubclassInSuperclass: newClass. | ||
|
||
builder builderEnhancer beforeMigratingClass: builder installer: self. | ||
|
||
builder builderEnhancer migrateToClass: newClass installer: self. | ||
|
||
builder builderEnhancer afterMigratingClass: builder installer: self. | ||
|
||
builder builderEnhancer propagateChangesToRelatedClasses: newClass installer: self. | ||
"Add this to the superclass implementation" | ||
SystemAnnouncer uniqueInstance | ||
announce: (GtClassRecompiled new classAffected: newClass) . | ||
] on: ShNoChangesInClass do:[ | ||
"If there are no changes in the building, I am not building or replacing nothing" | ||
newClass := oldClass. | ||
]. | ||
|
||
self fixSlotScope: newClass. | ||
self fixSlotScope: newClass class. | ||
|
||
self recategorize: newClass to: builder category. | ||
self comment: newClass. | ||
|
||
self notifyChanges. | ||
|
||
^ newClass | ||
] |