--- a/CustomMenuBuilder.st Tue Dec 02 00:06:47 2014 +0100
+++ b/CustomMenuBuilder.st Tue Dec 02 00:07:35 2014 +0100
@@ -7,6 +7,7 @@
category:'Interface-Refactoring-Custom-UI'
!
+
!CustomMenuBuilder class methodsFor:'building'!
buildMenuForContext:context
@@ -24,49 +25,13 @@
!CustomMenuBuilder methodsFor:'building'!
-buildMenuForContext:context
- | menu generatorsAndRefactorings groups groupsMap |
-
- menu := Menu new.
- generatorsAndRefactorings := CustomManager current
- generatorsAndRefactoringsForPerspective:context perspective.
- "/ Now, group them by group.
- groupsMap := Dictionary new.
- groups := OrderedCollection new.
- generatorsAndRefactorings do:[:each |
- | group |
+buildMenuForContext: context
- group := each group.
- (groupsMap includesKey: group) ifTrue:[
- (groupsMap at: group) add: each.
- ] ifFalse:[
- groupsMap at: group put: (OrderedCollection with: each).
- groups add: group.
- ].
- ].
- groups sort: [ :a :b | a size = b size ifTrue:[ a size = 1 ifTrue:[true] ifFalse:[ | i | i := 1. [ i < a size and:[ (a at:i) = (b at:i) ] ] whileTrue:[i := i + 1 ]. (a at:i) < (b at:i) ] ] ifFalse:[a size < b size] ] .
- groups do:[:name |
- | items |
-
- items := groupsMap at: name.
- items sort:[ :a :b | a name < b name ].
- items do:[:each |
- | item |
-
- item := MenuItem label:each label
- itemValue:[ each executeInContextWithWaitCursor: context ].
- item enabled:[ each availableInContext:context ].
- menu addItem:item.
- ].
- ] separatedBy:[
- menu addSeparator.
- ].
- ^ menu
+ ^ self buildMenuForContext: context filter: [ true ]
"Created: / 26-01-2014 / 23:32:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 07-08-2014 / 23:18:19 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified (format): / 10-08-2014 / 09:29:14 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
"Modified: / 22-08-2014 / 19:04:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 02-12-2014 / 00:03:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
!
buildMenuForContext:context filter: filter
@@ -113,3 +78,10 @@
"Created: / 26-08-2014 / 10:13:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CustomMenuBuilder class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+