SystemBrowser.st
changeset 4806 439bed9def3a
parent 4526 704d9ce68ff7
child 4852 b9266dc55860
equal deleted inserted replaced
4805:a25bdf89086d 4806:439bed9def3a
  4805 !SystemBrowser class methodsFor:'utilities'!
  4805 !SystemBrowser class methodsFor:'utilities'!
  4806 
  4806 
  4807 classWithNameSimilarTo:className
  4807 classWithNameSimilarTo:className
  4808     "helper for class-name entry; finds a class by name tolerant w.r.t. case"
  4808     "helper for class-name entry; finds a class by name tolerant w.r.t. case"
  4809 
  4809 
  4810     |nm lcName class allClasses|
  4810     |nm lcName class allClasses triedMatchers|
  4811 
  4811 
  4812     (className startsWith:'Smalltalk::') ifTrue:[
  4812     (className startsWith:'Smalltalk::') ifTrue:[
  4813         nm := className copyFrom:('Smalltalk::' size + 1).
  4813         nm := className copyFrom:('Smalltalk::' size + 1).
  4814     ] ifFalse:[
  4814     ] ifFalse:[
  4815         nm := className.
  4815         nm := className.
  4816     ].
  4816     ].
  4817 
  4817 
  4818     class := Smalltalk at:nm asSymbol.
  4818     class := Smalltalk at:nm asSymbol.
  4819     class isBehavior ifTrue:[^ class].
  4819     class isBehavior ifTrue:[^ class].      "/ a direct hit
  4820 
  4820 
  4821     lcName := className asLowercase.
  4821     lcName := className asLowercase.
  4822     allClasses := Smalltalk allClasses.
  4822     allClasses := Smalltalk allClasses.
  4823     class := allClasses 
  4823 
  4824                     detect:[:cls | cls name asLowercase = lcName]
  4824     triedMatchers := OrderedCollection new.
  4825                     ifNone:nil.
  4825     triedMatchers add:[:cls | cls name asLowercase = lcName].       
  4826     class notNil ifTrue:[^ class].
  4826     triedMatchers add:[:cls | cls name asLowercase startsWith:lcName].      
  4827 
  4827     triedMatchers add:[:cls | cls nameWithoutNameSpacePrefix asLowercase = lcName].      
  4828     class := allClasses 
  4828     triedMatchers add:[:cls | cls nameWithoutNameSpacePrefix asLowercase startsWith:lcName].      
  4829                     detect:[:cls | cls name asLowercase startsWith:lcName]
  4829     triedMatchers add:[:cls | cls nameWithoutPrefix asLowercase = lcName].      
  4830                     ifNone:nil.
  4830     triedMatchers add:[:cls | cls nameWithoutPrefix asLowercase startsWith:lcName].      
  4831     class notNil ifTrue:[^ class].
  4831     triedMatchers add:[:cls | cls nameWithoutPrefix asLowercase includesString:lcName].      
  4832 
  4832 
  4833     class := allClasses 
  4833     triedMatchers do:[:eachTry |
  4834                     detect:[:cls | cls nameWithoutNameSpacePrefix asLowercase = lcName]
  4834         class := allClasses detect:eachTry ifNone:nil.
  4835                     ifNone:nil.
  4835         class notNil ifTrue:[^ class].
  4836     class notNil ifTrue:[^ class].
  4836     ].
  4837 
  4837     ^ nil  
  4838     class := allClasses 
       
  4839                     detect:[:cls | cls nameWithoutNameSpacePrefix asLowercase startsWith:lcName]
       
  4840                     ifNone:nil.
       
  4841     class notNil ifTrue:[^ class].
       
  4842 
       
  4843     class := allClasses 
       
  4844                     detect:[:cls | cls nameWithoutPrefix asLowercase = lcName]
       
  4845                     ifNone:nil.
       
  4846     class notNil ifTrue:[^ class].
       
  4847 
       
  4848     class := allClasses 
       
  4849                     detect:[:cls | cls nameWithoutPrefix asLowercase startsWith:lcName]
       
  4850                     ifNone:nil.
       
  4851     class notNil ifTrue:[^ class].
       
  4852 
       
  4853     class := allClasses 
       
  4854                     detect:[:cls | ('*' , lcName , '*') match:cls nameWithoutPrefix asLowercase]
       
  4855                     ifNone:nil.
       
  4856     ^ class
       
  4857 !
  4838 !
  4858 
  4839 
  4859 extractClassAndSelectorFrom:aString into:aBlock
  4840 extractClassAndSelectorFrom:aString into:aBlock
  4860     "given a string which can be either 'class>>sel' or
  4841     "given a string which can be either 'class>>sel' or
  4861      'class sel', extract className and selector, and call aBlock with
  4842      'class sel', extract className and selector, and call aBlock with
  5003 ! !
  4984 ! !
  5004 
  4985 
  5005 !SystemBrowser class methodsFor:'documentation'!
  4986 !SystemBrowser class methodsFor:'documentation'!
  5006 
  4987 
  5007 version
  4988 version
  5008     ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.185 2003-02-04 08:42:37 ca Exp $'
  4989     ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.186 2003-04-09 09:17:01 cg Exp $'
  5009 ! !
  4990 ! !
  5010 
  4991 
  5011 SystemBrowser initialize!
  4992 SystemBrowser initialize!