The Trunk: System-mt.706.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-mt.706.mcz

commits-2
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.706.mcz

==================== Summary ====================

Name: System-mt.706
Author: mt
Time: 27 February 2015, 11:45:09.18 am
UUID: 3175d70c-e137-1b40-91aa-4df3c1228235
Ancestors: System-mt.705

Re-activated possibility to have multiple categories for a single preference. Worked for old-style preferences, now works again for pragma-style preferences. Use #categoryList: instead of #category: in the pragma and provide an array of strings (or symbols).

=============== Diff against System-mt.705 ===============

Item was changed:
  ----- Method: Preferences class>>prefEvent: (in category 'dynamic preferences') -----
  prefEvent: anEvent
  "Check if this system event defines or removes a preference.
  TODO: Queue the event and handle in background process.
  There is zero reason to be so eager here."
  | aClass aSelector prefSymbol method |
  (anEvent itemKind = SystemChangeNotifier classKind and: [anEvent isRemoved])
  ifTrue:[self removePreferencesFor: anEvent item].
  anEvent itemKind = SystemChangeNotifier methodKind ifTrue:[
  aClass := anEvent itemClass.
  aClass isMeta ifFalse:[^self]. "ignore instance methods"
  aClass := aClass theNonMetaClass.
  aSelector := anEvent itemSelector.
  (anEvent isRemoved or:[anEvent isModified]) ifTrue:[
  prefSymbol := (aClass name,'>>', aSelector) asSymbol.
  self accessDictionaryOfPreferencesIn: [ :dictionaryOfPreferences |
  dictionaryOfPreferences removeKey: prefSymbol ifAbsent:[] ] ].
  (anEvent isAdded or:[anEvent isModified]) ifTrue:[
  method := anEvent item.
  method pragmas do:[:pragma| | aPreference aPrefSymbol |
+ ((pragma keyword == #preference:category:description:type:)
+ or: [pragma keyword == #preference:categoryList:description:type:]) ifTrue:[
+ aPrefSymbol := (aClass name,'>>', method selector) asSymbol.
+ aPreference := self
+ preference: pragma arguments first
+ category: pragma arguments second
+ description: pragma arguments third
+ type: pragma arguments fourth.
+ aPreference
+ provider: aClass
+ getter: method selector
+ setter: method selector asMutator.
+ self accessDictionaryOfPreferencesIn: [ :dictionaryOfPreferences |
+ dictionaryOfPreferences at: aPrefSymbol put: aPreference ] ] ] ] ].
- pragma keyword == #preference:category:description:type: ifTrue:[
- aPrefSymbol := (aClass name,'>>', method selector) asSymbol.
- aPreference := self
- preference: pragma arguments first
- category: pragma arguments second
- description: pragma arguments third
- type: pragma arguments fourth.
- aPreference
- provider: aClass
- getter: method selector
- setter: method selector asMutator.
- self accessDictionaryOfPreferencesIn: [ :dictionaryOfPreferences |
- dictionaryOfPreferences at: aPrefSymbol put: aPreference ] ] ] ] ].
  !