forked from pharo-spec/NewTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStMethodFinderSend.class.st
271 lines (200 loc) · 5.19 KB
/
StMethodFinderSend.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
"
Extends `MethodFinderSend` to support Finder UI operations for searching examples.
- Timeout execution.
- Logging errors.
"
Class {
#name : 'StMethodFinderSend',
#superclass : 'Message',
#instVars : [
'receiver'
],
#category : 'NewTools-Finder-Search',
#package : 'NewTools-Finder',
#tag : 'Search'
}
{ #category : 'accessing' }
StMethodFinderSend class >> receiver: r selector: s1 withArguments: args [
^ self new
receiver: r;
selector: s1;
arguments: args;
yourself
]
{ #category : 'comparing' }
StMethodFinderSend >> = aStMethodFinderSend [
^ self species == aStMethodFinderSend species
and: [ receiver == aStMethodFinderSend receiver
and: [ selector == aStMethodFinderSend selector
and: [ arguments = aStMethodFinderSend arguments ] ] ]
]
{ #category : 'accessing' }
StMethodFinderSend >> children [
^ Array empty
]
{ #category : 'copying' }
StMethodFinderSend >> copyTo: aWriteStream [
aWriteStream << self selector
]
{ #category : 'comparing' }
StMethodFinderSend >> debug [
| process suspendedContext debugSession |
process := [ receiver perform: selector withArguments: arguments ] newProcess.
suspendedContext := process suspendedContext.
debugSession := (OupsDebugRequest newForContext: suspendedContext)
process: process;
label: 'debug it';
submit;
debugSession.
3 timesRepeat: [ debugSession stepInto ]
]
{ #category : 'accessing' }
StMethodFinderSend >> displayIcon [
^ self iconNamed: #page
]
{ #category : 'accessing' }
StMethodFinderSend >> evaluate [
^ receiver perform: selector withArguments: arguments
]
{ #category : 'accessing' }
StMethodFinderSend >> evaluateWithTimeOut: anInteger [
| runner result |
runner := TKTLocalProcessTaskRunner new.
runner
schedule: [ result := [ self evaluate ] onErrorDo: [ : e | self handleError: e ] ] asTask
timeout: anInteger milliSeconds.
^ result
]
{ #category : 'accessing' }
StMethodFinderSend >> forFinderPreview: aSpCodePresenter [
self flag: #toRemove.
aSpCodePresenter
beForScripting;
text: self previewText
]
{ #category : 'accessing' }
StMethodFinderSend >> handleError: e [
StFinderSettings logErrorsToTranscript
ifTrue: [ (self logInfo: e) traceCr ].
StFinderSettings logErrorsToFile
ifTrue: [ StFinderSettings logErrorFileReference
writeStreamDo: [ : stream | stream nextPutAll: (self logInfo: e) ] ].
]
{ #category : 'accessing' }
StMethodFinderSend >> hasBrowseAction [
^ false
]
{ #category : 'testing' }
StMethodFinderSend >> hasChildren [
^ false
]
{ #category : 'accessing' }
StMethodFinderSend >> hasHierarchyAction [
^ false
]
{ #category : 'accessing' }
StMethodFinderSend >> hasImplementersAction [
^ true
]
{ #category : 'accessing' }
StMethodFinderSend >> hasInheritanceAction [
^ false
]
{ #category : 'accessing' }
StMethodFinderSend >> hasSendersAction [
^ true
]
{ #category : 'accessing' }
StMethodFinderSend >> hasVersionsAction [
^ false
]
{ #category : 'comparing' }
StMethodFinderSend >> hash [
^ receiver hash bitXor: selector hash
]
{ #category : 'accessing' }
StMethodFinderSend >> implementersAction [
SystemNavigation default browseAllImplementorsOf: self selector
]
{ #category : 'testing' }
StMethodFinderSend >> isClassResult [
^ false
]
{ #category : 'testing' }
StMethodFinderSend >> isSelectorResult [
^ true
]
{ #category : 'accessing' }
StMethodFinderSend >> logInfo: e [
"Answer a <String> representing the error e to be logged"
^ String streamContents: [ : stream |
stream
<< e class name;
<< '[';
<< e messageText;
<< ']';
space.
self printOn: stream ]
]
{ #category : 'testing' }
StMethodFinderSend >> matches: aString [
^ false
]
{ #category : 'accessing' }
StMethodFinderSend >> previewText [
self flag: #toRemove.
^ StFinderPresenter methodFinderExplanation
]
{ #category : 'printing' }
StMethodFinderSend >> printOn: aStream [
aStream print: receiver.
aStream space.
arguments ifEmpty: [^ aStream nextPutAll: selector].
arguments
with: selector keywords
do: [:arg :word |
aStream nextPutAll: word asString.
aStream space.
aStream print: arg.
aStream space ].
aStream skip: -1
]
{ #category : 'accessing' }
StMethodFinderSend >> profile [
self shouldBeImplemented
]
{ #category : 'accessing' }
StMethodFinderSend >> receiver [
^ receiver
]
{ #category : 'accessing' }
StMethodFinderSend >> receiver: anObject [
receiver := anObject
]
{ #category : 'accessing' }
StMethodFinderSend >> resultIn: expectedResult [
[ [ ^ expectedResult = self evaluate ]
onErrorDo: [ :anError | ^ false ] ]
on: Deprecation
do: [ :depr | ^ false ]
]
{ #category : 'accessing' }
StMethodFinderSend >> resultIn: expectedResult timeout: anInteger [
[ [ ^ expectedResult = (self evaluateWithTimeOut: anInteger) ]
onErrorDo: [ :anError | ^ false ] ]
on: Deprecation
do: [ :depr | ^ false ]
]
{ #category : 'accessing' }
StMethodFinderSend >> selectorForFinder [
"Answer a <Symbol> with the receiver's selector for the Finder tool"
^ self selector
]
{ #category : 'accessing' }
StMethodFinderSend >> sendersAction [
self flag: #review. "StFinderSelectorResult>>sendersAction"
SystemNavigation default
browseSendersOf: self selector
name: 'Senders of ' , self selector
autoSelect: self selector
]