author | Claus Gittinger <cg@exept.de> |
Wed, 13 Jul 2005 17:36:28 +0200 | |
changeset 6351 | 1db1881129a3 |
parent 6242 | 53a88bc35aa5 |
child 6379 | 443b9d779656 |
permissions | -rw-r--r-- |
5591 | 1 |
" |
2 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
5592 | 13 |
"{ Package: 'stx:libtool' }" |
5591 | 14 |
|
15 |
"{ NameSpace: Tools }" |
|
16 |
||
17 |
DialogBox subclass:#SearchDialog |
|
18 |
instanceVariableNames:'openHow classes methods selectedClasses selectedCategories |
|
19 |
selectedMethods currentClass currentNamespace |
|
20 |
currentClassCategory browser whereRadioGroup verticalPanel |
|
21 |
searchAreas caseHolder matchHolder isMethodHolder codeField |
|
22 |
selectorHolder defaultOpenHow withTextEntry allowFind allowBuffer |
|
23 |
allowBrowser isSelector' |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
24 |
classVariableNames:'LastCodeSearched LastCodeSearchWasMethod LastGlobalSearched |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
25 |
LastSearchWasMatch LastSearchWasIgnoringCase' |
5591 | 26 |
poolDictionaries:'' |
27 |
category:'Interface-Browsers-New' |
|
28 |
! |
|
29 |
||
30 |
!SearchDialog class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
35 |
All Rights Reserved |
|
36 |
||
37 |
This software is furnished under a license and may be used |
|
38 |
only in accordance with the terms of that license and with the |
|
39 |
inclusion of the above copyright notice. This software may not |
|
40 |
be provided or otherwise made available to, or used by, any |
|
41 |
other person. No title to or ownership of the software is |
|
42 |
hereby transferred. |
|
43 |
" |
|
44 |
! ! |
|
45 |
||
46 |
!SearchDialog methodsFor:'private'! |
|
47 |
||
48 |
showHelpOnCodePatterns |
|
49 |
HTMLDocumentView openFullOnHelpFile:'Browser/RBSearchPatterns.html' |
|
50 |
! ! |
|
51 |
||
52 |
!SearchDialog methodsFor:'public'! |
|
53 |
||
6242 | 54 |
addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch |
55 |
isSelector == #code ifTrue:[ |
|
56 |
self addTextEntryFieldForCode. |
|
57 |
] ifFalse:[ |
|
58 |
self addInputFieldForSelectorOrNameOrString. |
|
59 |
withCaseIgnore ifTrue:[ |
|
60 |
self addCheckBox:(resources string:'Ignore case') |
|
61 |
on:(caseHolder := (LastSearchWasIgnoringCase ? false) asValue). |
|
62 |
]. |
|
63 |
withMatch ifTrue:[ |
|
64 |
self addCheckBox:(resources string:'Match') |
|
65 |
on:(matchHolder := (LastSearchWasMatch ? true) asValue). |
|
66 |
"/ (isSelector and:[ sel notNil. ]) ifTrue:[ |
|
67 |
"/ sel includesMatchCharacters ifTrue:[ |
|
68 |
"/ matchHolder value:false. |
|
69 |
"/ ]. |
|
70 |
"/ ]. |
|
71 |
]. |
|
72 |
] |
|
73 |
! |
|
74 |
||
5591 | 75 |
askThenDo:aBlock |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
76 |
|where code sel matchHolderValue caseHolderValue| |
5591 | 77 |
|
78 |
self open. |
|
79 |
self accepted ifFalse:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
80 |
^ self. |
5591 | 81 |
]. |
82 |
||
83 |
openHow isNil ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
84 |
openHow := defaultOpenHow. |
5591 | 85 |
]. |
86 |
where := whereRadioGroup value. |
|
87 |
withTextEntry ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
88 |
isSelector == #code ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
89 |
code := codeField contentsAsString. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
90 |
LastCodeSearched := code. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
91 |
] ifFalse:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
92 |
sel := selectorHolder value. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
93 |
sel isEmpty ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
94 |
browser warn:(isSelector |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
95 |
ifTrue:[ 'No selector entered for search'. ] |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
96 |
ifFalse:[ 'Nothing entered for search'. ]). |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
97 |
^ self. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
98 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
99 |
sel := sel string. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
100 |
browser rememberSearchPattern:sel. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
101 |
isSelector == #globalName ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
102 |
LastGlobalSearched := sel. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
103 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
104 |
]. |
5591 | 105 |
]. |
106 |
where isNil ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
107 |
browser warn:'No class(es) for search'. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
108 |
^ self. |
5591 | 109 |
]. |
110 |
||
111 |
self getClassesAndMethodsFor:where. |
|
112 |
(#(#classesWithPrivateClasses #classHierarchiesWithPrivateClasses #ownersWithPrivateClasses #ownersHierarchiesWithPrivateClasses) |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
113 |
includes:where) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
114 |
ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
115 |
|toSearch| |
5591 | 116 |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
117 |
toSearch := IdentitySet withAll:classes. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
118 |
classes := IdentitySet withAll:toSearch. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
119 |
[ toSearch notEmpty. ] whileTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
120 |
|cls| |
5591 | 121 |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
122 |
cls := toSearch removeFirst. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
123 |
classes addAll:cls allPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
124 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
125 |
]. |
5591 | 126 |
|
127 |
classes size == 0 ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
128 |
classes := nil. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
129 |
methods size == 0 ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
130 |
browser warn:'No class(es) given for search.'. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
131 |
^ self. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
132 |
]. |
5591 | 133 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
134 |
classes := classes asOrderedCollection. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
135 |
methods size ~~ 0 ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
136 |
browser warn:'oops'. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
137 |
methods := nil. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
138 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
139 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
140 |
|
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
141 |
|
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
142 |
matchHolderValue := matchHolder value. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
143 |
matchHolderValue notNil ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
144 |
LastSearchWasMatch := matchHolderValue |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
145 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
146 |
caseHolderValue := caseHolder value. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
147 |
caseHolderValue notNil ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
148 |
LastSearchWasIgnoringCase := caseHolderValue |
5591 | 149 |
]. |
150 |
||
151 |
aBlock |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
152 |
value:classes |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
153 |
value:(sel ? code) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
154 |
value:(caseHolderValue ? false) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
155 |
value:openHow |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
156 |
value:(matchHolderValue ? false) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
157 |
value:methods |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
158 |
value:(isMethodHolder value ? false). |
5591 | 159 |
! |
160 |
||
6242 | 161 |
setupToAskForMethodSearchTitle:title forBrowser:brwsrArg isSelector:isSelectorArg searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg |
162 |
|where ns methodNameSpaces| |
|
5591 | 163 |
|
164 |
allowFind := allowFindArg. |
|
165 |
allowBuffer := allowBufferArg. |
|
166 |
allowBrowser := allowBrowserArg. |
|
167 |
isSelector := isSelectorArg. |
|
168 |
withTextEntry := withTextEntryArg. |
|
169 |
browser := brwsrArg. |
|
170 |
resources := browser resources. |
|
171 |
||
6351 | 172 |
(self addTextLabel:(resources stringWithCRs:title)) adjust:#left. |
5591 | 173 |
selectedClasses := browser selectedClasses value. |
174 |
selectedCategories := browser selectedCategoriesValue. |
|
175 |
selectedMethods := browser selectedMethods value. |
|
176 |
currentClass := browser theSingleSelectedClass. |
|
177 |
currentClassCategory := browser theSingleSelectedCategory. |
|
6242 | 178 |
currentClass isNil ifTrue:[ |
179 |
browser hasMethodSelected ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
180 |
currentClass := selectedMethods first mclass. |
6242 | 181 |
selectedClasses := (selectedMethods collect:[:each | each mclass ]) |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
182 |
asIdentitySet. |
6242 | 183 |
selectedClasses := selectedClasses select:[:each | each notNil ]. |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
184 |
]. |
5591 | 185 |
]. |
6242 | 186 |
currentClass notNil ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
187 |
currentClass := currentClass theNonMetaclass. |
5591 | 188 |
]. |
6242 | 189 |
withTextEntry ifTrue:[ |
190 |
self addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch. |
|
5591 | 191 |
]. |
192 |
searchAreas := OrderedCollection new. |
|
193 |
verticalPanel := VerticalPanelView new. |
|
194 |
verticalPanel horizontalLayout:#fitSpace. |
|
195 |
self addHorizontalLine. |
|
196 |
self addVerticalSpace. |
|
197 |
(self addTextLabel:(resources string:'Search in:')) adjust:#left. |
|
198 |
whereRadioGroup := RadioButtonGroup new. |
|
6242 | 199 |
(selectedCategories size > 0 or:[ selectedClasses size > 0 ]) ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
200 |
self addCheckBoxForEverywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
201 |
"/ classMethodListView notNil ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
202 |
"/ b := CheckBox label:(resources string:'Shown Methods'). |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
203 |
"/ panel add:b. whereChannel add:b value:#currentMethodList. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
204 |
"/ areas add:#currentMethodList. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
205 |
"/ self makeTabable:b. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
206 |
"/ ]. |
6242 | 207 |
browser isMethodListBrowser ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
208 |
methodNameSpaces := (browser selectedMethods value ? #()) |
6242 | 209 |
collect:[:eachMethod | eachMethod mclass topNameSpace ]. |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
210 |
]. |
6242 | 211 |
methodNameSpaces size == 1 ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
212 |
currentNamespace := methodNameSpaces first. |
6242 | 213 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
214 |
currentNamespace := browser currentNamespace. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
215 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
216 |
(currentNamespace notNil |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
217 |
and:[ currentNamespace ~= (browser nameListEntryForALL) ]) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
218 |
ifTrue:[ self addCheckBoxForCurrentNamespace ] |
6242 | 219 |
ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
220 |
(currentClass notNil |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
221 |
and:[ (ns := currentClass nameSpace) notNil and:[ ns ~~ Smalltalk ] ]) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
222 |
ifTrue:[ self addCheckBoxForClassesNamespace:ns ]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
223 |
]. |
6242 | 224 |
selectedCategories size > 0 ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
225 |
self addCheckBoxForSelectedClassCategory. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
226 |
]. |
6242 | 227 |
(selectedClasses size > 0 or:[ selectedMethods size > 0 ]) ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
228 |
self addCheckBoxForSelectedClass. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
229 |
self addCheckBoxForSelectedClassAndSuperclasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
230 |
self addCheckBoxForSelectedClassAndSubclasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
231 |
self addCheckBoxForSelectedClassAndPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
232 |
self addCheckBoxForSelectedClassAndSubclassesAndPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
233 |
self addCheckBoxForOwnerAndItsPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
234 |
self addCheckBoxForOwnerAndItsSubclassesAndItsPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
235 |
]. |
6242 | 236 |
] ifFalse:[ |
237 |
browser currentNamespace ~~ Smalltalk ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
238 |
self addCheckBoxForEverywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
239 |
currentNamespace := browser currentNamespace. |
6242 | 240 |
currentNamespace ~= (browser nameListEntryForALL) ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
241 |
self addCheckBoxForCurrentNamespace. |
6242 | 242 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
243 |
(currentClass notNil |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
244 |
and:[ (ns := currentClass nameSpace) notNil and:[ ns ~~ Smalltalk ] ]) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
245 |
ifTrue:[ self addCheckBoxForClassesNamespace:ns ]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
246 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
247 |
]. |
5591 | 248 |
]. |
6242 | 249 |
(withMethodList and:[ browser isMethodListBrowser ]) ifTrue:[ |
250 |
searchAreas size == 0 ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
251 |
self addCheckBoxForEverywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
252 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
253 |
self addCheckBoxForMethodList. |
6242 | 254 |
browser selectedMethods value size > 1 ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
255 |
self addCheckBoxForSelectedMethods. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
256 |
]. |
5591 | 257 |
]. |
6242 | 258 |
searchAreas size == 0 ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
259 |
whereRadioGroup := #everywhere asValue. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
260 |
self addDummyCheckBoxForEverywhere. |
6242 | 261 |
] ifFalse:[ |
262 |
whereDefault notNil ifTrue:[ |
|
263 |
(searchAreas includes:whereDefault) ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
264 |
where := whereDefault asSymbol. |
6242 | 265 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
266 |
where := searchAreas first. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
267 |
]. |
6242 | 268 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
269 |
where := #everywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
270 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
271 |
whereRadioGroup value:where. |
5591 | 272 |
]. |
273 |
self addComponent:verticalPanel indent:0. |
|
274 |
||
275 |
"/ panel has its own idea of indenting |
|
276 |
self addVerticalSpace. |
|
277 |
self addHorizontalLine. |
|
278 |
self addButtons. |
|
279 |
self label:(resources string:'Search'). |
|
280 |
! ! |
|
281 |
||
282 |
!SearchDialog methodsFor:'setup'! |
|
283 |
||
284 |
addCheckBox:b forSearchArea:area |
|
285 |
verticalPanel add:b. |
|
286 |
whereRadioGroup add:b value:area. |
|
287 |
searchAreas add:area. |
|
288 |
self makeTabable:b. |
|
289 |
! |
|
290 |
||
291 |
addCheckBoxForClassesNamespace:ns |
|
292 |
|b| |
|
293 |
||
294 |
b := CheckBox |
|
295 |
label:(resources string:'Classes nameSpace (''%1'')' with:ns name). |
|
296 |
self addCheckBox:b forSearchArea:#currentClassesNameSpace. |
|
297 |
^ b. |
|
298 |
! |
|
299 |
||
300 |
addCheckBoxForCurrentNamespace |
|
301 |
|b| |
|
302 |
||
303 |
b := CheckBox label:(resources string:'Current nameSpace (''%1'')' |
|
304 |
with:currentNamespace name). |
|
305 |
self addCheckBox:b forSearchArea:#currentNameSpace. |
|
306 |
^ b. |
|
307 |
! |
|
308 |
||
309 |
addCheckBoxForEverywhere |
|
310 |
|b| |
|
311 |
||
312 |
b := CheckBox label:(resources string:'Everywhere'). |
|
313 |
self addCheckBox:b forSearchArea:#everywhere. |
|
314 |
^ b. |
|
315 |
! |
|
316 |
||
317 |
addCheckBoxForMethodList |
|
318 |
|b| |
|
319 |
||
320 |
b := CheckBox label:(resources string:'Methodlist'). |
|
321 |
self addCheckBox:b forSearchArea:#listOfMethods. |
|
322 |
^ b. |
|
323 |
! |
|
324 |
||
325 |
addCheckBoxForOwnerAndItsPrivateClasses |
|
326 |
|b lbl| |
|
327 |
||
328 |
(currentClass notNil and:[ currentClass isPrivate. ]) ifTrue:[ |
|
329 |
lbl := resources string:'Owner (%1) & all its private classes' |
|
330 |
with:currentClass owningClass name. |
|
331 |
] ifFalse:[ |
|
332 |
lbl := resources string:'Owners & all their private classes'. |
|
333 |
]. |
|
334 |
b := CheckBox label:lbl. |
|
335 |
self addCheckBox:b forSearchArea:#ownersWithPrivateClasses. |
|
336 |
(selectedClasses contains:[ :cls | cls isPrivate. ]) ifFalse:[ |
|
337 |
b disable. |
|
338 |
]. |
|
339 |
^ b. |
|
340 |
! |
|
341 |
||
342 |
addCheckBoxForOwnerAndItsSubclassesAndItsPrivateClasses |
|
343 |
|b lbl| |
|
344 |
||
345 |
(currentClass notNil and:[ currentClass isPrivate. ]) ifTrue:[ |
|
346 |
lbl := resources |
|
347 |
string:'Owner (%1) & its subclasses & all its private classes' |
|
348 |
with:currentClass owningClass name. |
|
349 |
] ifFalse:[ |
|
350 |
lbl := resources |
|
351 |
string:'Owners & their subclasses & all their private classes'. |
|
352 |
]. |
|
353 |
b := CheckBox label:lbl. |
|
354 |
self addCheckBox:b forSearchArea:#ownersHierarchiesWithPrivateClasses. |
|
355 |
(selectedClasses contains:[ :cls | cls isPrivate. ]) ifFalse:[ |
|
356 |
b disable. |
|
357 |
]. |
|
358 |
^ b. |
|
359 |
! |
|
360 |
||
361 |
addCheckBoxForSelectedClass |
|
362 |
|b lbl| |
|
363 |
||
364 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
365 |
selectedClasses size == 1 ifTrue:[ |
|
366 |
lbl := resources string:'Selected class (''%1'')' |
|
367 |
with:selectedClasses first theNonMetaclass name. |
|
368 |
] ifFalse:[ |
|
369 |
lbl := resources string:'Selected classes (%1)' with:selectedClasses size. |
|
370 |
]. |
|
371 |
] ifFalse:[ |
|
372 |
lbl := resources string:'Class (''%1'')' with:currentClass name. |
|
373 |
]. |
|
374 |
b := CheckBox label:lbl. |
|
375 |
self addCheckBox:b forSearchArea:#classes. |
|
376 |
^ b. |
|
377 |
! |
|
378 |
||
379 |
addCheckBoxForSelectedClassAndPrivateClasses |
|
380 |
|b lbl| |
|
381 |
||
382 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
383 |
lbl := 'Selected classes & all private classes'. |
|
384 |
] ifFalse:[ |
|
385 |
lbl := 'Class & private classes'. |
|
386 |
]. |
|
387 |
b := CheckBox label:(resources string:lbl). |
|
388 |
self addCheckBox:b forSearchArea:#classesWithPrivateClasses. |
|
389 |
(selectedClasses |
|
390 |
contains:[ :cls | cls theNonMetaclass privateClasses size > 0. ]) |
|
391 |
ifFalse:[ b disable. ]. |
|
392 |
^ b. |
|
393 |
! |
|
394 |
||
395 |
addCheckBoxForSelectedClassAndSubclasses |
|
396 |
|b lbl| |
|
397 |
||
398 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
399 |
lbl := 'Selected classes & all subclasses'. |
|
400 |
] ifFalse:[ |
|
401 |
lbl := 'Class & subclasses'. |
|
402 |
]. |
|
403 |
b := CheckBox label:(resources string:lbl). |
|
404 |
self addCheckBox:b forSearchArea:#classHierarchies. |
|
405 |
(selectedClasses |
|
406 |
contains:[ :cls | cls theNonMetaclass subclasses size > 0. ]) |
|
407 |
ifFalse:[ b disable. ]. |
|
408 |
^ b. |
|
409 |
! |
|
410 |
||
411 |
addCheckBoxForSelectedClassAndSubclassesAndPrivateClasses |
|
412 |
|b lbl| |
|
413 |
||
414 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
415 |
lbl := 'Selected classes & all subclasses & all private classes'. |
|
416 |
] ifFalse:[ |
|
417 |
lbl := 'Class & subclasses & all private classes'. |
|
418 |
]. |
|
419 |
b := CheckBox label:(resources string:lbl). |
|
420 |
self addCheckBox:b forSearchArea:#classHierarchiesWithPrivateClasses. |
|
421 |
(selectedClasses |
|
422 |
contains:[ :cls | cls theNonMetaclass privateClasses size > 0. ]) |
|
423 |
ifFalse:[ b disable. ]. |
|
424 |
^ b. |
|
425 |
! |
|
426 |
||
427 |
addCheckBoxForSelectedClassAndSuperclasses |
|
428 |
|b lbl| |
|
429 |
||
430 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
431 |
lbl := 'Selected classes & all superclasses'. |
|
432 |
] ifFalse:[ |
|
433 |
lbl := 'Class & superclasses'. |
|
434 |
]. |
|
435 |
b := CheckBox label:(resources string:lbl). |
|
436 |
self addCheckBox:b forSearchArea:#classesAndSuperclasses. |
|
437 |
(selectedClasses |
|
438 |
contains:[ :cls | cls theNonMetaclass superclass notNil. ]) |
|
439 |
ifFalse:[ b disable. ]. |
|
440 |
^ b. |
|
441 |
! |
|
442 |
||
443 |
addCheckBoxForSelectedClassCategory |
|
444 |
|b lbl| |
|
445 |
||
446 |
currentClassCategory notNil ifTrue:[ |
|
447 |
lbl := resources string:'Class category (''%1'')' |
|
448 |
with:currentClassCategory. |
|
449 |
] ifFalse:[ |
|
450 |
lbl := resources string:'Selected classes categories (%1)' |
|
451 |
with:selectedCategories size. |
|
452 |
]. |
|
453 |
b := CheckBox label:lbl. |
|
454 |
self addCheckBox:b forSearchArea:#classCategories. |
|
455 |
^ b. |
|
456 |
! |
|
457 |
||
458 |
addCheckBoxForSelectedMethods |
|
459 |
|b| |
|
460 |
||
461 |
b := CheckBox label:(resources string:'Selected methods (%1)' |
|
462 |
with:browser selectedMethods value size). |
|
463 |
self addCheckBox:b forSearchArea:#listOfSelectedMethods. |
|
464 |
^ b. |
|
465 |
! |
|
466 |
||
467 |
addDummyCheckBoxForEverywhere |
|
468 |
|b| |
|
469 |
||
470 |
b := CheckBox label:(resources string:'Everywhere'). |
|
471 |
b turnOn. |
|
472 |
b disable. |
|
473 |
verticalPanel add:b. |
|
474 |
! |
|
475 |
||
476 |
addInputFieldForSelectorOrNameOrString |
|
477 |
|sel inputField lastSearchPatterns| |
|
478 |
||
479 |
isSelector == true ifTrue:[ |
|
5592 | 480 |
sel := browser selectorToSearchFor. |
5591 | 481 |
] ifFalse:[ |
5592 | 482 |
isSelector == #globalName ifTrue:[ |
483 |
sel := browser globalNameToSearchFor ? LastGlobalSearched. |
|
484 |
] ifFalse:[ |
|
485 |
sel := browser stringToSearchFor. |
|
486 |
]. |
|
5591 | 487 |
]. |
488 |
sel size == 0 ifTrue:[ |
|
5592 | 489 |
"/ use last searchString |
490 |
lastSearchPatterns := browser lastSearchPatterns. |
|
491 |
lastSearchPatterns size > 0 ifTrue:[ |
|
492 |
sel := lastSearchPatterns first. |
|
493 |
]. |
|
5591 | 494 |
]. |
495 |
selectorHolder := sel asValue. |
|
496 |
||
497 |
inputField := self addComboBoxOn:selectorHolder tabable:true. |
|
498 |
inputField list:lastSearchPatterns . |
|
499 |
inputField selectAll. |
|
500 |
inputField |
|
5592 | 501 |
entryCompletionBlock:[ :contents | |
502 |
|s what| |
|
5591 | 503 |
|
5592 | 504 |
s := contents withoutSpaces. |
505 |
self topView |
|
506 |
withWaitCursorDo:[ |
|
507 |
isSelector == #globalName ifFalse:[ |
|
508 |
what := Smalltalk selectorCompletion:s. |
|
509 |
] ifTrue:[ |
|
510 |
what := Smalltalk globalNameCompletion:s. |
|
511 |
]. |
|
512 |
inputField contents:what first. |
|
513 |
(what at:2) size ~~ 1 ifTrue:[ |
|
514 |
browser window beep. |
|
515 |
]. |
|
516 |
]. |
|
517 |
]. |
|
5591 | 518 |
! |
519 |
||
520 |
addTextEntryFieldForCode |
|
521 |
|initial box infoLabel helpButton errMessageField checkCodeAction| |
|
522 |
||
523 |
box := View new. |
|
524 |
box extent:(500 @ 200). |
|
525 |
||
526 |
codeField := CodeView in:box. |
|
527 |
codeField origin:0.0@0.0 corner:(0.75@1.0). |
|
528 |
||
529 |
infoLabel := Label in:box. |
|
530 |
infoLabel origin:0.75@0.0 corner:(1.0@1.0). |
|
531 |
infoLabel font:(codeField font). |
|
532 |
infoLabel label:'MetaPatterns: |
|
533 |
||
534 |
' , '`' allBold , ' = meta |
|
535 |
||
536 |
' , '@' allBold , ' = list/any |
|
537 |
' , '.' allBold , ' = statement |
|
538 |
' , '`' allBold , ' = recurse |
|
539 |
||
540 |
' , '`#n' allBold , ' any lit |
|
541 |
' , '`v' allBold , ' any var |
|
542 |
' , '`@e' allBold , ' any expr |
|
543 |
'. |
|
544 |
||
545 |
helpButton := Button label:'Pattern Help' in:box. |
|
546 |
helpButton layout:((LayoutOrigin fractionalFromPoint:0.75@1.0) |
|
547 |
leftOffset:2 |
|
548 |
topOffset:helpButton preferredExtent y negated). |
|
549 |
helpButton topInset:0.75@1.0. |
|
550 |
helpButton action:[self showHelpOnCodePatterns]. |
|
551 |
||
552 |
self addComponent:box tabable:true. |
|
553 |
errMessageField := (self addTextLabel:'') adjust:#left. |
|
554 |
errMessageField level:-1. |
|
555 |
self addCheckBox:(resources string:'Method') on:self isMethodHolder. |
|
556 |
||
557 |
checkCodeAction := [ self checkCodeIn:codeField notifying:errMessageField. ]. |
|
558 |
||
559 |
codeField modifiedChannel onChangeEvaluate:checkCodeAction. |
|
560 |
||
561 |
initial := browser selectionInCodeView. |
|
562 |
initial isEmptyOrNil ifTrue:[ |
|
563 |
initial := LastCodeSearched ? '' |
|
564 |
]. |
|
565 |
codeField contents:initial. |
|
566 |
checkCodeAction value. |
|
567 |
! |
|
568 |
||
569 |
checkCodeIn:codeField notifying:errMessageField |
|
570 |
|codeString tree errAction| |
|
571 |
||
572 |
codeString := codeField contents asString string. |
|
573 |
errAction := [:str :pos | |
|
574 |
|line col badLine| |
|
575 |
||
576 |
line := codeField lineOfCharacterPosition:pos. |
|
577 |
col := (codeField colOfCharacterPosition:pos) max:1. |
|
578 |
||
579 |
badLine := (codeField listAt:line) ? '' |
|
580 |
. col <= badLine size size ifTrue:[ |
|
581 |
codeField |
|
582 |
listAt:line |
|
583 |
put:(badLine asText |
|
584 |
emphasisAt:col |
|
585 |
put:(UserPreferences current unknownIdentifierEmphasis)). |
|
586 |
"/ codeField selectFromCharacterPosition:pos to:pos. |
|
587 |
]. |
|
588 |
errMessageField label:('[',line printString,'] ',str). |
|
589 |
codeField requestFocus. |
|
590 |
nil. |
|
591 |
]. |
|
592 |
||
593 |
isMethodHolder value ifTrue:[ |
|
594 |
tree := RBParser parseRewriteMethod:codeString onError: errAction. |
|
595 |
] ifFalse:[ |
|
596 |
tree := RBParser parseRewriteExpression:codeString onError: errAction. |
|
597 |
]. |
|
598 |
tree notNil ifTrue:[ errMessageField label:nil ]. |
|
599 |
codeField modifiedChannel setValue:false. |
|
600 |
! |
|
601 |
||
602 |
getClassesAndMethodsFor:where |
|
603 |
where == #everywhere ifTrue:[ |
|
604 |
classes := Smalltalk allClasses. |
|
605 |
^ self. |
|
606 |
]. |
|
607 |
where == #currentNameSpace ifTrue:[ |
|
608 |
classes := currentNamespace allClassesWithAllPrivateClasses. |
|
609 |
^ self. |
|
610 |
]. |
|
611 |
where == #currentClassesNameSpace ifTrue:[ |
|
612 |
currentClass isPrivate ifTrue:[ |
|
613 |
classes := currentClass topOwningClass nameSpace |
|
614 |
allClassesWithAllPrivateClasses. |
|
615 |
] ifFalse:[ |
|
616 |
classes := currentClass nameSpace allClassesWithAllPrivateClasses. |
|
617 |
]. |
|
618 |
^ self. |
|
619 |
]. |
|
620 |
where == #classCategories ifTrue:[ |
|
621 |
classes := Smalltalk allClasses |
|
622 |
select:[ :cls | selectedCategories includes:cls category. ]. |
|
623 |
classes := classes collect:[ :each | each theNonMetaclass. ]. |
|
624 |
^ self. |
|
625 |
]. |
|
626 |
(where == #classes or:[ where == #classesWithPrivateClasses. ]) ifTrue:[ |
|
627 |
classes := selectedClasses collect:[ :each | each theNonMetaclass. ]. |
|
628 |
^ self. |
|
629 |
]. |
|
630 |
(where == #classHierarchies |
|
631 |
or:[ where == #classHierarchiesWithPrivateClasses. ]) |
|
632 |
ifTrue:[ |
|
633 |
classes := IdentitySet new. |
|
634 |
selectedClasses do:[ :cls | |
|
635 |
classes addAll:cls theNonMetaclass withAllSubclasses. |
|
636 |
]. |
|
637 |
^ self. |
|
638 |
]. |
|
639 |
where == #ownersWithPrivateClasses ifTrue:[ |
|
640 |
classes := IdentitySet new. |
|
641 |
selectedClasses do:[ :cls | |
|
642 |
|c| |
|
643 |
||
644 |
c := cls theNonMetaclass. |
|
645 |
classes add:(c owningClass ? c). |
|
646 |
]. |
|
647 |
^ self. |
|
648 |
]. |
|
649 |
where == #ownersHierarchiesWithPrivateClasses ifTrue:[ |
|
650 |
classes := IdentitySet new. |
|
651 |
selectedClasses do:[ :cls | |
|
652 |
|c| |
|
653 |
||
654 |
c := cls theNonMetaclass. |
|
655 |
classes addAll:(c owningClass ? c) withAllSubclasses. |
|
656 |
]. |
|
657 |
^ self. |
|
658 |
]. |
|
659 |
(where == #classesAndSuperclasses) ifTrue:[ |
|
660 |
classes := IdentitySet new. |
|
661 |
selectedClasses do:[ :cls | |
|
662 |
classes addAll:cls theNonMetaclass withAllSuperclasses. |
|
663 |
]. |
|
664 |
^ self. |
|
665 |
]. |
|
666 |
(where == #listOfMethods) ifTrue:[ |
|
667 |
classes := nil. |
|
668 |
methods := browser methodListApp methodList value. |
|
669 |
^ self. |
|
670 |
]. |
|
671 |
(where == #listOfSelectedMethods) ifTrue:[ |
|
672 |
classes := nil. |
|
673 |
methods := browser selectedMethods value. |
|
674 |
^ self. |
|
675 |
]. |
|
676 |
! |
|
677 |
||
678 |
isMethodHolder |
|
679 |
isMethodHolder isNil ifTrue:[isMethodHolder := (LastCodeSearchWasMethod ? false) asValue]. |
|
680 |
^ isMethodHolder |
|
681 |
! ! |
|
682 |
||
683 |
!SearchDialog methodsFor:'setup-buttons'! |
|
684 |
||
685 |
addBrowseButton |
|
686 |
|b| |
|
687 |
||
688 |
b := Button label:(resources string:'Browse'). |
|
689 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
690 |
self addButton:b before:nil. |
|
691 |
] ifFalse:[ |
|
692 |
self addButton:b after:nil. |
|
693 |
]. |
|
694 |
b |
|
695 |
action:[ |
|
696 |
openHow := #newBrowser. |
|
697 |
self doAccept. |
|
698 |
self okPressed. |
|
699 |
]. |
|
700 |
^ b. |
|
701 |
! |
|
702 |
||
703 |
addBufferButton |
|
704 |
|b| |
|
705 |
||
706 |
b := Button label:(resources string:'Add Buffer'). |
|
707 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
708 |
self addButton:b before:nil. |
|
709 |
] ifFalse:[ |
|
710 |
self addButton:b after:nil. |
|
711 |
]. |
|
712 |
b |
|
713 |
action:[ |
|
714 |
openHow := #newBuffer. |
|
715 |
self doAccept. |
|
716 |
self okPressed. |
|
717 |
]. |
|
718 |
^ b. |
|
719 |
! |
|
720 |
||
721 |
addButtons |
|
722 |
|prevButton| |
|
723 |
||
724 |
allowFind ifTrue:[ |
|
725 |
defaultOpenHow := #showHere. |
|
726 |
prevButton := self addFindButton. |
|
727 |
]. |
|
728 |
allowBrowser ifTrue:[ |
|
729 |
defaultOpenHow := #newBrowser. |
|
730 |
prevButton := self addBrowseButton. |
|
731 |
]. |
|
732 |
allowBuffer ifTrue:[ |
|
733 |
defaultOpenHow := #newBuffer. |
|
734 |
prevButton := self addBufferButton. |
|
735 |
]. |
|
736 |
prevButton notNil ifTrue:[ |
|
737 |
prevButton isReturnButton:true. |
|
738 |
]. |
|
739 |
self addAbortButton. |
|
740 |
! |
|
741 |
||
742 |
addFindButton |
|
743 |
|b| |
|
744 |
||
745 |
b := Button label:(resources string:'Find'). |
|
746 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
747 |
self addButton:b before:nil. |
|
748 |
] ifFalse:[ |
|
749 |
self addButton:b after:nil. |
|
750 |
]. |
|
751 |
b |
|
752 |
action:[ |
|
753 |
openHow := #showHere. |
|
754 |
self doAccept. |
|
755 |
self okPressed. |
|
756 |
]. |
|
757 |
^ b. |
|
758 |
! ! |
|
759 |
||
760 |
!SearchDialog class methodsFor:'documentation'! |
|
761 |
||
762 |
version |
|
6351 | 763 |
^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.5 2005-07-13 15:35:57 cg Exp $' |
5591 | 764 |
! ! |