[Pkg] SystemEditor: TraitEditor-mtf.14.mcz
squeak-dev-noreply at lists.squeakfoundation.org
squeak-dev-noreply at lists.squeakfoundation.org
Fri Nov 7 05:46:33 UTC 2008
A new version of TraitEditor was added to project SystemEditor:
http://www.squeaksource.com/SystemEditor/TraitEditor-mtf.14.mcz
==================== Summary ====================
Name: TraitEditor-mtf.14
Author: mtf
Time: 6 November 2008, 10:46:13 pm
UUID: 3467b3e4-f8d4-49fb-b5f7-5d6f4366bf93
Ancestors: TraitEditor-mtf.13
implement building the users list of a trait. Based on the refactoring of the subclasses list building refactor
=============== Diff against TraitEditor-mtf.13 ===============
Item was added:
+ ----- Method: TraitCompositionEditor>>system (in category 'accessing') -----
+ system
+ ^ parent system!
Item was added:
+ ----- Method: UserListDecorator>>for: (in category 'initialize-release') -----
+ for: aClassEditor
+ parent := aClassEditor.
+ additions := IdentitySet new.
+ removals := IdentitySet new.!
Item was added:
+ ----- Method: UserListDecorator>>subject (in category 'accessing') -----
+ subject
+ ^ subject ifNil: [subject := self parent subject ifNotNil: [self parent subject users]]!
Item was added:
+ ----- Method: UserListDecorator>>edBuild (in category 'building') -----
+ edBuild
+ | result |
+ result := self subject
+ ifNil: [IdentityDictionary new]
+ ifNotNil: [self subject users copy].
+ removals do: [:ea | result remove: ea product].
+ additions do: [:ea | result add: ea product].
+ ^ result!
Item was added:
+ ----- Method: UserListDecorator>>addUser: (in category 'accessing') -----
+ addUser: aClassEditor
+ additions add: aClassEditor.
+ removals remove: aClassEditor ifAbsent: [].!
Item was added:
+ ----- Method: TraitCompositionEditor>>edDependentsDo: (in category 'building') -----
+ edDependentsDo: aBlock
+ "Updates and enumerates the TraitEditors whose users list needs to be updated"
+
+ | oldTraits editor |
+ oldTraits := self subject
+ ifNil: [IdentitySet new]
+ ifNotNil: [self subject traits asIdentitySet].
+ self traitsOrEditorsDo: [:ea | ea edIsEditor
+ ifTrue: [ea addUser: self. aBlock value: ea]
+ ifFalse: [oldTraits remove: ea
+ ifAbsent: [editor := self system edEditorFor: ea.
+ editor addUser: self. aBlock value: editor]]].
+ oldTraits do: [:ea | editor := self system edEditorFor: ea.
+ editor removeUser: self. aBlock value: editor]!
Item was added:
+ ----- Method: TraitDescriptionEditor>>addUser: (in category 'reflecting') -----
+ addUser: anEditor
+ (self decorateWith: UserListDecorator) addUser: anEditor!
Item was changed:
----- Method: TraitCompositionEditor>>allTraitsOrEditorsDo: (in category 'accessing') -----
allTraitsOrEditorsDo: aBlock
+ self traitsOrEditorsDo: [:trait |
- transformations do: [:transformation | | trait |
- trait := self system classOrEditorFor: transformation trait.
aBlock value: trait.
trait hasTraitComposition
ifTrue: [trait traitComposition allTraitsOrEditorsDo: aBlock]]!
Item was changed:
AbstractEditor subclass: #TraitCompositionEditor
+ instanceVariableNames: 'subject transformations parent'
- instanceVariableNames: 'subject transformations'
classVariableNames: ''
poolDictionaries: ''
category: 'TraitEditor'!
!TraitCompositionEditor commentStamp: 'mtf 10/20/2008 11:22' prior: 0!
I store the new version of a TraitComposition. I don't use any kind of diff between the subject and product. For now at least, I don't use a TraitTransformationEditor, but use plain TraitTransforms which include TraitEditors
Unlike most editors, I am not persistent. Transient instances of myself are usually built, and only then is my subject and environment set. This is how TraitDescriptions work, so, that is how I work!
Item was added:
+ ----- Method: UserListDecorator>>removeUser: (in category 'accessing') -----
+ removeUser: aClassEditor
+ removals add: aClassEditor.
+ additions remove: aClassEditor ifAbsent: [].!
Item was added:
+ ----- Method: UserListDecorator>>edBuildInto: (in category 'building') -----
+ edBuildInto: aProduct
+ aProduct instVarNamed: #users put: self edBuild!
Item was added:
+ ----- Method: TraitCompositionEditor>>traitsOrEditorsDo: (in category 'accessing') -----
+ traitsOrEditorsDo: aBlock
+ self transformations do: [:transformation |
+ aBlock value: (self system classOrEditorFor: transformation trait)]!
Item was added:
+ ClassDecorator subclass: #UserListDecorator
+ instanceVariableNames: 'parent additions removals subject'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'TraitEditor'!
+
+ !UserListDecorator commentStamp: 'mtf 11/5/2008 13:45' prior: 0!
+ I edit the users list of a Trait!
Item was added:
+ ----- Method: TraitCompositionEditor>>setSubject:parent: (in category 'accessing') -----
+ setSubject: aTraitComposition parent: aClassEditor
+ subject := aTraitComposition.
+ parent := aClassEditor.!
Item was added:
+ ----- Method: UserListDecorator>>edPrepareMigration: (in category 'building') -----
+ edPrepareMigration: txn
+ self subject ifNil: [^ self].
+ txn addMigrator: (ObjectMigrator
+ origin: self subject
+ destination: self edBuild)!
Item was changed:
----- Method: PureBehaviorEditor>>setTraitComposition: (in category '*TraitEditor') -----
setTraitComposition: aTraitComposition
- | oldComposition |
(self hasTraitComposition not and: [aTraitComposition isEmpty]) ifTrue: [^self].
aTraitComposition
setSubject: (self subject ifNotNil: [self subject traitComposition])
parent: self.
+ self traitComposition: aTraitComposition!
- self traitComposition: aTraitComposition.
-
- oldComposition traits do: [:each | each removeUser: self].
- aTraitComposition traits do: [:each | each addUser: self]!
Item was added:
+ ----- Method: TraitCompositionDecorator>>edDependentsDo: (in category 'building') -----
+ edDependentsDo: aBlock
+ self traitComposition edDependentsDo: aBlock!
Item was added:
+ ----- Method: TraitDescriptionEditor>>removeUser: (in category 'reflecting') -----
+ removeUser: anEditor
+ (self decorateWith: UserListDecorator) removeUser: anEditor!
More information about the Packages
mailing list