Tools_ClassList.st
changeset 6712 b044694deb7d
parent 6492 9c446e709216
child 6716 4b255b8e6dfa
equal deleted inserted replaced
6711:7baeea233b90 6712:b044694deb7d
  1432     ^ found
  1432     ^ found
  1433 !
  1433 !
  1434 
  1434 
  1435 updateList
  1435 updateList
  1436     |prevSelection oldList newList newSelectionIndices 
  1436     |prevSelection oldList newList newSelectionIndices 
  1437      forceSelectionChange selectedClassNameIndicesHolder classList|
  1437      forceSelectionChange selectedClassNameIndicesHolder classList
       
  1438      classesAddedToList classesRemovedFromList newSet oldSet|
  1438 
  1439 
  1439     newList := self listOfClasses.
  1440     newList := self listOfClasses.
  1440     classList := self classList.
  1441     classList := self classList.
  1441     oldList := classList value ? #().
  1442     oldList := classList value ? #().
       
  1443 
       
  1444     autoSelect == true ifTrue:[
       
  1445         classesRemovedFromList := OrderedCollection new.
       
  1446         newSet := newList asSet.
       
  1447         oldSet := oldList asSet.
       
  1448         classesAddedToList := newSet select:[:eachNewClass | (oldSet includes:eachNewClass) not].
       
  1449         classesRemovedFromList := oldSet select:[:eachOldClass | (newSet includes:eachOldClass) not].
       
  1450     ].
  1442 
  1451 
  1443     (newList ~= oldList
  1452     (newList ~= oldList
  1444     or:[self classNameList value isNil and:[newList size > 0]]) ifTrue:[
  1453     or:[self classNameList value isNil and:[newList size > 0]]) ifTrue:[
  1445         prevSelection := lastSelectedClasses ? #().
  1454         prevSelection := lastSelectedClasses ? #().
  1446         prevSelection := prevSelection select:[:each | each notNil].
  1455         prevSelection := prevSelection select:[:each | each notNil].
  1463             "/ do not clobber the selection in this case.
  1472             "/ do not clobber the selection in this case.
  1464             prevSelection := self selectedClasses value.
  1473             prevSelection := self selectedClasses value.
  1465             prevSelection := prevSelection select:[:cls | cls notNil].
  1474             prevSelection := prevSelection select:[:cls | cls notNil].
  1466             "/ simulate a change, to force selection update in listView
  1475             "/ simulate a change, to force selection update in listView
  1467             forceSelectionChange := true.
  1476             forceSelectionChange := true.
       
  1477         ].
       
  1478 
       
  1479         autoSelect == true ifTrue:[
       
  1480             prevSelection isNil ifTrue:[
       
  1481                 prevSelection := OrderedCollection new
       
  1482             ].
       
  1483             prevSelection := prevSelection asOrderedCollection.
       
  1484 
       
  1485             classesAddedToList do:[:eachNewClass |
       
  1486                 (prevSelection includes:eachNewClass) ifFalse:[
       
  1487                     prevSelection add:eachNewClass.
       
  1488                 ].
       
  1489             ].
       
  1490             classesRemovedFromList do:[:eachOldClass |
       
  1491                 prevSelection remove:eachOldClass ifAbsent:[].
       
  1492             ].
  1468         ].
  1493         ].
  1469 
  1494 
  1470         newSelectionIndices := prevSelection 
  1495         newSelectionIndices := prevSelection 
  1471                             collect:[:item | |cls|
  1496                             collect:[:item | |cls|
  1472                                              cls := Smalltalk at:item theNonMetaclass name.   
  1497                                              cls := Smalltalk at:item theNonMetaclass name.   
  1595 ! !
  1620 ! !
  1596 
  1621 
  1597 !ClassList class methodsFor:'documentation'!
  1622 !ClassList class methodsFor:'documentation'!
  1598 
  1623 
  1599 version
  1624 version
  1600     ^ '$Header: /cvs/stx/stx/libtool/Tools_ClassList.st,v 1.10 2006-01-24 16:55:04 cg Exp $'
  1625     ^ '$Header: /cvs/stx/stx/libtool/Tools_ClassList.st,v 1.11 2006-03-16 22:33:21 cg Exp $'
  1601 ! !
  1626 ! !