--- a/Tools__SearchDialog.st Fri Jun 10 04:05:55 2016 +0000
+++ b/Tools__SearchDialog.st Mon Jun 13 14:29:29 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2000 by eXept Software AG
All Rights Reserved
@@ -23,7 +25,8 @@
searchInstanceProtocolHolder selectorOrCode selectionList
listHolder matchProcess inputField showMetaFilter
metaclassesOnlyHolder classesOnlyHolder initialText
- withSearchStringInLiterals searchStringInLiteralsHolder'
+ withSearchStringInLiterals searchStringInLiteralsHolder
+ searchFreeStandingWordsOnlyHolder withSearchFreeStandingWordsOnly'
classVariableNames:'LastCodeSearched LastCodeSearchWasMethod LastGlobalSearched
LastStringSearched LastSearchWasMatch LastSearchWasCaseSensitive
LastStringSearchArea LastCodeSearchArea AREA_LISTOFMETHODS
@@ -149,6 +152,9 @@
#searchStringInLiterals
'Search string in literal constants; not in source code'
+#searchFreeStandingWordsOnly
+'Search for free-standing words only (i.e. not substrings)'
+
#match
'Perform a pattern match search, as opposed to an exact string search.\Pattern is a simple GLOB pattern (as in filenames)'
@@ -187,6 +193,12 @@
showMetaFilter := aBoolean.
!
+withSearchFreeStandingWordsOnly:aBoolean
+ "enable another checkbox, to allow searching for full words only"
+
+ withSearchFreeStandingWordsOnly := aBoolean.
+!
+
withSearchStringInLiterals:aBoolean
"enable another checkbox, to allow searching for a string
in the literals only"
@@ -244,6 +256,14 @@
^ whereRadioGroup value.
!
+searchFreeStandingWordsOnly
+ "the value of the corresponding check toggle;
+ if on, only free standing words match - i.e. the searched word
+ may not be part of a longer word"
+
+ ^ searchFreeStandingWordsOnlyHolder value ? false.
+!
+
searchIgnoringCase
^ self searchIsCaseSensitive not
!
@@ -579,6 +599,10 @@
currentPanel := self.
self addCheckBoxForSearchInLiteralsOnly
].
+ (withSearchFreeStandingWordsOnly ? false) ifTrue:[
+ currentPanel := self.
+ self addCheckBoxForSearchFreeStandingWordsOnly
+ ].
self addHorizontalLine.
@@ -957,6 +981,20 @@
^ b.
!
+addCheckBoxForSearchFreeStandingWordsOnly
+ |p b|
+
+ p := View new.
+
+ b := CheckBox label:(resources string:'Search Free Standing Words Only') in:p.
+ b model:(searchFreeStandingWordsOnlyHolder := false asValue).
+ p helpKey:#searchFreeStandingWordsOnly.
+ self makeTabable:b.
+
+ currentPanel add:p.
+ ^ nil.
+!
+
addCheckBoxForSearchInLiteralsOnly
|p b|