MethodFinderWindow.st
changeset 3290 19e31edb0dd6
parent 3289 2902c1233b4e
child 3292 f29412454cd5
equal deleted inserted replaced
3289:2902c1233b4e 3290:19e31edb0dd6
    96                                layout: (LayoutFrame 0 0 0 0 0 0.34000000000000002 28 0)
    96                                layout: (LayoutFrame 0 0 0 0 0 0.34000000000000002 28 0)
    97                                translateLabel: true
    97                                translateLabel: true
    98                              )
    98                              )
    99                             (ComboListSpec
    99                             (ComboListSpec
   100                                name: 'allowedArgments'
   100                                name: 'allowedArgments'
   101                                layout: (LayoutFrame 0 0.34000000000000002 1 0 0 0.64000000000000012 28 0)
   101                                layout: (LayoutFrame 0 0.34000000000000002 1 0 0 0.64000000000000024 28 0)
   102                                model: argCountHolder
   102                                model: argCountHolder
   103                                comboList: argCountList
   103                                comboList: argCountList
   104                                useIndex: true
   104                                useIndex: true
   105                              )
   105                              )
   106                             (LabelSpec
   106                             (LabelSpec
   107                                label: 'Answer'
   107                                label: 'Answer'
   108                                name: 'MessageAnswerLabel'
   108                                name: 'MessageAnswerLabel'
   109                                layout: (LayoutFrame 0 0.64000000000000012 0 0 0 1 28 0)
   109                                layout: (LayoutFrame 0 0.64000000000000024 0 0 0 1 28 0)
   110                                translateLabel: true
   110                                translateLabel: true
   111                              )
   111                              )
   112                             (HorizontalPanelViewSpec
   112                             (HorizontalPanelViewSpec
   113                                name: 'HorizontalPanel1'
   113                                name: 'HorizontalPanel1'
   114                                layout: (LayoutFrame 0 0 30 0 0 1 0 1)
   114                                layout: (LayoutFrame 0 0 30 0 0 1 0 1)
   259                           
   259                           
   260                          )
   260                          )
   261                        )
   261                        )
   262                       (ViewSpec
   262                       (ViewSpec
   263                          name: 'MatchActionBox'
   263                          name: 'MatchActionBox'
   264                          layout: (LayoutFrame 0 0 -70 0.5 0 1 -20 0.5)
   264                          layout: (LayoutFrame 0 0 -70 0.5 0 1 10 0.5)
   265                          component: 
   265                          component: 
   266                         (SpecCollection
   266                         (SpecCollection
   267                            collection: (
   267                            collection: (
   268                             (LabelSpec
   268                             (LabelSpec
   269                                label: 'Selector Pattern:'
   269                                label: 'Selector Pattern:'
   272                                translateLabel: true
   272                                translateLabel: true
   273                                adjust: left
   273                                adjust: left
   274                              )
   274                              )
   275                             (InputFieldSpec
   275                             (InputFieldSpec
   276                                name: 'EntryField1'
   276                                name: 'EntryField1'
   277                                layout: (LayoutFrame 0 0 -25 1 0 0.5 0 1)
   277                                layout: (LayoutFrame 2 0 -54 1 -2 1 -29 1)
   278                                model: selectorPattern
   278                                model: selectorPattern
   279                                immediateAccept: true
   279                                immediateAccept: true
   280                                acceptOnReturn: true
   280                                acceptOnReturn: true
   281                                acceptOnTab: true
   281                                acceptOnTab: true
   282                                acceptOnPointerLeave: true
   282                                acceptOnPointerLeave: true
   293                           
   293                           
   294                          )
   294                          )
   295                        )
   295                        )
   296                       (SequenceViewSpec
   296                       (SequenceViewSpec
   297                          name: 'ResultList'
   297                          name: 'ResultList'
   298                          layout: (LayoutFrame 0 0 -15 0.5 0 1 0 1)
   298                          layout: (LayoutFrame 0 0 15 0.5 0 1 0 1)
   299                          model: selectedImplementorsHolder
   299                          model: selectedImplementorsHolder
   300                          menu: resultListMenu
   300                          menu: resultListMenu
   301                          hasHorizontalScrollBar: true
   301                          hasHorizontalScrollBar: true
   302                          hasVerticalScrollBar: true
   302                          hasVerticalScrollBar: true
   303                          autoHideScrollBars: true
   303                          autoHideScrollBars: true
   304                          valueChangeSelector: updateImplementorsOf:
       
   305                          useIndex: true
   304                          useIndex: true
   306                          sequenceList: resultHolder
   305                          sequenceList: resultHolder
   307                        )
   306                        )
   308                       )
   307                       )
   309                     
   308                     
   341                    handles: (Any 0.5 1.0)
   340                    handles: (Any 0.5 1.0)
   342                  )
   341                  )
   343                 )
   342                 )
   344               
   343               
   345              )
   344              )
   346              handles: (Any 0.37391304347826088 1.0)
   345              handles: (Any 0.37391304347826093 1.0)
   347            )
   346            )
   348           )
   347           )
   349         
   348         
   350        )
   349        )
   351      )
   350      )
   485 
   484 
   486     app := self new.
   485     app := self new.
   487     app allButOpen.
   486     app allButOpen.
   488     app selectorPattern value:selector.
   487     app selectorPattern value:selector.
   489     app openWindow.
   488     app openWindow.
       
   489     "/ app waitForBackgroundSearchFinished.
       
   490     
   490     ^ app
   491     ^ app
   491 
   492 
   492     "
   493     "
   493      self openOnSelectorPattern:'asLowercase'
   494      self openOnSelectorPattern:'asLowercase'
   494     "
   495     "
   829         ^ self
   830         ^ self
   830     ].
   831     ].
   831 
   832 
   832     searchProcess := 
   833     searchProcess := 
   833         [
   834         [
   834             |list counts firsts seconds selectors resultList|
   835             |list counts firsts seconds selectors resultList idx match|
   835 
   836 
   836             self withCursor:Cursor execute do:[
   837             self withCursor:Cursor execute do:[
   837                 pattern includesMatchCharacters ifFalse:[   
   838                 pattern includesMatchCharacters ifFalse:[   
   838                     pattern := '*',pattern,'*'
   839                     list := SystemBrowser findImplementorsOf:pattern in:Smalltalk allClasses ignoreCase:true.
       
   840                 ] ifTrue:[
       
   841                     match := '*',pattern,'*'.
       
   842                     list := SystemBrowser findImplementorsMatching:match in:Smalltalk allClasses ignoreCase:true.
   839                 ].
   843                 ].
   840                 list := SystemBrowser findImplementorsMatching:pattern in:Smalltalk allClasses ignoreCase:true.
       
   841             ].
   844             ].
   842 
   845 
   843             counts := IdentityDictionary new.
   846             counts := IdentityDictionary new.
   844             firsts := IdentityDictionary new.
   847             firsts := IdentityDictionary new.
   845             seconds := IdentityDictionary new.
   848             seconds := IdentityDictionary new.
   873                                     ] ifFalse:[
   876                                     ] ifFalse:[
   874                                         s , cnt printString , ' implementor(s)'
   877                                         s , cnt printString , ' implementor(s)'
   875                                     ]
   878                                     ]
   876                                 ].
   879                                 ].
   877                             ].
   880                             ].
   878             self enqueueDelayedAction:[ self updateListAfterPatternSearch: resultList ]
   881             self enqueueDelayedAction:[ self updateListAfterPatternSearch: resultList ].
       
   882             "/ is it in the list?
       
   883             idx := resultSelectors indexOf:pattern.
       
   884             idx ~~ 0 ifTrue:[
       
   885                 self enqueueDelayedAction:[ self selectedImplementorsHolder value:idx ].
       
   886             ].    
       
   887             
   879         ] fork.
   888         ] fork.
   880 
   889 
   881     "Created: / 01-06-2012 / 13:16:54 / cg"
   890     "Created: / 01-06-2012 / 13:16:54 / cg"
   882 !
   891 !
   883 
   892 
   940     self classOfResultHolder value:nil.
   949     self classOfResultHolder value:nil.
   941     self codeHolder value:nil.
   950     self codeHolder value:nil.
   942     self resultHolder value:resultList.
   951     self resultHolder value:resultList.
   943 
   952 
   944     "Created: / 01-06-2012 / 13:17:34 / cg"
   953     "Created: / 01-06-2012 / 13:17:34 / cg"
       
   954 !
       
   955 
       
   956 waitForBackgroundSearchFinished
       
   957     | p |
       
   958 
       
   959     (p := searchProcess) isNil ifTrue:[^ self].
       
   960     p isDead ifTrue:[^ self].
       
   961     p waitUntilTerminated 
   945 ! !
   962 ! !
   946 
   963 
   947 !MethodFinderWindow methodsFor:'aspects'!
   964 !MethodFinderWindow methodsFor:'aspects'!
   948 
   965 
   949 arg1BoxVisible
   966 arg1BoxVisible
  1067 
  1084 
  1068     |holder|
  1085     |holder|
  1069 
  1086 
  1070     (holder := builder bindingAt:#selectedImplementorsHolder) isNil ifTrue:[
  1087     (holder := builder bindingAt:#selectedImplementorsHolder) isNil ifTrue:[
  1071         holder := ValueHolder new.
  1088         holder := ValueHolder new.
       
  1089         holder onChangeEvaluate:[self updateImplementorsOf:holder value].
  1072         builder aspectAt:#selectedImplementorsHolder put:holder
  1090         builder aspectAt:#selectedImplementorsHolder put:holder
  1073     ].
  1091     ].
  1074     ^ holder
  1092     ^ holder
  1075 
  1093 
  1076     "Created: / 21-09-2012 / 11:10:13 / cg"
  1094     "Created: / 21-09-2012 / 11:10:13 / cg"
  1211 
  1229 
  1212     marker := self class markerForImplementingClass.
  1230     marker := self class markerForImplementingClass.
  1213     recClass := receiver value class.
  1231     recClass := receiver value class.
  1214     unmarkedClassList := anOrderedCollection copy.
  1232     unmarkedClassList := anOrderedCollection copy.
  1215     unmarkedClassList do:[:classAndMethod | 
  1233     unmarkedClassList do:[:classAndMethod | 
  1216         |class|
  1234         |className class sel|
  1217 
  1235 
  1218         class := Compiler 
  1236         className := classAndMethod copyButLast:aSelector size.
  1219                 evaluate:(classAndMethod upToAll:aSelector).
  1237         class := Smalltalk classNamed:className. "/ Compiler evaluate:className.
  1220         
  1238         
  1221         "/ (recClass == class)
  1239         "/ (recClass == class)
  1222         
  1240         
  1223         (recClass whichClassImplements:aSelector) == class ifTrue:[
  1241         (recClass whichClassImplements:aSelector) == class ifTrue:[
  1224             "/ unmarkedClassList add: marker, classAndMethod.
  1242             "/ unmarkedClassList add: marker, classAndMethod.