A new version of TraitEditor was added to project SystemEditor: http://www.squeaksource.com/SystemEditor/TraitEditor-mtf.10.mcz
==================== Summary ====================
Name: TraitEditor-mtf.10 Author: mtf Time: 15 October 2008, 6:36:28 pm UUID: d35f9358-9c86-49b8-a3b7-31549dc1bde5 Ancestors: TraitEditor-mtf.9
filled in more of TraitEditor. Trait committing now works through the validate and expand stages
=============== Diff against TraitEditor-mtf.9 ===============
Item was added: + ----- Method: PureBehaviorEditor>>edUsesTrait: (in category '*TraitEditor') ----- + edUsesTrait: aTraitEditor + self hasTraitComposition ifFalse: [^ false]. + self traitCompositionOrEditor traits do: [:ea | + ea == aTraitEditor ifTrue: [^ true]. + ea == aTraitEditor subject ifTrue: [^ true]]. + ^ false!
Item was added: + ----- Method: SystemEditor>>edUsersOrEditorsOf:do: (in category '*TraitEditor') ----- + edUsersOrEditorsOf: aTraitEditor do: aBlock + "Evaluate aBlock for each user of aTraitEditor, as either an editor (if it has changed), or as a class/trait (if it has not changed). Does not add any items to my additions list" + + | users | + users := aTraitEditor subject + ifNil: [IdentitySet new] + ifNotNilDo: [:trait | trait users]. + additions do: [:classEditor | {classEditor. classEditor class} do: [:ea | + users remove: ea subject ifAbsent: []. + (ea traitCompositionIncludes: aTraitEditor) ifTrue: [aBlock value: ea]]]. + removals do: [ :removedKey | users remove: (subject at: removedKey) ifAbsent: []]. + users do: aBlock!
Item was added: + ----- Method: TraitDescriptionEditor>>users (in category 'reflecting') ----- + users + ^ self environment edUsersOf: self!
Item was added: + ----- Method: PureBehaviorEditor>>traitCompositionOrEditor (in category '*TraitEditor') ----- + traitCompositionOrEditor + "Answers my traitComposition as either a TraitComposition (if it has not changed) or as an editor (if it has changed, or subject is nil)" + + ^ self propertyAt: #traitComposition ifAbsent: [self subject + ifNil: [self traitComposition] + ifNotNil: [self subject traitComposition]]!
Item was added: + ----- Method: TraitDescriptionEditor>>edExpandEditors (in category 'building') ----- + edExpandEditors + ^ self users collect: [:ea | ea theNonMetaClass]!
Item was added: + ----- Method: SystemEditor>>edUsersOf:do: (in category '*TraitEditor') ----- + edUsersOf: aTraitEditor do: aBlock + "Answers all users of aTraitEditor, as editors" + + self edUsersOrEditorsOf: aTraitEditor do: [:ea | aBlock value: (self edEditorFor: ea)]!
Item was changed: ----- Method: PureBehaviorEditor>>hasTraitComposition (in category '*TraitEditor') ----- hasTraitComposition + (self hasProperty: #traitComposition) ifTrue: [^ true]. + self subject ifNil: [^ false]. + ^ self subject hasTraitComposition! - ^ self traitComposition notNil!
Item was changed: ----- Method: PureBehaviorEditor>>traitComposition (in category '*TraitEditor') ----- traitComposition + "Answers an editor on my traitComposition, creating it if necessary" + + ^ self propertyAt: #traitComposition + ifAbsentPut: [TraitCompositionEditor + on: (self subject ifNotNil: [self subject traitComposition]) + for: self]! - ^ self propertyAt: #traitComposition ifAbsent: [nil]!
Item was added: + ----- Method: SystemEditor>>edUsersOrEditorsOf: (in category '*TraitEditor') ----- + edUsersOrEditorsOf: aTraitEditor + "Answer all users of aTraitEditor, as either an editor (if it has changed), or as a class/trait (if it has not changed). Does not add any items to my additions list" + + | collection | + collection := OrderedCollection new. + self edUsersOrEditorsOf: aTraitEditor do: [:ea | collection add: ea]. + ^ collection!
Item was added: + ----- Method: TraitDescriptionEditor>>validate (in category 'validating') ----- + validate + "Nothing to validate. Do nothing"!
Item was added: + ----- Method: PureBehaviorEditor>>traitCompositionIncludes: (in category '*TraitEditor') ----- + traitCompositionIncludes: aTraitEditor + ^ self == aTraitEditor or: [self edUsesTrait: aTraitEditor]!
Item was added: + ----- Method: SystemEditor>>edUsersOf: (in category '*TraitEditor') ----- + edUsersOf: aTraitEditor + "Answers all subclasses of aTraitEditor, as editors" + + ^ (self edUsersOrEditorsOf: aTraitEditor) collect: [:ea | self edEditorFor: ea]!
packages@lists.squeakfoundation.org