[Pkg] The Trunk: Tools-topa.564.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Mar 27 00:24:25 UTC 2015
Tobias Pape uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-topa.564.mcz
==================== Summary ====================
Name: Tools-topa.564
Author: topa
Time: 27 March 2015, 1:24:02.733 am
UUID: 8c4d15ea-663a-4c4e-b3c3-a31f6ac20214
Ancestors: Tools-topa.563
Amend to: Fix menu entry sort to actually match (intended) description
=============== Diff against Tools-topa.563 ===============
Item was changed:
----- Method: Browser>>classListMenuHook:shifted: (in category 'pluggable menus - hooks') -----
classListMenuHook: aMenu shifted: aBoolean
<classListMenu>
+ <menuPriority: 400>
^ self menuHook: aMenu named: #classListMenu shifted: aBoolean.
!
Item was changed:
----- Method: Browser>>messageCategoryMenuHook:shifted: (in category 'pluggable menus - hooks') -----
messageCategoryMenuHook: aMenu shifted: aBoolean
<messageCategoryMenu>
+ <menuPriority: 400>
^ self menuHook: aMenu named: #messageCategoryMenu shifted: aBoolean.
!
Item was changed:
----- Method: Browser>>messageListMenuHook:shifted: (in category 'pluggable menus - hooks') -----
messageListMenuHook: aMenu shifted: aBoolean
<messageListMenu>
+ <menuPriority: 400>
^ self menuHook: aMenu named: #messageListMenu shifted: aBoolean.
!
Item was changed:
----- Method: Browser>>systemCategoryMenuHook:shifted: (in category 'pluggable menus - hooks') -----
systemCategoryMenuHook: aMenu shifted: aBoolean
<systemCategoryMenu>
+ <menuPriority: 400>
^ self menuHook: aMenu named: #systemCategoryMenu shifted: aBoolean.
!
Item was changed:
----- Method: StringHolder>>buildMenu:withBuilders:shifted: (in category '*Tools-pluggable menus') -----
buildMenu: aMenu withBuilders: builders shifted: aBoolean
" We let every builder modify the menu.
The builder should indicate whether to abort by returning nil."
| menu |
menu := aMenu.
builders do: [:builder |
+ menu := self perform: builder method selector withEnoughArguments: { menu . aBoolean }.
- menu := self perform: builder method selector withEnoughArguments: { aMenu . aBoolean }.
menu ifNil: [^ aMenu]].
^ menu
!
Item was changed:
----- Method: StringHolder>>codePaneMenuHook:shifted: (in category '*Tools-pluggable menus - hooks') -----
codePaneMenuHook: aMenu shifted: aBoolean
<codePaneMenu>
+ <menuPriority: 400>
^ self menuHook: aMenu named: #codePaneMenu shifted: aBoolean.
!
Item was changed:
----- Method: StringHolder>>menu:for:shifted: (in category '*Tools-pluggable menus') -----
menu: aMenu for: aMenuSymbolOrCollection shifted: aBoolean
| builders |
+ builders := self menuBuildersFor: aMenuSymbolOrCollection in: self class shifted: aBoolean.
+ builders := self sortMenuBuilders: builders.
- builders := self menuBuildersFor: aMenuSymbolOrCollection in: self class.
- builders := aBoolean
- ifTrue: [builders reject: [:builder | builder arguments = #(false)]]
- ifFalse: [builders reject: [:builder | builder arguments = #(true)]].
-
^ self buildMenu: aMenu withBuilders: builders shifted: aBoolean
!
Item was removed:
- ----- Method: StringHolder>>menuBuildersFor:in: (in category '*Tools-pluggable menus') -----
- menuBuildersFor: someMenus in: aClass
- "Find all builders and sort them by
- 1. Priority (default 500)
- 2. selector name
- 3. inheritance
- "
- ^ (self menuPragmasFor: someMenus in: aClass) sorted: [:a :b |
- |ma mb pa pb|
- ma := a method.
- mb := b method.
- pa := self methodMenuPriority: ma.
- pb := self methodMenuPriority: mb.
- pa <= pb or: [
- pa = pb and: [
- ma selector <= mb selector and: [
- mb methodClass inheritsFrom: ma methodClass]]]]
- !
Item was added:
+ ----- Method: StringHolder>>menuBuildersFor:in:shifted: (in category '*Tools-pluggable menus') -----
+ menuBuildersFor: someMenus in: aClass shifted: aBoolean
+ "Find all builders but reject the ones not matching the shift state "
+ | pragmas |
+ pragmas := (self menuPragmasFor: someMenus in: aClass) .
+ ^ aBoolean
+ ifTrue: [pragmas reject: [:builder | builder arguments = #(false)]]
+ ifFalse: [pragmas reject: [:builder | builder arguments = #(true)]].
+ !
Item was added:
+ ----- Method: StringHolder>>sortMenuBuilders: (in category '*Tools-pluggable menus') -----
+ sortMenuBuilders: builders
+ " Sort them by
+ 1. Priority (default 500)
+ 2. selector name
+ "
+ ^ builders sorted: [:a :b |
+ | ma mb pa pb |
+ ma := a method.
+ mb := b method.
+ pa := self methodMenuPriority: ma.
+ pb := self methodMenuPriority: mb.
+ pa < pb or: [pa = pb and: [ma selector <= mb selector]]]
+ !
More information about the Packages
mailing list