1493 prevClasses := classes isNil ifTrue:[ #() ] ifFalse:[ classes copy ]. |
1493 prevClasses := classes isNil ifTrue:[ #() ] ifFalse:[ classes copy ]. |
1494 |
1494 |
1495 oldListSize := self browserNameList size. |
1495 oldListSize := self browserNameList size. |
1496 |
1496 |
1497 self topApplication withWaitCursorDo:[ |
1497 self topApplication withWaitCursorDo:[ |
1498 newList := self listOfMethodNames. |
1498 newList := self listOfMethodNames. |
1499 ]. |
1499 ]. |
1500 newListSize := newList size. |
1500 newListSize := newList size. |
1501 sameContents := self updateListFor:newList. |
1501 sameContents := self updateListFor:newList. |
1502 |
1502 |
1503 sameContents ifFalse:[ |
1503 sameContents ifFalse:[ |
1504 "/ self browserNameList value:newList. |
1504 "/ self browserNameList value:newList. |
1505 |
1505 |
1506 (prevSelection size == 0 |
1506 (prevSelection size == 0 |
1507 and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[ |
1507 and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[ |
1508 "/ this happens during early startup time, |
1508 "/ this happens during early startup time, |
1509 "/ when the selection is already (pre-)set, |
1509 "/ when the selection is already (pre-)set, |
1510 "/ and the methodList is generated the first time |
1510 "/ and the methodList is generated the first time |
1511 "/ (i.e. when opened with preset selection |
1511 "/ (i.e. when opened with preset selection |
1512 |
1512 |
1513 "/ do not clobber the selection in this case. |
1513 "/ do not clobber the selection in this case. |
1514 prevSelection := selectedMethodsHolder value. |
1514 prevSelection := selectedMethodsHolder value. |
1515 ]. |
1515 ]. |
1516 |
1516 |
1517 (methodList size == 0 or:[prevSelection size == 0]) ifTrue:[ |
1517 (methodList size == 0 or:[prevSelection size == 0]) ifTrue:[ |
1518 newSelection := #() |
1518 newSelection := #() |
1519 ] ifFalse:[ |
1519 ] ifFalse:[ |
1520 methodSet := methodList. |
1520 methodSet := methodList. |
1521 |
1521 |
1522 "/ intersect is much faster with sets, if the number of items is large |
1522 "/ intersect is much faster with sets, if the number of items is large |
1523 "/ however, only if its worth building the set ... |
1523 "/ however, only if it's worth building the set ... |
1524 (methodSet size + prevSelection size) > 35 ifTrue:[ |
1524 (methodSet size + prevSelection size) > 35 ifTrue:[ |
1525 methodSet := methodSet asIdentitySet. |
1525 methodSet := methodSet asIdentitySet. |
1526 ]. |
1526 ]. |
1527 newSelection := methodSet intersect:prevSelection. |
1527 newSelection := methodSet intersect:prevSelection. |
1528 ]. |
1528 ]. |
1529 newSelection size > 0 ifTrue:[ |
1529 newSelection size > 0 ifTrue:[ |
1530 newSelection size > 100 ifTrue:[ |
1530 newSelection size > 100 ifTrue:[ |
1531 "/ need selection indices - might be expensive if done straight forward... |
1531 "/ need selection indices - might be expensive if done straight forward... |
1532 reverseMap := IdentityDictionary new. |
1532 reverseMap := IdentityDictionary new. |
1533 methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
1533 methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
1534 newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd]. |
1534 newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd]. |
1535 ] ifFalse:[ |
1535 ] ifFalse:[ |
1536 newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd] |
1536 newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd] |
1537 ]. |
1537 ]. |
1538 "/ self halt. |
1538 "/ self halt. |
1539 "/ force change (for dependents) |
1539 "/ force change (for dependents) |
1540 newSelIdx ~= selectedMethodNameIndices value ifTrue:[ |
1540 newSelIdx ~= selectedMethodNameIndices value ifTrue:[ |
1541 self selectedMethodNameIndices value:newSelIdx. |
1541 self selectedMethodNameIndices value:newSelIdx. |
1542 ]. |
1542 ]. |
1543 ] ifFalse:[ |
1543 ] ifFalse:[ |
1544 lastSelectedMethods := selectedMethodsHolder value. |
1544 lastSelectedMethods := selectedMethodsHolder value. |
1545 lastSelectedMethods notNil ifTrue:[ |
1545 lastSelectedMethods notNil ifTrue:[ |
1546 lastSelectedMethods := lastSelectedMethods asOrderedCollection |
1546 lastSelectedMethods := lastSelectedMethods asOrderedCollection |
1547 ]. |
1547 ]. |
1548 selectedMethodNameIndices value size > 0 ifTrue:[ |
1548 selectedMethodNameIndices value size > 0 ifTrue:[ |
1549 selectedMethodNameIndices value:#(). |
1549 selectedMethodNameIndices value:#(). |
1550 ] |
1550 ] |
1551 ]. |
1551 ]. |
1552 |
1552 |
1553 newSelection ~= prevSelection ifTrue:[ |
1553 newSelection ~= prevSelection ifTrue:[ |
1554 self selectionChanged. |
1554 self selectionChanged. |
1555 ] |
1555 ] |
1556 ] ifTrue:[ |
1556 ] ifTrue:[ |
1557 "/ same list - but classes might have changed |
1557 "/ same list - but classes might have changed |
1558 "/ that is the case, if the class selection has been changed, |
1558 "/ that is the case, if the class selection has been changed, |
1559 "/ to another class which has the same categories. |
1559 "/ to another class which has the same categories. |
1560 |
1560 |
1561 (prevClasses ~= (classes ? IdentitySet new)) ifTrue:[ |
1561 (prevClasses ~= (classes ? IdentitySet new)) ifTrue:[ |
1562 (newListSize > 0 or:[oldListSize > 0]) ifTrue:[ |
1562 (newListSize > 0 or:[oldListSize > 0]) ifTrue:[ |
1563 self selectionChanged. |
1563 self selectionChanged. |
1564 ] |
1564 ] |
1565 ] |
1565 ] |
1566 ] |
1566 ] |
1567 |
1567 |
1568 "Modified: / 05-03-2007 / 16:07:24 / cg" |
1568 "Modified: / 05-03-2007 / 16:07:24 / cg" |
1569 "Modified: / 24-02-2014 / 11:08:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1569 "Modified: / 24-02-2014 / 11:08:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1570 "Modified (comment): / 13-02-2017 / 20:33:21 / cg" |
1570 ! |
1571 ! |
1571 |
1572 |
1572 updateListEntryFor:aMethod |
1573 updateListEntryFor:aMethod |
1573 "update my list for a single method. |
1574 "update my list for a single method. |
1574 (used when a single methods package, code or whatever changes, and a full udpate |
1575 (used when a single methods package, code or whatever changes, and a full udpate |