Tools_MethodList.st
changeset 12567 9a6d91db7d07
parent 12554 79d13f7b87c0
child 12632 1c4918897dab
--- a/Tools_MethodList.st	Thu Mar 28 17:59:09 2013 +0100
+++ b/Tools_MethodList.st	Thu Mar 28 18:22:01 2013 +0100
@@ -1403,84 +1403,80 @@
     selectedMethodsHolder := self selectedMethods.
     prevSelection := selectedMethodsHolder value ? #().
 
-    prevClasses := classes ifNil:[ #() ] ifNotNil:[ classes copy ].
+    prevClasses := classes isNil ifTrue:[ #() ] ifFalse:[ classes copy ].
 
     oldListSize := self browserNameList size.
 
-        self topApplication withWaitCursorDo:[
-            newList := self listOfMethodNames.
-        ].
-        newListSize := newList size.
-        sameContents := self updateListFor:newList.
+    self topApplication withWaitCursorDo:[
+        newList := self listOfMethodNames.
+    ].
+    newListSize := newList size.
+    sameContents := self updateListFor:newList.
 
-        sameContents ifFalse:[
-    "/            self browserNameList value:newList.
+    sameContents ifFalse:[
+"/      self browserNameList value:newList.
 
-            (prevSelection size == 0 
-            and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[
-                "/ this happens during early startup time,
-                "/ when the selection is already (pre-)set,
-                "/ and the methodList is generated the first time
-                "/ (i.e. when opened with preset selection
+        (prevSelection size == 0 
+        and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[
+            "/ this happens during early startup time,
+            "/ when the selection is already (pre-)set,
+            "/ and the methodList is generated the first time
+            "/ (i.e. when opened with preset selection
 
-                "/ do not clobber the selection in this case.
-                prevSelection := selectedMethodsHolder value.
-            ].
+            "/ do not clobber the selection in this case.
+            prevSelection := selectedMethodsHolder value.
+        ].
 
-            (methodList size == 0 or:[prevSelection size == 0]) ifTrue:[
-                newSelection := #()
-            ] ifFalse:[
-                methodSet := methodList.
+        (methodList size == 0 or:[prevSelection size == 0]) ifTrue:[
+            newSelection := #()
+        ] ifFalse:[
+            methodSet := methodList.
 
-                "/ inclusion test is much faster with sets, if the number of items is large
-                methodList size > 30 ifTrue:[
-                    "/ however, only if its worth building the set ...
-                    prevSelection size > 5 ifTrue:[
-                        methodSet := methodSet asIdentitySet.
-                    ]
-                ].
-                newSelection := prevSelection select:[:item | methodSet includesIdentical:item].
+            "/ intersect is much faster with sets, if the number of items is large
+            "/ however, only if its worth building the set ...
+            (methodSet size + prevSelection size) > 35 ifTrue:[
+                methodSet := methodSet asIdentitySet.
+            ].
+            newSelection := methodSet intersect:prevSelection.
+        ].
+        newSelection size > 0 ifTrue:[
+            newSelection size > 100 ifTrue:[
+                "/ need selection indices - might be expensive if done straight forward...
+                reverseMap := IdentityDictionary new.
+                methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx].
+                newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd].
+            ] ifFalse:[
+                newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd]
+            ].
+"/ self halt.
+            "/ force change (for dependents)
+            newSelIdx ~= selectedMethodNameIndices value ifTrue:[
+                selectedMethodNameIndices value:newSelIdx.
             ].
-            newSelection size > 0 ifTrue:[
-                newSelection size > 100 ifTrue:[
-                    "/ need selection indices - might be expensive if done straight forward...
-                    reverseMap := IdentityDictionary new.
-                    methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx].
-                    newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd].
-                ] ifFalse:[
-                    newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd]
-                ].
-"/ self halt.
-                "/ force change (for dependents)
-                newSelIdx ~= selectedMethodNameIndices value ifTrue:[
-                    selectedMethodNameIndices value:newSelIdx.
-                ].
-            ] ifFalse:[
-                lastSelectedMethods := selectedMethodsHolder value.
-                lastSelectedMethods notNil ifTrue:[
-                    lastSelectedMethods := lastSelectedMethods asOrderedCollection
-                ].
-                selectedMethodNameIndices value size > 0 ifTrue:[
-                    selectedMethodNameIndices value:#().
-                ]
+        ] ifFalse:[
+            lastSelectedMethods := selectedMethodsHolder value.
+            lastSelectedMethods notNil ifTrue:[
+                lastSelectedMethods := lastSelectedMethods asOrderedCollection
             ].
+            selectedMethodNameIndices value size > 0 ifTrue:[
+                selectedMethodNameIndices value:#().
+            ]
+        ].
 
-            newSelection ~= prevSelection ifTrue:[
+        newSelection ~= prevSelection ifTrue:[
+            self selectionChanged.
+        ]
+    ] ifTrue:[
+        "/ same list - but classes might have changed
+        "/ that is the case, if the class selection has been changed,
+        "/ to another class which has the same categories.
+
+        (prevClasses ~= (classes ? IdentitySet new)) ifTrue:[
+            (newListSize > 0 or:[oldListSize > 0]) ifTrue:[
                 self selectionChanged.
             ]
-        ] ifTrue:[
-            "/ same list - but classes might have changed
-            "/ that is the case, if the class selection has been changed,
-            "/ to another class which has the same categories.
-
-            (prevClasses size ~= classes size 
-            or:[prevClasses asOrderedCollection ~= (classes ? #()) asOrderedCollection ]) ifTrue:[
-                (newListSize > 0 or:[oldListSize > 0]) ifTrue:[
-                    self selectionChanged.
-                ]
-            ]
         ]
-    "/ ].
+    ]
 
     "Modified: / 05-03-2007 / 16:07:24 / cg"
 !
@@ -1810,10 +1806,10 @@
 !MethodList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_MethodList.st,v 1.80 2013-03-27 19:29:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_MethodList.st,v 1.81 2013-03-28 17:22:01 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_MethodList.st,v 1.80 2013-03-27 19:29:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_MethodList.st,v 1.81 2013-03-28 17:22:01 stefan Exp $'
 ! !