1401 prevClasses methodSet selectedMethodsHolder| |
1401 prevClasses methodSet selectedMethodsHolder| |
1402 |
1402 |
1403 selectedMethodsHolder := self selectedMethods. |
1403 selectedMethodsHolder := self selectedMethods. |
1404 prevSelection := selectedMethodsHolder value ? #(). |
1404 prevSelection := selectedMethodsHolder value ? #(). |
1405 |
1405 |
1406 prevClasses := classes ifNil:[ #() ] ifNotNil:[ classes copy ]. |
1406 prevClasses := classes isNil ifTrue:[ #() ] ifFalse:[ classes copy ]. |
1407 |
1407 |
1408 oldListSize := self browserNameList size. |
1408 oldListSize := self browserNameList size. |
1409 |
1409 |
1410 self topApplication withWaitCursorDo:[ |
1410 self topApplication withWaitCursorDo:[ |
1411 newList := self listOfMethodNames. |
1411 newList := self listOfMethodNames. |
1412 ]. |
1412 ]. |
1413 newListSize := newList size. |
1413 newListSize := newList size. |
1414 sameContents := self updateListFor:newList. |
1414 sameContents := self updateListFor:newList. |
1415 |
1415 |
1416 sameContents ifFalse:[ |
1416 sameContents ifFalse:[ |
1417 "/ self browserNameList value:newList. |
1417 "/ self browserNameList value:newList. |
1418 |
1418 |
1419 (prevSelection size == 0 |
1419 (prevSelection size == 0 |
1420 and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[ |
1420 and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[ |
1421 "/ this happens during early startup time, |
1421 "/ this happens during early startup time, |
1422 "/ when the selection is already (pre-)set, |
1422 "/ when the selection is already (pre-)set, |
1423 "/ and the methodList is generated the first time |
1423 "/ and the methodList is generated the first time |
1424 "/ (i.e. when opened with preset selection |
1424 "/ (i.e. when opened with preset selection |
1425 |
1425 |
1426 "/ do not clobber the selection in this case. |
1426 "/ do not clobber the selection in this case. |
1427 prevSelection := selectedMethodsHolder value. |
1427 prevSelection := selectedMethodsHolder value. |
1428 ]. |
1428 ]. |
1429 |
1429 |
1430 (methodList size == 0 or:[prevSelection size == 0]) ifTrue:[ |
1430 (methodList size == 0 or:[prevSelection size == 0]) ifTrue:[ |
1431 newSelection := #() |
1431 newSelection := #() |
|
1432 ] ifFalse:[ |
|
1433 methodSet := methodList. |
|
1434 |
|
1435 "/ intersect is much faster with sets, if the number of items is large |
|
1436 "/ however, only if its worth building the set ... |
|
1437 (methodSet size + prevSelection size) > 35 ifTrue:[ |
|
1438 methodSet := methodSet asIdentitySet. |
|
1439 ]. |
|
1440 newSelection := methodSet intersect:prevSelection. |
|
1441 ]. |
|
1442 newSelection size > 0 ifTrue:[ |
|
1443 newSelection size > 100 ifTrue:[ |
|
1444 "/ need selection indices - might be expensive if done straight forward... |
|
1445 reverseMap := IdentityDictionary new. |
|
1446 methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
|
1447 newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd]. |
1432 ] ifFalse:[ |
1448 ] ifFalse:[ |
1433 methodSet := methodList. |
1449 newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd] |
1434 |
1450 ]. |
1435 "/ inclusion test is much faster with sets, if the number of items is large |
|
1436 methodList size > 30 ifTrue:[ |
|
1437 "/ however, only if its worth building the set ... |
|
1438 prevSelection size > 5 ifTrue:[ |
|
1439 methodSet := methodSet asIdentitySet. |
|
1440 ] |
|
1441 ]. |
|
1442 newSelection := prevSelection select:[:item | methodSet includesIdentical:item]. |
|
1443 ]. |
|
1444 newSelection size > 0 ifTrue:[ |
|
1445 newSelection size > 100 ifTrue:[ |
|
1446 "/ need selection indices - might be expensive if done straight forward... |
|
1447 reverseMap := IdentityDictionary new. |
|
1448 methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
|
1449 newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd]. |
|
1450 ] ifFalse:[ |
|
1451 newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd] |
|
1452 ]. |
|
1453 "/ self halt. |
1451 "/ self halt. |
1454 "/ force change (for dependents) |
1452 "/ force change (for dependents) |
1455 newSelIdx ~= selectedMethodNameIndices value ifTrue:[ |
1453 newSelIdx ~= selectedMethodNameIndices value ifTrue:[ |
1456 selectedMethodNameIndices value:newSelIdx. |
1454 selectedMethodNameIndices value:newSelIdx. |
1457 ]. |
1455 ]. |
1458 ] ifFalse:[ |
1456 ] ifFalse:[ |
1459 lastSelectedMethods := selectedMethodsHolder value. |
1457 lastSelectedMethods := selectedMethodsHolder value. |
1460 lastSelectedMethods notNil ifTrue:[ |
1458 lastSelectedMethods notNil ifTrue:[ |
1461 lastSelectedMethods := lastSelectedMethods asOrderedCollection |
1459 lastSelectedMethods := lastSelectedMethods asOrderedCollection |
1462 ]. |
1460 ]. |
1463 selectedMethodNameIndices value size > 0 ifTrue:[ |
1461 selectedMethodNameIndices value size > 0 ifTrue:[ |
1464 selectedMethodNameIndices value:#(). |
1462 selectedMethodNameIndices value:#(). |
1465 ] |
1463 ] |
1466 ]. |
1464 ]. |
1467 |
1465 |
1468 newSelection ~= prevSelection ifTrue:[ |
1466 newSelection ~= prevSelection ifTrue:[ |
|
1467 self selectionChanged. |
|
1468 ] |
|
1469 ] ifTrue:[ |
|
1470 "/ same list - but classes might have changed |
|
1471 "/ that is the case, if the class selection has been changed, |
|
1472 "/ to another class which has the same categories. |
|
1473 |
|
1474 (prevClasses ~= (classes ? IdentitySet new)) ifTrue:[ |
|
1475 (newListSize > 0 or:[oldListSize > 0]) ifTrue:[ |
1469 self selectionChanged. |
1476 self selectionChanged. |
1470 ] |
1477 ] |
1471 ] ifTrue:[ |
|
1472 "/ same list - but classes might have changed |
|
1473 "/ that is the case, if the class selection has been changed, |
|
1474 "/ to another class which has the same categories. |
|
1475 |
|
1476 (prevClasses size ~= classes size |
|
1477 or:[prevClasses asOrderedCollection ~= (classes ? #()) asOrderedCollection ]) ifTrue:[ |
|
1478 (newListSize > 0 or:[oldListSize > 0]) ifTrue:[ |
|
1479 self selectionChanged. |
|
1480 ] |
|
1481 ] |
|
1482 ] |
1478 ] |
1483 "/ ]. |
1479 ] |
1484 |
1480 |
1485 "Modified: / 05-03-2007 / 16:07:24 / cg" |
1481 "Modified: / 05-03-2007 / 16:07:24 / cg" |
1486 ! |
1482 ! |
1487 |
1483 |
1488 updateListEntryFor:aMethod |
1484 updateListEntryFor:aMethod |