--- a/Tools__SearchDialog.st Sun Jan 12 23:30:25 2014 +0000
+++ b/Tools__SearchDialog.st Wed Apr 01 10:38:01 2015 +0100
@@ -22,7 +22,7 @@
allowBuffer allowBrowser searchWhat searchClassProtocolHolder
searchInstanceProtocolHolder selectorOrCode selectionList
listHolder matchProcess inputField showMetaFilter
- metaclassesOnlyHolder classesOnlyHolder'
+ metaclassesOnlyHolder classesOnlyHolder initialText'
classVariableNames:'LastCodeSearched LastCodeSearchWasMethod LastGlobalSearched
LastStringSearched LastSearchWasMatch LastSearchWasCaseSensitive
LastStringSearchArea LastCodeSearchArea AREA_LISTOFMETHODS
@@ -75,7 +75,13 @@
!SearchDialog methodsFor:'accessing'!
+currentPackage
+ ^ currentPackage
+!
+initialText:aString
+ initialText := aString.
+!
showMetaFilter:something
showMetaFilter := something.
@@ -206,7 +212,9 @@
!SearchDialog methodsFor:'public'!
-addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch
+addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch
+ |initialMatch initialCaseSensitive|
+
matchHolder := caseHolder := nil.
searchWhat == #code ifTrue:[
@@ -216,14 +224,22 @@
self addInputFieldForSelectorOrNameOrString.
withCaseIgnore ifTrue:[
+ initialCaseSensitive := false.
+ (searchWhat ~~ #resource) ifTrue:[
+ initialCaseSensitive := (LastSearchWasCaseSensitive ? false)
+ ].
self
addCheckBox:(resources string:'Case Sensitive')
- on:(caseHolder := (LastSearchWasCaseSensitive ? false) asValue).
+ on:(caseHolder := initialCaseSensitive asValue).
].
withMatch ifTrue:[
+ initialMatch := true.
+ (searchWhat ~~ #resource) ifTrue:[
+ initialMatch := (LastSearchWasMatch ? true)
+ ].
self
addCheckBox:(resources string:'Match')
- on:(matchHolder := (LastSearchWasMatch ? true) asValue).
+ on:(matchHolder := initialMatch asValue).
"/ (isSelector and:[ sel notNil. ]) ifTrue:[
"/ sel includesMatchCharacters ifTrue:[
"/ matchHolder value:false.
@@ -256,7 +272,10 @@
(selectionList notNil and:[selectionList hasSelection]) ifTrue:[
sel := selectionList selectionValue.
] ifFalse:[
- sel := selectorHolder value withoutSeparators.
+ sel := selectorHolder value.
+ searchWhat ~~ #string ifTrue:[
+ sel := sel withoutSeparators.
+ ].
].
sel isEmptyOrNil ifTrue:[
browser warn:((searchWhat == #selector)
@@ -277,7 +296,7 @@
(sel startsWith:'#''') ifTrue:[
sel := sel copyFrom:3.
(sel endsWith:$') ifTrue:[
- sel := sel copyButLast:1.
+ sel := sel copyButLast.
].
].
]
@@ -348,11 +367,18 @@
!
setupToAskForMethodSearchTitle:title forBrowser:brwsrArg searchWhat:searchWhatArg
- searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch
- withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg
- allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg
+ searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch
+ withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg
+ allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg
- |where ns methodNameSpaces methodPackages hPanel leftVerticalPanel rightVerticalPanel|
+ "searchWhat:
+ one of:#selector
+ searchArea:
+ one of: #everywhere
+ "
+
+ |where ns methodNameSpaces methodPackages hPanel
+ leftVerticalPanel rightVerticalPanel updateListAction|
allowFind := allowFindArg.
allowBuffer := allowBufferArg.
@@ -413,7 +439,7 @@
whereRadioGroup := RadioButtonGroup new.
- (selectedCategories size > 0 or:[ selectedClasses size > 0 ]) ifTrue:[
+ (selectedCategories notEmptyOrNil or:[ selectedClasses notEmptyOrNil ]) ifTrue:[
self addCheckBoxForEverywhere.
"/ classMethodListView notNil ifTrue:[
"/ b := CheckBox label:(resources string:'Shown Methods').
@@ -433,7 +459,7 @@
currentNamespace := methodNameSpaces first.
] ifFalse:[
currentNamespace := browser currentNamespace.
- selectedClasses size == 0 ifTrue:[
+ selectedClasses isEmptyOrNil ifTrue:[
|classesInAllSelectedCategories nameSpacesOfAllClassesInAllSelectedCategories|
classesInAllSelectedCategories := Smalltalk allClasses select:[:cls | selectedCategories includes:cls category].
nameSpacesOfAllClassesInAllSelectedCategories := classesInAllSelectedCategories collect:[:eachClass | eachClass topNameSpace].
@@ -475,10 +501,10 @@
].
].
- selectedCategories size > 0 ifTrue:[
+ selectedCategories notEmptyOrNil ifTrue:[
self addCheckBoxForSelectedClassCategory.
].
- (selectedClasses size > 0 or:[ selectedMethods size > 0 ]) ifTrue:[
+ (selectedClasses notEmptyOrNil or:[ selectedMethods notEmptyOrNil ]) ifTrue:[
self addCheckBoxForSelectedClass.
self addCheckBoxForSelectedClassAndSuperclasses.
self addCheckBoxForSelectedClassAndSubclasses.
@@ -503,14 +529,14 @@
].
].
].
- searchAreas size == 0 ifTrue:[
+ searchAreas isEmptyOrNil ifTrue:[
self addCheckBoxForEverywhere.
].
self addCheckBoxForChangedClassesList.
withMethodList ifTrue:[
browser isMethodListBrowser ifTrue:[
- searchAreas size == 0 ifTrue:[
+ searchAreas isEmptyOrNil ifTrue:[
self addCheckBoxForEverywhere.
].
self addCheckBoxForMethodList.
@@ -518,14 +544,14 @@
self addCheckBoxForSelectedMethodClasses.
self addCheckBoxForSelectedMethodPackages.
] ifFalse:[
- searchAreas size == 0 ifTrue:[
+ searchAreas isEmptyOrNil ifTrue:[
self addCheckBoxForEverywhere.
].
self addCheckBoxForChangedMethodList.
].
].
- searchAreas size == 0 ifTrue:[
+ searchAreas isEmptyOrNil ifTrue:[
whereRadioGroup := #everywhere asValue.
self addDummyCheckBoxForEverywhere.
] ifFalse:[
@@ -572,13 +598,13 @@
"/ not yet implemented
"/ self addHorizontalLine.
"/ self addCheckBoxesForClassAndMetaSearch.
+ updateListAction := [ self updateListOfMatchingSelectorsFor:inputField contents ].
selectionList := self addFilteredListOfMatchingSelectors.
self stickAtBottomWithVariableHeight:selectionList.
- matchHolder notNil ifTrue:[
- matchHolder onChangeEvaluate:[ self updateListOfMatchingSelectorsFor:inputField contents ]
- ].
- inputField notNil ifTrue:[ self updateListOfMatchingSelectorsFor:inputField contents ].
+ matchHolder notNil ifTrue:[ matchHolder onChangeEvaluate:updateListAction ].
+ caseHolder notNil ifTrue:[ caseHolder onChangeEvaluate:updateListAction ].
+ inputField notNil ifTrue:updateListAction.
] ifFalse:[
self addHorizontalLine.
].
@@ -601,7 +627,7 @@
addCheckBoxForChangedClassesList
|b|
- b := CheckBox label:(resources string:'Changed Classes').
+ b := RadioButton "CheckBox" label:(resources string:'Changed Classes').
self addCheckBox:b forSearchArea:#listOfChangedClasses.
ChangeSet current changedClasses isEmpty ifTrue:[
b disable
@@ -612,7 +638,7 @@
addCheckBoxForChangedMethodList
|b|
- b := CheckBox label:(resources string:'Changed Methods').
+ b := RadioButton "CheckBox" label:(resources string:'Changed Methods').
self addCheckBox:b forSearchArea:#listOfChangedMethods.
ChangeSet current changeSelectors isEmpty ifTrue:[
b disable
@@ -623,8 +649,7 @@
addCheckBoxForClassesNamespace:ns
|b|
- b := CheckBox
- label:(resources string:'Classes'' nameSpace ("%1")' with:ns name).
+ b := RadioButton "CheckBox" label:(resources string:'Classes'' nameSpace ("%1")' with:ns name).
self addCheckBox:b forSearchArea:#currentClassesNameSpace.
^ b.
!
@@ -632,8 +657,7 @@
addCheckBoxForClassesPackage:pkg
|b|
- b := CheckBox
- label:(resources string:'Classes'' package ("%1")' with:pkg).
+ b := RadioButton "CheckBox" label:(resources string:'Classes'' package ("%1")' with:pkg).
self addCheckBox:b forSearchArea:#currentClassesPackage.
^ b.
@@ -643,8 +667,7 @@
addCheckBoxForCurrentNamespace
|b|
- b := CheckBox
- label:(resources string:'Current nameSpace ("%1")' with:currentNamespace name).
+ b := RadioButton "CheckBox" label:(resources string:'Current nameSpace ("%1")' with:currentNamespace name).
self addCheckBox:b forSearchArea:#currentNameSpace.
^ b.
@@ -654,8 +677,7 @@
addCheckBoxForCurrentPackage
|b|
- b := CheckBox
- label:(resources string:'Current package ("%1")' with:currentPackage).
+ b := RadioButton "CheckBox" label:(resources string:'Current package ("%1")' with:currentPackage).
self addCheckBox:b forSearchArea:#currentPackage.
^ b.
@@ -665,8 +687,7 @@
addCheckBoxForCurrentPackage:pkg
|b|
- b := CheckBox
- label:(resources string:'Classes'' package ("%1")' with:pkg).
+ b := RadioButton "CheckBox" label:(resources string:'Classes'' package ("%1")' with:pkg).
self addCheckBox:b forSearchArea:#currentClassesPackage.
^ b.
@@ -676,7 +697,7 @@
addCheckBoxForEverywhere
|b|
- b := CheckBox label:(resources string:'Everywhere').
+ b := RadioButton "CheckBox" label:(resources string:'Everywhere').
self addCheckBox:b forSearchArea:#everywhere.
^ b.
!
@@ -706,7 +727,7 @@
addCheckBoxForMethodList
|b|
- b := CheckBox label:(resources string:'Methodlist').
+ b := RadioButton "CheckBox" label:(resources string:'Methodlist').
self addCheckBox:b forSearchArea:AREA_LISTOFMETHODS.
^ b.
@@ -722,7 +743,7 @@
] ifFalse:[
lbl := 'Owners & all their private classes'.
].
- b := CheckBox label:(resources string:lbl with:arg).
+ b := RadioButton "CheckBox" label:(resources string:lbl with:arg).
self addCheckBox:b forSearchArea:#ownersWithPrivateClasses.
(selectedClasses contains:[ :cls | cls isPrivate. ]) ifFalse:[
b disable.
@@ -739,7 +760,7 @@
] ifFalse:[
lbl := 'Owners & their subclasses & all their private classes'.
].
- b := CheckBox label:(resources string:lbl with:arg).
+ b := RadioButton "CheckBox" label:(resources string:lbl with:arg).
self addCheckBox:b forSearchArea:#ownersHierarchiesWithPrivateClasses.
(selectedClasses contains:[ :cls | cls isPrivate. ]) ifFalse:[
b disable.
@@ -764,7 +785,7 @@
lbl := 'Class ("%1")'.
arg := currentClass name.
].
- b := CheckBox label:(resources string:lbl with:arg).
+ b := RadioButton "CheckBox" label:(resources string:lbl with:arg).
self addCheckBox:b forSearchArea:#classes.
^ b.
!
@@ -779,7 +800,7 @@
] ifFalse:[
lbl := 'Class & private classes'.
].
- b := CheckBox label:(resources string:lbl).
+ b := RadioButton "CheckBox" label:(resources string:lbl).
self addCheckBox:b forSearchArea:#classesWithPrivateClasses.
(selectedClasses
contains:[ :cls | cls theNonMetaclass privateClasses size > 0. ])
@@ -797,7 +818,7 @@
] ifFalse:[
lbl := 'Class & subclasses'.
].
- b := CheckBox label:(resources string:lbl).
+ b := RadioButton "CheckBox" label:(resources string:lbl).
self addCheckBox:b forSearchArea:#classHierarchies.
(selectedClasses
contains:[ :cls | cls theNonMetaclass subclasses size > 0. ])
@@ -815,7 +836,7 @@
] ifFalse:[
lbl := 'Class & subclasses & all private classes'.
].
- b := CheckBox label:(resources string:lbl).
+ b := RadioButton "CheckBox" label:(resources string:lbl).
self addCheckBox:b forSearchArea:#classHierarchiesWithPrivateClasses.
(selectedClasses
contains:[ :cls | cls theNonMetaclass privateClasses size > 0. ])
@@ -833,7 +854,7 @@
] ifFalse:[
lbl := 'Class & superclasses'.
].
- b := CheckBox label:(resources string:lbl).
+ b := RadioButton "CheckBox" label:(resources string:lbl).
self addCheckBox:b forSearchArea:#classesAndSuperclasses.
(selectedClasses
contains:[ :cls | cls theNonMetaclass superclass notNil. ])
@@ -851,7 +872,7 @@
lbl := 'Selected class categories (%1)'.
arg := selectedCategories size.
].
- b := CheckBox label:(resources string:lbl with:arg).
+ b := RadioButton "CheckBox" label:(resources string:lbl with:arg).
self addCheckBox:b forSearchArea:#classCategories.
^ b.
!
@@ -866,10 +887,10 @@
numClasses == 0 ifTrue:[^ self]. "/ comment this to show, but disabled
numClasses == 1 ifTrue:[
- b := CheckBox label:(resources string:'Selected method''s class ("%1")'
+ b := RadioButton "CheckBox" label:(resources string:'Selected method''s class ("%1")'
with:classes first name).
] ifFalse:[
- b := CheckBox label:(resources string:'Selected methods'' classes (%1)'
+ b := RadioButton "CheckBox" label:(resources string:'Selected methods'' classes (%1)'
with:numClasses).
numClasses == 0 ifTrue:[
b disable
@@ -890,10 +911,10 @@
numPackages size == 0 ifTrue:[^ self]. "/ comment this to show, but disabled
numPackages == 1 ifTrue:[
- b := CheckBox label:(resources string:'Selected method''s package ("%1")'
+ b := RadioButton "CheckBox" label:(resources string:'Selected method''s package ("%1")'
with:packages first).
] ifFalse:[
- b := CheckBox label:(resources string:'Selected methods'' packages (%1)'
+ b := RadioButton "CheckBox" label:(resources string:'Selected methods'' packages (%1)'
with:numPackages).
numPackages == 0 ifTrue:[
b disable
@@ -911,7 +932,7 @@
numSelected := browser selectedMethods value size.
numSelected == 0 ifTrue:[^ self]. "/ comment this to show, but disabled
- b := CheckBox label:(resources string:'Selected methods (%1)' with:numSelected).
+ b := RadioButton "CheckBox" label:(resources string:'Selected methods (%1)' with:numSelected).
self addCheckBox:b forSearchArea:#listOfSelectedMethods.
numSelected == 0 ifTrue:[b disable].
^ b.
@@ -929,7 +950,7 @@
lbl := 'Selected classes categories (%1)'.
arg := selectedCategories size.
].
- b := CheckBox label:(resources string:lbl with:arg).
+ b := RadioButton "CheckBox" label:(resources string:lbl with:arg).
self addCheckBox:b forSearchArea:#classCategories.
^ b.
!
@@ -951,7 +972,7 @@
addDummyCheckBoxForEverywhere
|b|
- b := CheckBox label:(resources string:'Everywhere').
+ b := RadioButton "CheckBox" label:(resources string:'Everywhere').
b turnOn.
b disable.
@@ -968,8 +989,8 @@
self addComponent:l.
l doubleClickAction:[
selectorHolder value:(l selectionValue).
- matchHolder value:false.
- caseHolder value:false.
+ matchHolder notNil ifTrue:[matchHolder value:false].
+ caseHolder notNil ifTrue:[caseHolder value:false].
self doAccept.
self okPressed.
].
@@ -979,22 +1000,26 @@
addInputFieldForSelectorOrNameOrString
|sel lastSearchPatterns|
- browser notNil ifTrue:[
- searchWhat == #selector ifTrue:[
- sel := browser selectorToSearchFor.
- ] ifFalse:[
- searchWhat == #globalName ifTrue:[
- sel := browser globalNameToSearchFor ? LastGlobalSearched.
+ initialText notNil ifTrue:[
+ sel := initialText
+ ] ifFalse:[
+ browser notNil ifTrue:[
+ searchWhat == #selector ifTrue:[
+ sel := browser selectorToSearchFor.
] ifFalse:[
- searchWhat == #string ifTrue:[
- sel := browser stringToSearchFor ? LastStringSearched.
- ] ifFalse:[
- searchWhat == #resource ifTrue:[
- sel := browser stringToSearchFor ? LastResourceSearched.
+ searchWhat == #globalName ifTrue:[
+ sel := browser globalNameToSearchFor ? LastGlobalSearched.
+ ] ifFalse:[
+ searchWhat == #string ifTrue:[
+ sel := browser stringToSearchFor ? LastStringSearched.
] ifFalse:[
- sel := browser selectorToSearchFor.
+ searchWhat == #resource ifTrue:[
+ sel := browser stringToSearchFor ? LastResourceSearched.
+ ] ifFalse:[
+ sel := browser selectorToSearchFor.
+ ]
]
- ]
+ ].
].
].
].
@@ -1006,7 +1031,11 @@
sel := lastSearchPatterns first.
].
].
- selectorHolder := (sel ? '') withoutSeparators asValue.
+ searchWhat == #string ifTrue:[
+ selectorHolder := (sel ? '') asValue.
+ ] ifFalse:[
+ selectorHolder := (sel ? '') withoutSeparators asValue.
+ ].
inputField := self addComboBoxOn:selectorHolder tabable:true.
inputField list:lastSearchPatterns.
@@ -1392,17 +1421,12 @@
!SearchDialog class methodsFor:'documentation'!
-version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.76 2013-04-25 13:11:05 stefan Exp $'
+version
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__SearchDialog.st,v 1.87 2015-02-28 23:43:11 cg Exp $'
!
-version_HG
-
- ^ '$Changeset: <not expanded> $'
-!
-
-version_SVN
- ^ '$Id: Tools__SearchDialog.st 8083 2013-01-14 11:48:37Z vranyj1 $'
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__SearchDialog.st,v 1.87 2015-02-28 23:43:11 cg Exp $'
! !