Tools__StringSearchToolForTextView.st
changeset 8997 05b9949f54aa
parent 8958 6f1fef46e15e
child 9466 4b5b48801c66
equal deleted inserted replaced
8996:261868e9cc34 8997:05b9949f54aa
   337 matchHolderChanged
   337 matchHolderChanged
   338 
   338 
   339     self searchNextTextIncludingCurrentSelection: true.
   339     self searchNextTextIncludingCurrentSelection: true.
   340     self setFocusToSearchTextView.
   340     self setFocusToSearchTextView.
   341     self class lastMatch: self matchHolder value.
   341     self class lastMatch: self matchHolder value.
       
   342 !
       
   343 
       
   344 searchTextModifiedHolderChanged
       
   345 
       
   346     |searchPattern|
       
   347 
       
   348     super searchTextModifiedHolderChanged.
       
   349 
       
   350     searchPattern := self searchText.
       
   351 "/    Transcript showCR: searchPattern.
       
   352     textView setSearchPattern: searchPattern.
   342 ! !
   353 ! !
   343 
   354 
   344 !StringSearchToolForTextView methodsFor:'initialization & release'!
   355 !StringSearchToolForTextView methodsFor:'initialization & release'!
   345 
   356 
   346 postBuildSearchTextView: anEditFieldView
   357 postBuildSearchTextView: anEditFieldView
   383 !
   394 !
   384 
   395 
   385 searchPreviousTextReachBeginning
   396 searchPreviousTextReachBeginning
   386     |message searchText match |
   397     |message searchText match |
   387 
   398 
   388     searchText := searchTextView contents.
   399     searchText := self searchText.
   389     match := self matchHolder value.
   400     match := self matchHolder value.
   390 
   401 
   391     match ifTrue: [
   402     match ifTrue: [
   392         searchText := self trimMatchPattern: searchText.
   403         searchText := self trimMatchPattern: searchText.
   393         (searchText includes: $*) ifTrue: [
   404         (searchText includes: $*) ifTrue: [
   411 !
   422 !
   412 
   423 
   413 searchNextTextFromBeginning
   424 searchNextTextFromBeginning
   414     |searchText ignoreCase match absentBlock|
   425     |searchText ignoreCase match absentBlock|
   415 
   426 
   416     searchText := searchTextView contents.
   427     searchText := self searchText.
   417     searchText isEmptyOrNil ifTrue:[^self].
   428     searchText isEmptyOrNil ifTrue:[^self].
   418     self textView isNil ifTrue:[^ self].
   429     self textView isNil ifTrue:[^ self].
   419     ignoreCase := self ignoreCase.
   430     ignoreCase := self ignoreCase.
   420     match := self matchHolder value.
   431     match := self matchHolder value.
   421     absentBlock := [self searchTextNotFound.].
   432     absentBlock := [self searchTextNotFound.].
   430 
   441 
   431 searchNextTextIncludingCurrentSelection: includeCurrentSelection
   442 searchNextTextIncludingCurrentSelection: includeCurrentSelection
   432     |searchText ignoreCase  match absentBlock startCol startLine |
   443     |searchText ignoreCase  match absentBlock startCol startLine |
   433 
   444 
   434     self searchTextStarted.
   445     self searchTextStarted.
   435     searchText := searchTextView contents.
   446     searchText := self searchText.
   436     searchText isEmptyOrNil ifTrue:[^self].
   447     searchText isEmptyOrNil ifTrue:[^self].
   437     self textView isNil ifTrue:[^ self].
   448     self textView isNil ifTrue:[^ self].
   438     ignoreCase := self ignoreCase.
   449     ignoreCase := self ignoreCase.
   439     match := self matchHolder value.
   450     match := self matchHolder value.
   440     absentBlock := [self searchNextTextReachEnd].
   451     absentBlock := [self searchNextTextReachEnd].
   455 searchPreviousText
   466 searchPreviousText
   456 
   467 
   457     |searchText ignoreCase match absentBlock|
   468     |searchText ignoreCase match absentBlock|
   458 
   469 
   459     self searchTextStarted.
   470     self searchTextStarted.
   460     searchText := searchTextView contents.
   471     searchText := self searchText.
   461     searchText isEmptyOrNil ifTrue:[^self].
   472     searchText isEmptyOrNil ifTrue:[^self].
   462     ignoreCase := self ignoreCase.
   473     ignoreCase := self ignoreCase.
   463     self textView isNil ifTrue:[^ self].
   474     self textView isNil ifTrue:[^ self].
   464     match := self matchHolder value.
   475     match := self matchHolder value.
   465     match ifTrue: [
   476     match ifTrue: [
   471 
   482 
   472 searchPreviousTextFromEnd
   483 searchPreviousTextFromEnd
   473 
   484 
   474     |searchText ignoreCase absentBlock startLine startCol|
   485     |searchText ignoreCase absentBlock startLine startCol|
   475 
   486 
   476     searchText := searchTextView contents.
   487     searchText := self searchText.
   477     searchText isEmptyOrNil ifTrue:[^self].
   488     searchText isEmptyOrNil ifTrue:[^self].
   478     ignoreCase := self ignoreCase.
   489     ignoreCase := self ignoreCase.
   479     self textView isNil ifTrue:[^ self].
   490     self textView isNil ifTrue:[^ self].
   480     absentBlock := [self searchTextNotFound.].
   491     absentBlock := [self searchTextNotFound.].
   481     startLine := self textView numberOfLines + 1.
   492     startLine := self textView numberOfLines + 1.
   489 ! !
   500 ! !
   490 
   501 
   491 !StringSearchToolForTextView class methodsFor:'documentation'!
   502 !StringSearchToolForTextView class methodsFor:'documentation'!
   492 
   503 
   493 version
   504 version
   494     ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchToolForTextView.st,v 1.14 2009-10-12 13:26:37 fm Exp $'
   505     ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchToolForTextView.st,v 1.15 2009-10-16 09:55:03 fm Exp $'
   495 !
   506 !
   496 
   507 
   497 version_CVS
   508 version_CVS
   498     ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchToolForTextView.st,v 1.14 2009-10-12 13:26:37 fm Exp $'
   509     ^ '$Header: /cvs/stx/stx/libtool/Tools__StringSearchToolForTextView.st,v 1.15 2009-10-16 09:55:03 fm Exp $'
   499 ! !
   510 ! !