The Trunk: Services-Base-nice.40.mcz

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

The Trunk: Services-Base-nice.40.mcz

commits-2
Nicolas Cellier uploaded a new version of Services-Base to project The Trunk:
http://source.squeak.org/trunk/Services-Base-nice.40.mcz

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

Name: Services-Base-nice.40
Author: nice
Time: 27 December 2009, 3:55:52 am
UUID: b28b56f1-acb0-4d33-bbf1-4ae45b2927d0
Ancestors: Services-Base-ul.39

Cosmetic: move or remove a few temps inside closures

=============== Diff against Services-Base-ul.39 ===============

Item was changed:
  ----- Method: ServiceRegistry class>>methodChanged: (in category 'as yet unclassified') -----
  methodChanged: event
- | cls |
  self ifInteractiveDo: [
+ | cls |
  cls := event itemClass.
  ((event changeKind = #removed) not & (cls inheritsFrom: ServiceProvider) and: [cls new services includes: event itemSelector])
  ifTrue: [[self current addService: (cls new performAndSetId: event itemSelector)
  provider: cls]
  on: Error do: [self inform: 'Service format seems to be incorrect']]]!

Item was changed:
  ----- Method: ServiceGui class>>updateBar: (in category 'registering button bars') -----
  updateBar: cat
+
- | newBar |
  self bars
  select: [:assoc | (assoc key id = cat id) & assoc value notNil]
+ thenDo: [:assoc | | newBar |
- thenDo: [:assoc |
  cat requestor: assoc key requestor.
  newBar := self new buttonBarFor: cat.
  assoc value removeAllMorphs.
  newBar submorphsDo: [:m | assoc value addMorphBack: m]]!

Item was changed:
  ----- Method: ServiceGui class>>updateBars (in category 'registering button bars') -----
  updateBars
+
+ self bars do: [:assoc | | oldCat cat newBar bar |
- | cat newBar bar oldCat |
- self bars do: [:assoc |
  (bar := assoc value) ifNotNil: [
  oldCat := assoc key.
  cat := oldCat id service.
  cat requestor: oldCat requestor.
  newBar := self new buttonBarFor: cat.
  bar removeAllMorphs.
  newBar submorphsDo: [:m | bar addMorphBack: m]].
  ]!

Item was changed:
  ----- Method: ServiceRegistry>>build (in category 'building') -----
  build
  "ServicePreferences wipe."
- | pr |
  self
+ beNotInteractiveDuring: [
+ | pr |
+ ServiceProvider registeredProviders
- beNotInteractiveDuring: [ServiceProvider registeredProviders
  do: [:p | p registeredServices
  do: [:each | self addService: each provider: p class]].
  pr := ServiceProvider registeredProviders
  gather: [:p | p savedPreferences].
  ServicePreferences replayPreferences: pr.
  ].
  ServiceGui updateBars.
  ServiceShortcuts setPreferences!

Item was changed:
  ----- Method: ServiceProvider>>savePreferencesFor: (in category 'persistence') -----
  savePreferencesFor: aService
+
- | strm |
  "pref := ServicePreferences preferenceAt: aService shortcutPreference.
  strm := WriteStream with: ''.
  strm nextPutAll: aService id;
  nextPutAll: 'shortcut';
  cr;
  tab;
  nextPutAll: '^ ';
  nextPutAll: {pref name. pref preferenceValue. 1000} storeString.
  self class compileSilently: strm contents classified: 'saved preferences'."
  aService isCategory
  ifTrue: [aService externalPreferences
+ doWithIndex: [:e :i | | strm |
- doWithIndex: [:e :i |
  strm := WriteStream with: aService id asString.
  strm nextPutAll: e id asString;
  cr;
  tab;
  nextPutAll: '^ ';
  nextPutAll: {aService childrenPreferences. e id. i} storeString.
  e provider class compileSilently: strm contents classified: 'saved preferences']]!

Item was changed:
  ----- Method: ServicePreferences class>>replayPreferences: (in category 'replaying') -----
  replayPreferences: preferences
+ | s |
- | s v |
  s := SortedCollection new
  sortBlock: [:a :b | a last < b last].
  s addAll: preferences;
  reSort.
  s
+ do: [:e | | v |
- do: [:e |
  v := self valueOfPreference: e first ifAbsent: ''.
  self setPreference: e first toValue: (v
  ifEmpty: ['']
  ifNotEmpty: [v , ' '])
  , e second]!