Tools_SearchDialog.st
changeset 10189 0be2c38f087a
parent 9645 8ff383213d07
child 10377 0024b64778eb
equal deleted inserted replaced
10188:95e82ec734ff 10189:0be2c38f087a
    22 		allowBuffer allowBrowser searchWhat searchClassProtocolHolder
    22 		allowBuffer allowBrowser searchWhat searchClassProtocolHolder
    23 		searchInstanceProtocolHolder selectorOrCode listHolder
    23 		searchInstanceProtocolHolder selectorOrCode listHolder
    24 		matchProcess inputField'
    24 		matchProcess inputField'
    25 	classVariableNames:'LastCodeSearched LastCodeSearchWasMethod LastGlobalSearched
    25 	classVariableNames:'LastCodeSearched LastCodeSearchWasMethod LastGlobalSearched
    26 		LastStringSearched LastSearchWasMatch LastSearchWasCaseSensitive
    26 		LastStringSearched LastSearchWasMatch LastSearchWasCaseSensitive
    27 		LastStringSearchArea LastCodeSearchArea AREA_LISTOFMETHODS'
    27 		LastStringSearchArea LastCodeSearchArea AREA_LISTOFMETHODS
       
    28 		LastResourceSearched'
    28 	poolDictionaries:''
    29 	poolDictionaries:''
    29 	category:'Interface-Browsers-New'
    30 	category:'Interface-Browsers-New'
    30 !
    31 !
    31 
    32 
    32 !SearchDialog class methodsFor:'documentation'!
    33 !SearchDialog class methodsFor:'documentation'!
   163 addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch 
   164 addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch 
   164     matchHolder := caseHolder := nil.
   165     matchHolder := caseHolder := nil.
   165 
   166 
   166     searchWhat == #code ifTrue:[
   167     searchWhat == #code ifTrue:[
   167         self addTextEntryFieldForCode.
   168         self addTextEntryFieldForCode.
   168     ] ifFalse:[
   169         ^ self.
   169         self addInputFieldForSelectorOrNameOrString.
   170     ].
   170         withCaseIgnore ifTrue:[
   171 
   171             self 
   172     self addInputFieldForSelectorOrNameOrString.
   172                 addCheckBox:(resources string:'Case Sensitive')
   173     withCaseIgnore ifTrue:[
   173                 on:(caseHolder := (LastSearchWasCaseSensitive ? false) asValue).
   174         self 
   174         ].
   175             addCheckBox:(resources string:'Case Sensitive')
   175         withMatch ifTrue:[
   176             on:(caseHolder := (LastSearchWasCaseSensitive ? false) asValue).
   176             self 
   177     ].
   177                 addCheckBox:(resources string:'Match')
   178     withMatch ifTrue:[
   178                 on:(matchHolder := (LastSearchWasMatch ? true) asValue).
   179         self 
       
   180             addCheckBox:(resources string:'Match')
       
   181             on:(matchHolder := (LastSearchWasMatch ? true) asValue).
   179 "/                (isSelector and:[ sel notNil. ]) ifTrue:[ 
   182 "/                (isSelector and:[ sel notNil. ]) ifTrue:[ 
   180 "/                    sel includesMatchCharacters ifTrue:[ 
   183 "/                    sel includesMatchCharacters ifTrue:[ 
   181 "/                        matchHolder value:false.
   184 "/                        matchHolder value:false.
   182 "/                    ].
   185 "/                    ].
   183 "/                ].
   186 "/                ].
   184         ]
       
   185     ]
   187     ]
       
   188 
       
   189     "Modified (format): / 06-07-2011 / 11:56:31 / cg"
   186 !
   190 !
   187 
   191 
   188 askThenDo:aBlock 
   192 askThenDo:aBlock 
   189     |where code sel matchHolderValue caseHolderValue|
   193     |where code sel matchHolderValue caseHolderValue|
   190 
   194 
   291         aBlock value.
   295         aBlock value.
   292     ]
   296     ]
   293 !
   297 !
   294 
   298 
   295 setupToAskForMethodSearchTitle:title forBrowser:brwsrArg searchWhat:searchWhatArg 
   299 setupToAskForMethodSearchTitle:title forBrowser:brwsrArg searchWhat:searchWhatArg 
   296 searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch 
   300   searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch 
   297 withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg 
   301   withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg 
   298 allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg 
   302   allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg 
   299 
   303 
   300     |where ns methodNameSpaces methodPackages hPanel leftVerticalPanel rightVerticalPanel l|
   304     |where ns methodNameSpaces methodPackages hPanel leftVerticalPanel rightVerticalPanel l|
   301 
   305 
   302     allowFind := allowFindArg.
   306     allowFind := allowFindArg.
   303     allowBuffer := allowBufferArg.
   307     allowBuffer := allowBufferArg.
   507     self addButtons.
   511     self addButtons.
   508 
   512 
   509     self label:(resources string:'Search').
   513     self label:(resources string:'Search').
   510 
   514 
   511     "Modified: / 10-10-2006 / 15:30:52 / cg"
   515     "Modified: / 10-10-2006 / 15:30:52 / cg"
       
   516     "Modified (format): / 06-07-2011 / 11:53:23 / cg"
   512 ! !
   517 ! !
   513 
   518 
   514 !SearchDialog methodsFor:'setup'!
   519 !SearchDialog methodsFor:'setup'!
   515 
   520 
   516 addCheckBox:b forSearchArea:area 
   521 addCheckBox:b forSearchArea:area 
   855             sel := browser globalNameToSearchFor ? LastGlobalSearched.
   860             sel := browser globalNameToSearchFor ? LastGlobalSearched.
   856         ] ifFalse:[ 
   861         ] ifFalse:[ 
   857             searchWhat == #string ifTrue:[
   862             searchWhat == #string ifTrue:[
   858                 sel := browser stringToSearchFor ? LastStringSearched.
   863                 sel := browser stringToSearchFor ? LastStringSearched.
   859             ] ifFalse:[
   864             ] ifFalse:[
   860                 sel := browser selectorToSearchFor.
   865                 searchWhat == #resource ifTrue:[
       
   866                     sel := browser stringToSearchFor ? LastResourceSearched.
       
   867                 ] ifFalse:[
       
   868                     sel := browser selectorToSearchFor.
       
   869                 ]
   861             ]
   870             ]
   862         ].
   871         ].
   863     ].
   872     ].
       
   873 
   864     lastSearchPatterns := browser lastSearchPatterns.
   874     lastSearchPatterns := browser lastSearchPatterns.
   865     sel isEmptyOrNil ifTrue:[ 
   875     sel isEmptyOrNil ifTrue:[ 
   866         "/ use last searchString
   876         "/ use last searchString
   867         lastSearchPatterns size > 0 ifTrue:[ 
   877         lastSearchPatterns size > 0 ifTrue:[ 
   868             sel := lastSearchPatterns first.
   878             sel := lastSearchPatterns first.
   882             s := contents withoutSpaces.
   892             s := contents withoutSpaces.
   883             self topView 
   893             self topView 
   884                 withWaitCursorDo:[
   894                 withWaitCursorDo:[
   885                     |best matching|
   895                     |best matching|
   886 
   896 
   887                     searchWhat == #globalName ifFalse:[ 
   897                     searchWhat == #resource ifTrue:[
   888                         what := Smalltalk selectorCompletion:s.
   898                         what := DoWhatIMeanSupport resourceCompletion:s inEnvironment:Smalltalk match:true ignoreCase:false.
   889                     ] ifTrue:[ 
   899                     ] ifFalse:[
   890                         what := Smalltalk globalNameCompletion:s.
   900                         searchWhat == #globalName ifFalse:[ 
       
   901                             what := DoWhatIMeanSupport selectorCompletion:s inEnvironment:Smalltalk.
       
   902                         ] ifTrue:[ 
       
   903                             what := DoWhatIMeanSupport globalNameCompletion:s inEnvironment:Smalltalk match:true.
       
   904                         ].
   891                     ].
   905                     ].
   892                     best := what first.
   906                     best := what first.
   893                     matching := what second.
   907                     matching := what second.
   894                     inputField contents:best.
   908                     inputField contents:best.
   895                     "/ listHolder contents:matching.
   909                     "/ listHolder contents:matching.
   899                 ].
   913                 ].
   900         ].
   914         ].
   901 
   915 
   902     selectorHolder onChangeEvaluate:[ self updateListOfMatchingSelectorsFor:inputField contents ].
   916     selectorHolder onChangeEvaluate:[ self updateListOfMatchingSelectorsFor:inputField contents ].
   903 
   917 
   904     "Modified: / 23-11-2010 / 14:32:50 / cg"
   918     "Modified: / 06-07-2011 / 12:07:12 / cg"
   905 !
   919 !
   906 
   920 
   907 addTextEntryFieldForCode
   921 addTextEntryFieldForCode
   908     |initial box panel patternInfoBox infoLabel helpButton errMessageField checkCodeAction
   922     |initial box panel patternInfoBox infoLabel helpButton errMessageField checkCodeAction
   909      metaBox b|
   923      metaBox b|
  1239     ^ b.
  1253     ^ b.
  1240 ! !
  1254 ! !
  1241 
  1255 
  1242 !SearchDialog class methodsFor:'documentation'!
  1256 !SearchDialog class methodsFor:'documentation'!
  1243 
  1257 
  1244 version
       
  1245     ^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.60 2010-11-23 13:33:51 cg Exp $'
       
  1246 !
       
  1247 
       
  1248 version_CVS
  1258 version_CVS
  1249     ^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.60 2010-11-23 13:33:51 cg Exp $'
  1259     ^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.61 2011-07-06 10:19:47 cg Exp $'
  1250 ! !
  1260 ! !
  1251 
  1261 
  1252 SearchDialog initialize!
  1262 SearchDialog initialize!