# HG changeset patch # User Claus Gittinger # Date 1453492264 -3600 # Node ID bce10645c75d6cef6391220c07a41aef74f07678 # Parent 17352a9e9eaafb8ce789e9f67f686427a89e1a1e #REFACTORING class: Tools::MethodList changed: #selectedMethodsChanged diff -r 17352a9e9eaa -r bce10645c75d Tools__MethodList.st --- a/Tools__MethodList.st Fri Jan 22 20:50:38 2016 +0100 +++ b/Tools__MethodList.st Fri Jan 22 20:51:04 2016 +0100 @@ -720,12 +720,12 @@ methods := methodList ? #(). methods size == 0 ifTrue:[ - "/ this may happen during early startup, - "/ when invoked with a preset methodSelection, - "/ and the methodGenerator has not yet been setup - "/ to not clobber the selection, defer the update - "/ until the methodList arrives ... - ^ self + "/ this may happen during early startup, + "/ when invoked with a preset methodSelection, + "/ and the methodGenerator has not yet been setup + "/ to not clobber the selection, defer the update + "/ until the methodList arrives ... + ^ self ]. selectedMethodsHolder := self selectedMethods. @@ -734,32 +734,33 @@ "/ check if all is selected (likely) ((selectedMethods size == methodList size) and:[selectedMethods = methodList]) ifTrue:[ - indices := (1 to:selectedMethods size) + indices := (1 to:selectedMethods size) ] ifFalse:[ - selectedMethods size > 100 ifTrue:[ - "/ check if all is selected (likely) - ((selectedMethods size == methodList size) - and:[selectedMethods = methodList]) ifTrue:[ - indices := (1 to:selectedMethods size) - ] ifFalse:[ - "/ for big collections, generate a reverse map - reverseMap := IdentityDictionary new. - methods keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. - indices := selectedMethods collect:[:eachSelectedMethod | - reverseMap at:eachSelectedMethod ifAbsent:0 - ] - ] - ] ifFalse:[ - indices := (selectedMethods ? #()) collect:[:eachSelectedMethod | - methods identityIndexOf:eachSelectedMethod. - ] - ]. - indices := indices select:[:idx | idx ~= 0]. + selectedMethods size > 100 ifTrue:[ + "/ check if all is selected (likely) + ((selectedMethods size == methodList size) + and:[selectedMethods = methodList]) ifTrue:[ + indices := (1 to:selectedMethods size) + ] ifFalse:[ + "/ for big collections, generate a reverse map + reverseMap := IdentityDictionary new. + methods keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. + indices := selectedMethods + collect:[:eachSelectedMethod | + reverseMap at:eachSelectedMethod ifAbsent:0] + thenSelect:[:idx | idx ~~ 0] + ] + ] ifFalse:[ + indices := (selectedMethods ? #()) + collect:[:eachSelectedMethod | + methods identityIndexOf:eachSelectedMethod] + thenSelect:[:idx | idx ~~ 0] + ]. ]. selectedMethodNameIndicesHolder := self selectedMethodNameIndices. selectedMethodNameIndicesHolder value ~= indices ifTrue:[ - selectedMethodNameIndicesHolder value:indices. + selectedMethodNameIndicesHolder value:indices. ] !