DoWhatIMeanSupport.st
changeset 3955 94fb4a47d108
parent 3929 bf3f10bb97c7
child 3984 6b0baf8491f7
equal deleted inserted replaced
3954:e28b5c4fe0c9 3955:94fb4a47d108
  1566 selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment match:doMatch
  1566 selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment match:doMatch
  1567     "given a partial selector, return an array consisting of
  1567     "given a partial selector, return an array consisting of
  1568      2 entries: 1st: the longest match
  1568      2 entries: 1st: the longest match
  1569                 2nd: collection consisting of matching implemented selectors"
  1569                 2nd: collection consisting of matching implemented selectors"
  1570 
  1570 
       
  1571     ^ self 
       
  1572         selectorCompletion:aPartialSymbolName 
       
  1573         inEnvironment:anEnvironment 
       
  1574         match:doMatch 
       
  1575         ignoreCase:false
       
  1576 
       
  1577     "
       
  1578      DoWhatIMeanSupport selectorCompletion:'inst*p' inEnvironment:Smalltalk match:true 
       
  1579      DoWhatIMeanSupport selectorCompletion:'inst*pl' inEnvironment:Smalltalk match:true 
       
  1580      DoWhatIMeanSupport selectorCompletion:'at:p' inEnvironment:Smalltalk match:true 
       
  1581      DoWhatIMeanSupport selectorCompletion:'nextP' inEnvironment:Smalltalk match:true
       
  1582      DoWhatIMeanSupport selectorCompletion:'nextp' inEnvironment:Smalltalk match:true
       
  1583     "
       
  1584 
       
  1585     "Modified: / 07-06-1996 / 08:44:33 / stefan"
       
  1586     "Modified: / 26-10-2010 / 20:30:27 / cg"
       
  1587 !
       
  1588 
       
  1589 selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment match:doMatch ignoreCase:ignoreCase
       
  1590     "given a partial selector, return an array consisting of
       
  1591      2 entries: 1st: the longest match
       
  1592                 2nd: collection consisting of matching implemented selectors"
       
  1593 
  1571     |matches best lcSym isMatch|
  1594     |matches best lcSym isMatch|
  1572 
  1595 
  1573     matches := IdentitySet new.
  1596     matches := IdentitySet new.
  1574 
  1597 
  1575     isMatch := doMatch and:[aPartialSymbolName includesMatchCharacters].
  1598     isMatch := doMatch and:[aPartialSymbolName includesMatchCharacters].
  1576 
  1599 
  1577     anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
  1600     anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
  1578         (isMatch 
  1601         (isMatch 
  1579             ifTrue:[ (aPartialSymbolName match:eachSelector) ]
  1602             ifTrue:[ (aPartialSymbolName match:eachSelector ignoreCase:ignoreCase) ]
  1580             ifFalse:[ (eachSelector startsWith:aPartialSymbolName) ])
  1603             ifFalse:[ ignoreCase 
       
  1604                         ifTrue:[ (eachSelector asLowercase startsWith:aPartialSymbolName asLowercase) ]  
       
  1605                         ifFalse:[ (eachSelector startsWith:aPartialSymbolName) ] ])
  1581          ifTrue:[
  1606          ifTrue:[
  1582             matches add:eachSelector
  1607             matches add:eachSelector
  1583         ].
  1608         ].
  1584     ].
  1609     ].
  1585     matches isEmpty ifTrue:[
  1610     (matches isEmpty and:[ignoreCase not]) ifTrue:[
  1586         "/ search for case-ignoring match
  1611         "/ search for case-ignoring match
  1587         lcSym := aPartialSymbolName asLowercase.
  1612         lcSym := aPartialSymbolName asLowercase.
  1588         anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
  1613         anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
  1589             (isMatch 
  1614             (isMatch 
  1590                 ifTrue:[ (aPartialSymbolName match:eachSelector ignoreCase:true) ]
  1615                 ifTrue:[ (aPartialSymbolName match:eachSelector ignoreCase:true) ]
  1611      DoWhatIMeanSupport selectorCompletion:'at:p' inEnvironment:Smalltalk match:true 
  1636      DoWhatIMeanSupport selectorCompletion:'at:p' inEnvironment:Smalltalk match:true 
  1612      DoWhatIMeanSupport selectorCompletion:'nextP' inEnvironment:Smalltalk match:true
  1637      DoWhatIMeanSupport selectorCompletion:'nextP' inEnvironment:Smalltalk match:true
  1613      DoWhatIMeanSupport selectorCompletion:'nextp' inEnvironment:Smalltalk match:true
  1638      DoWhatIMeanSupport selectorCompletion:'nextp' inEnvironment:Smalltalk match:true
  1614     "
  1639     "
  1615 
  1640 
  1616     "Modified: / 7.6.1996 / 08:44:33 / stefan"
  1641     "Modified: / 07-06-1996 / 08:44:33 / stefan"
  1617     "Modified: / 14.6.1998 / 15:54:03 / cg"
  1642     "Created: / 26-10-2010 / 20:30:06 / cg"
  1618 ! !
  1643 ! !
  1619 
  1644 
  1620 !DoWhatIMeanSupport class methodsFor:'rename support'!
  1645 !DoWhatIMeanSupport class methodsFor:'rename support'!
  1621 
  1646 
  1622 goodRenameDefaultFor:oldName lastOld:lastOldName lastNew:lastNewName
  1647 goodRenameDefaultFor:oldName lastOld:lastOldName lastNew:lastNewName
  1929 ! !
  1954 ! !
  1930 
  1955 
  1931 !DoWhatIMeanSupport class methodsFor:'documentation'!
  1956 !DoWhatIMeanSupport class methodsFor:'documentation'!
  1932 
  1957 
  1933 version
  1958 version
  1934     ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.74 2010-08-24 13:28:35 sr Exp $'
  1959     ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.75 2010-10-26 18:34:15 cg Exp $'
  1935 !
  1960 !
  1936 
  1961 
  1937 version_CVS
  1962 version_CVS
  1938     ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.74 2010-08-24 13:28:35 sr Exp $'
  1963     ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.75 2010-10-26 18:34:15 cg Exp $'
  1939 ! !
  1964 ! !