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