-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPopupFinder.pck.st
1534 lines (1093 loc) · 44.1 KB
/
PopupFinder.pck.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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'From Cuis 6.0 [latest update: #5861] on 16 June 2023 at 6:42:16 pm'!
'Description This is a variation of Cuis Finder by Nicolas Papagna, that uses a popup morph as user interface.
Finder is a system-wide search tool for Cuis Smalltalk.
You can use it to search for classes, methods, senders, implementors, system categories... you name it!!
It is inspired by Pharo''s Spotter and the search feature provided by JetBrains tools, such as IntelliJ IDEA.
Use shift + enter key to open the finder.
tab or left arrow and right arrow keys to change catalog.
Also, you can use catalog specific shortcuts:
alt-c : Classes catalog.
alt-n : Senders catalog.
alt-m : Implementors catalog.
alt-s : Selectors catalog.
alt-p : System categories catalog.
alt-t : Tools catalog.'!
!provides: 'PopupFinder' 1 60!
!requires: 'WorldKeyStrokes' 1 4 nil!
SystemOrganization addCategory: 'PopupFinder-Model'!
SystemOrganization addCategory: 'PopupFinder-UI'!
SystemOrganization addCategory: 'PopupFinder-UI-Model'!
!classDefinition: #FinderMorph category: 'PopupFinder-UI'!
LayoutMorph subclass: #FinderMorph
instanceVariableNames: 'toolbar searchBar results model focusFollowsMouse'
classVariableNames: 'CurrentFinder'
poolDictionaries: ''
category: 'PopupFinder-UI'!
!classDefinition: 'FinderMorph class' category: 'PopupFinder-UI'!
FinderMorph class
instanceVariableNames: ''!
!classDefinition: #FinderSearchInnerTextMorph category: 'PopupFinder-UI'!
InnerTextMorph subclass: #FinderSearchInnerTextMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-UI'!
!classDefinition: 'FinderSearchInnerTextMorph class' category: 'PopupFinder-UI'!
FinderSearchInnerTextMorph class
instanceVariableNames: ''!
!classDefinition: #FinderResultsListMorph category: 'PopupFinder-UI'!
PluggableListMorph subclass: #FinderResultsListMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-UI'!
!classDefinition: 'FinderResultsListMorph class' category: 'PopupFinder-UI'!
FinderResultsListMorph class
instanceVariableNames: ''!
!classDefinition: #FinderSearchTextModelMorph category: 'PopupFinder-UI'!
TextModelMorph subclass: #FinderSearchTextModelMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-UI'!
!classDefinition: 'FinderSearchTextModelMorph class' category: 'PopupFinder-UI'!
FinderSearchTextModelMorph class
instanceVariableNames: ''!
!classDefinition: #FinderSearchBarMorph category: 'PopupFinder-UI'!
BoxedMorph subclass: #FinderSearchBarMorph
instanceVariableNames: 'layoutMorph searchBox changeHandler keyPressedHandler dateAndTimeOfLastKeyStroke timeToWaitBeforeNotifyingChanges'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-UI'!
!classDefinition: 'FinderSearchBarMorph class' category: 'PopupFinder-UI'!
FinderSearchBarMorph class
instanceVariableNames: ''!
!classDefinition: #Catalog category: 'PopupFinder-Model'!
Object subclass: #Catalog
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'Catalog class' category: 'PopupFinder-Model'!
Catalog class
instanceVariableNames: ''!
!classDefinition: #ClassNamesCatalog category: 'PopupFinder-Model'!
Catalog subclass: #ClassNamesCatalog
instanceVariableNames: 'results selectedResultIndex'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'ClassNamesCatalog class' category: 'PopupFinder-Model'!
ClassNamesCatalog class
instanceVariableNames: ''!
!classDefinition: #CompositeCatalog category: 'PopupFinder-Model'!
Catalog subclass: #CompositeCatalog
instanceVariableNames: 'catalogs'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'CompositeCatalog class' category: 'PopupFinder-Model'!
CompositeCatalog class
instanceVariableNames: ''!
!classDefinition: #ImplementedSelectorsCatalog category: 'PopupFinder-Model'!
Catalog subclass: #ImplementedSelectorsCatalog
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'ImplementedSelectorsCatalog class' category: 'PopupFinder-Model'!
ImplementedSelectorsCatalog class
instanceVariableNames: ''!
!classDefinition: #ImplementorsCatalog category: 'PopupFinder-Model'!
Catalog subclass: #ImplementorsCatalog
instanceVariableNames: 'resultsSorter'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'ImplementorsCatalog class' category: 'PopupFinder-Model'!
ImplementorsCatalog class
instanceVariableNames: ''!
!classDefinition: #PackagesCatalog category: 'PopupFinder-Model'!
Catalog subclass: #PackagesCatalog
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'PackagesCatalog class' category: 'PopupFinder-Model'!
PackagesCatalog class
instanceVariableNames: ''!
!classDefinition: #SendersCatalog category: 'PopupFinder-Model'!
Catalog subclass: #SendersCatalog
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'SendersCatalog class' category: 'PopupFinder-Model'!
SendersCatalog class
instanceVariableNames: ''!
!classDefinition: #ToolsCatalog category: 'PopupFinder-Model'!
Catalog subclass: #ToolsCatalog
instanceVariableNames: 'tools implementorsCatalog'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'ToolsCatalog class' category: 'PopupFinder-Model'!
ToolsCatalog class
instanceVariableNames: ''!
!classDefinition: #CompositeCatalogResult category: 'PopupFinder-Model'!
Object subclass: #CompositeCatalogResult
instanceVariableNames: 'catalog result'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'CompositeCatalogResult class' category: 'PopupFinder-Model'!
CompositeCatalogResult class
instanceVariableNames: ''!
!classDefinition: #Finder category: 'PopupFinder-Model'!
Object subclass: #Finder
instanceVariableNames: 'results selectedResultIndex selectedCatalog catalogs currentQuery changeSelectedCatalogSelectorPrefix isSelectedCatalogSelectorPrefix selectedCatalogChangeEvent browseSelectedResultEvent closeEvent'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'Finder class' category: 'PopupFinder-Model'!
Finder class
instanceVariableNames: ''!
!classDefinition: #ResultsSorter category: 'PopupFinder-Model'!
Object subclass: #ResultsSorter
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'ResultsSorter class' category: 'PopupFinder-Model'!
ResultsSorter class
instanceVariableNames: ''!
!classDefinition: #AlphabeticalResultsSorter category: 'PopupFinder-Model'!
ResultsSorter subclass: #AlphabeticalResultsSorter
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'AlphabeticalResultsSorter class' category: 'PopupFinder-Model'!
AlphabeticalResultsSorter class
instanceVariableNames: ''!
!classDefinition: #SelectorSizeResultsSorter category: 'PopupFinder-Model'!
ResultsSorter subclass: #SelectorSizeResultsSorter
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'SelectorSizeResultsSorter class' category: 'PopupFinder-Model'!
SelectorSizeResultsSorter class
instanceVariableNames: ''!
!classDefinition: #SequentialResultsSorter category: 'PopupFinder-Model'!
ResultsSorter subclass: #SequentialResultsSorter
instanceVariableNames: 'renameMe1 resultsSorters'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'SequentialResultsSorter class' category: 'PopupFinder-Model'!
SequentialResultsSorter class
instanceVariableNames: ''!
!classDefinition: #SizeResultsSorter category: 'PopupFinder-Model'!
ResultsSorter subclass: #SizeResultsSorter
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'SizeResultsSorter class' category: 'PopupFinder-Model'!
SizeResultsSorter class
instanceVariableNames: ''!
!classDefinition: #SubstringMatcher category: 'PopupFinder-Model'!
Object subclass: #SubstringMatcher
instanceVariableNames: 'collection substring resultsSorter'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-Model'!
!classDefinition: 'SubstringMatcher class' category: 'PopupFinder-Model'!
SubstringMatcher class
instanceVariableNames: ''!
!classDefinition: #CatalogButton category: 'PopupFinder-UI-Model'!
Object subclass: #CatalogButton
instanceVariableNames: 'catalog model'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-UI-Model'!
!classDefinition: 'CatalogButton class' category: 'PopupFinder-UI-Model'!
CatalogButton class
instanceVariableNames: ''!
!classDefinition: #SearchBoxEditor category: 'PopupFinder-UI-Model'!
Object subclass: #SearchBoxEditor
instanceVariableNames: 'textEditor model keyStrokeHandler'
classVariableNames: ''
poolDictionaries: ''
category: 'PopupFinder-UI-Model'!
!classDefinition: 'SearchBoxEditor class' category: 'PopupFinder-UI-Model'!
SearchBoxEditor class
instanceVariableNames: ''!
!FinderResultsListMorph commentStamp: '<historical>' prior: 0!
Custom list morph for showing finder results that disables keyboard focus.!
!FinderSearchBarMorph commentStamp: 'NPM 5/9/2020 13:51:51' prior: 0!
I am responsible for capturing the query to be performed.
Performance
=========
To avoid notifying changes every time a key is pressed, I keep track of the date and time of the last keystroke (see #processKeyStroke).
I use that information in my #stepAt: method to check whether I should notify #query has changed or not, using my #timeToWaitBeforeNotifyingChanges instance variable.
Hacks
====
To implement shortcuts, I use SearchBoxEditor (see #initializeSearchBoxEditor and comments in SearchBoxEditor class).
!
!ToolsCatalog commentStamp: '<historical>' prior: 0!
I am a catalog that contains all tools available in the World > Open... menu.
To avoid hardcoding them, I look for implementors of #worldMenuForOpenGroup and evaluate them to retrieve each menu item (see #initializeTools).!
!CatalogButton commentStamp: 'NPM 4/2/2020 00:48:04' prior: 0!
I represent a catalog button's model.
The way catatalog buttons work in FinderWindow is similar to radio buttons: only
one can be active at a time, and once one is selected the previous catalog button
is deselected.
To react to selected catalog change events, I subscribe to my finder to determine whether
I am the selected catalog or not (see #isSelected).
When I am clicked, I set myself as the selected catalog (see #value).!
!SearchBoxEditor commentStamp: '<historical>' prior: 0!
My purpose is wrapping instances of TextEditor to override keyboard shortcuts.
If I cannot handle a keyboard event, I forward it to my wrapped text editor.
Any message I do not override is forwarded to my wrapped editor as well.
I also forward event to the results list, so it can be browsed from the editor (see)
Note
===
I exist as a hack, only to allow overriding keyboard handlers.
The way I am installed, and replace, an InnerTextMorph's editor is by assigning
its #editor instance variable using reflection (see #installOn:mode: in my class).
Currently, TextEditor's keyboard shortcut mappings are shared among all instances and
cannot be modified/overriden for a particular instance (see Editor>>#shortcuts).!
!FinderMorph methodsFor: 'GUI building' stamp: 'MM 9/7/2020 11:38:33'!
addToolbarButtonFor: catalog
^ toolbar addMorph: (self toolbarButtonFor: catalog )! !
!FinderMorph methodsFor: 'GUI building' stamp: 'MM 9/7/2020 11:38:33'!
buildLayout
^ self layoutMorph
beColumn
addMorph: toolbar fixedHeight: self defaultButtonPaneHeight;
addMorph: searchBar fixedHeight: self defaultButtonPaneHeight;
addMorphUseAll: results! !
!FinderMorph methodsFor: 'GUI building' stamp: 'MM 9/7/2020 12:39:19'!
buildMorphicWindow
self buildToolbar.
self buildSearchBar.
self buildResults.
self buildLayout.! !
!FinderMorph methodsFor: 'GUI building' stamp: 'MM 11/9/2021 14:28:26'!
buildResults
results := (FinderResultsListMorph
model: model
listGetter: #results
indexGetter: #selectedResultIndex
indexSetter: #selectedResultIndex:)
color: Color veryVeryLightGray ;
autoDeselect: false;
setProperty: #click:localPosition:
toValue: [ :aMouseEvent :localEventPosition | self browseResultAt: localEventPosition ];
yourself! !
!FinderMorph methodsFor: 'GUI building' stamp: 'MM 2/6/2021 12:49:39'!
buildSearchBar
searchBar := FinderSearchBarMorph
onChanged: [ :query | model search: query ]
onKeyPressed: [ :event | self processKeyStroke: event ]
notifyingChangesAfter: 250 milliSeconds
! !
!FinderMorph methodsFor: 'GUI building' stamp: 'MM 9/7/2020 12:35:28'!
buildToolbar
toolbar := LayoutMorph newRow color: Color veryVeryLightGray ; yourself.
self buildToolbarButtonsForCatalogs.! !
!FinderMorph methodsFor: 'GUI building' stamp: 'MM 9/7/2020 11:38:33'!
buildToolbarButtonsForCatalogs
^ model catalogsDo: [ :catalog | self addToolbarButtonFor: catalog ]! !
!FinderMorph methodsFor: 'GUI building' stamp: 'MM 9/7/2020 12:40:13'!
toolbarButtonFor: aCatalog
^ (PluggableButtonMorph
model: (CatalogButton for: aCatalog model: model)
stateGetter: #isSelected
action: #value
label: aCatalog name)
color: Color veryLightGray;
yourself! !
!FinderMorph methodsFor: 'top window' stamp: 'MM 9/7/2020 11:38:33'!
submorphToFocusKeyboard
^ searchBar searchField! !
!FinderMorph methodsFor: 'events-old protocol' stamp: 'MM 9/7/2020 11:38:33'!
update: aSymbol
model
isBrowseSelectedResultEvent: aSymbol
ifTrue: [ ^ self closeBoxHit ].
model
isCloseEvent: aSymbol
ifTrue: [ ^ self closeBoxHit ].! !
!FinderMorph methodsFor: 'shortcuts' stamp: 'MM 9/7/2020 11:38:33'!
forwardToResults: aKeyboardEvent
^ (results arrowKey: aKeyboardEvent)
isNil not
! !
!FinderMorph methodsFor: 'shortcuts' stamp: 'MM 9/7/2020 20:35:32'!
processArrowLeftOrRight: aKeyboardEvent
aKeyboardEvent isArrowLeft
ifTrue: [
model selectPreviousCatalog.
^ true ].
aKeyboardEvent isArrowRight
ifTrue: [
model selectNextCatalog.
^ true ].
^ false
! !
!FinderMorph methodsFor: 'shortcuts' stamp: 'MM 9/7/2020 11:38:33'!
processArrowUpOrDown: aKeyboardEvent
aKeyboardEvent isArrowUp
ifTrue: [
model selectPreviousResult.
^ true ].
aKeyboardEvent isArrowDown
ifTrue: [
model selectNextResult.
^ true ].
^ false
! !
!FinderMorph methodsFor: 'shortcuts' stamp: 'MM 2/6/2021 15:17:27'!
processCatalogKey: aKeyboardEvent
(aKeyboardEvent commandAltKeyPressed)
ifTrue: [
model catalogsDo: [:catalog |
(catalog keyStrokeCharacter == aKeyboardEvent keyCharacter)
ifTrue: [model changeSelectedCatalog: catalog. ^ true]]].
^ false! !
!FinderMorph methodsFor: 'shortcuts' stamp: 'MM 9/7/2020 12:08:12'!
processEscKey: aKeyboardEvent
(aKeyboardEvent isEsc)
ifTrue: [
model close.
self delete.
self runningWorld activeHand newKeyboardFocus: self runningWorld.
FinderMorph current: nil].
^ aKeyboardEvent isEsc! !
!FinderMorph methodsFor: 'shortcuts' stamp: 'MM 2/6/2021 15:02:02'!
processKeyStroke: aKeyboardEvent
(self processTab: aKeyboardEvent)
ifTrue: [ ^ true ].
(self processArrowUpOrDown: aKeyboardEvent)
ifTrue: [ ^ true ].
(self processArrowLeftOrRight: aKeyboardEvent)
ifTrue: [^true].
(self processReturnKey: aKeyboardEvent)
ifTrue: [ ^ true ].
(self processEscKey: aKeyboardEvent)
ifTrue: [ ^ true ].
(self processCatalogKey: aKeyboardEvent)
ifTrue: [^ true].
(self forwardToResults: aKeyboardEvent)
ifTrue: [ ^ true ].
^ false! !
!FinderMorph methodsFor: 'shortcuts' stamp: 'MM 9/7/2020 12:28:27'!
processReturnKey: aKeyboardEvent
(aKeyboardEvent isReturnKey)
ifTrue: [
searchBar notifyQueryChanged.
self browseSelectedResult ].
^ aKeyboardEvent isReturnKey! !
!FinderMorph methodsFor: 'shortcuts' stamp: 'MM 9/7/2020 11:38:33'!
processTab: aKeyboardEvent
aKeyboardEvent isTab
ifTrue: [
aKeyboardEvent shiftPressed
ifTrue: [ model selectPreviousCatalog ]
ifFalse: [ model selectNextCatalog ]].
^ aKeyboardEvent isTab! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/7/2020 12:30:44'!
browseResultAt: aPosition
model
selectedResultIndex: (results rowAtLocation: aPosition).
self browseSelectedResult
! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/7/2020 12:28:56'!
browseSelectedResult
self delete.
model browseSelectedResult.! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/7/2020 11:43:47'!
defaultButtonPaneHeight
"Answer the user's preferred default height for new button panes."
^ Theme current buttonPaneHeight! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/7/2020 22:40:48'!
defaultColor
^ Color veryVeryLightGray! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/24/2022 10:10:03'!
delete
super delete.
FinderMorph current: nil.
focusFollowsMouse ifTrue: [Preferences at: #focusFollowsMouse put: true].
Display restore.! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/25/2020 14:39:28'!
handlesKeyboard
^ true! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/7/2020 11:38:54'!
layoutMorph
^ self! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/7/2020 11:42:16'!
model
^ model! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/7/2020 11:42:06'!
model: anObject
model _ anObject
! !
!FinderMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/24/2022 10:09:29'!
openInWorld
super openInWorld.
self morphHeight: 300.
self morphPositionInWorld: ((self runningWorld morphWidth / 2) - (self morphWidth / 2)) @ 200.
self comeToFront.
"Disable focusFollowsMouse while the finder is open."
focusFollowsMouse _ Preferences focusFollowsMouse.
focusFollowsMouse ifTrue: [Preferences at: #focusFollowsMouse put: false].
"Set keyboard focus"
self world ifNotNil: [ :w |
w activeHand newKeyboardFocus: self submorphToFocusKeyboard ].
FinderMorph current: self.! !
!FinderMorph class methodsFor: 'class initialization' stamp: 'MM 11/9/2021 14:29:49'!
initialize
self configureAsClassFinder.
self inform: 'Finder morph installed. Use cmd+f to open.'! !
!FinderMorph class methodsFor: 'instance creation' stamp: 'MM 2/8/2021 09:54:23'!
open
^ self openOn: Finder withDefaultCatalogs! !
!FinderMorph class methodsFor: 'instance creation' stamp: 'MM 2/8/2021 09:56:20'!
openOn: aFinder
^ self newColumn
model: aFinder;
buildMorphicWindow;
openInWorld! !
!FinderMorph class methodsFor: 'as yet unclassified' stamp: 'MM 2/6/2021 16:46:23'!
configureAsClassFinder
"self configureAsClassFinder"
WorldKeyStrokes addKeyStrokeHandler: [:ev | self worldKeystrokeHandler: ev].
WorldKeyStrokes addKeyStrokeInterceptor: [:ev :morph | self worldKeystrokeInterceptor: ev].
! !
!FinderMorph class methodsFor: 'as yet unclassified' stamp: 'MM 9/7/2020 12:10:49'!
current
^ CurrentFinder! !
!FinderMorph class methodsFor: 'as yet unclassified' stamp: 'MM 9/7/2020 12:11:06'!
current: anInstance
CurrentFinder _ anInstance! !
!FinderMorph class methodsFor: 'as yet unclassified' stamp: 'MM 9/8/2020 17:48:34'!
isFindClassShortcut: aKeyboardEvent
^ aKeyboardEvent shiftPressed and: [ aKeyboardEvent isReturnKey ]! !
!FinderMorph class methodsFor: 'as yet unclassified' stamp: 'MM 2/6/2021 13:43:49'!
worldKeystrokeHandler: aKeyboardEvent
(aKeyboardEvent commandAltKeyPressed or: [ aKeyboardEvent controlKeyPressed ])
ifTrue: [
aKeyboardEvent keyCharacter = $f ifTrue: [ self open. ^true ]].
^false! !
!FinderMorph class methodsFor: 'as yet unclassified' stamp: 'MM 2/6/2021 16:47:37'!
worldKeystrokeInterceptor: aKeyboardEvent
(aKeyboardEvent shiftPressed and: [ aKeyboardEvent isReturnKey ])
ifTrue: [self open. ^ true].
^false! !
!FinderMorph class methodsFor: 'as yet unclassified' stamp: 'MM 9/24/2022 10:20:45'!
worldMenuOptions
^ `{{
#submenuOf -> TheWorldMenu openLabel.
#itemGroup -> 10.
#itemOrder -> 40.
#label -> 'System finder'.
#object -> FinderMorph.
#selector -> #open.
#icon -> #inspectIcon.
#balloonText -> 'The system finder'.
} asDictionary}`! !
!FinderSearchInnerTextMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/25/2020 14:49:37'!
keyboardFocusChange: aBoolean
"Notify change due to green border for keyboard focus"
aBoolean ifFalse: [
"Not pretty at all, but works. Delete the FinderMorph"
self owner owner owner owner delete].! !
!FinderResultsListMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/25/2020 14:23:26'!
gainFocusFrom: aHand
! !
!FinderResultsListMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/25/2020 14:15:57'!
handlesKeyboard
^ false! !
!FinderResultsListMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/25/2020 14:20:15'!
mouseEnter: event! !
!FinderResultsListMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/25/2020 14:21:34'!
mouseLeave: evt! !
!FinderSearchTextModelMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/25/2020 14:43:52'!
innerMorphClass
^ FinderSearchInnerTextMorph! !
!FinderSearchTextModelMorph methodsFor: 'as yet unclassified' stamp: 'MM 9/25/2020 14:48:53'!
mouseLeave: evt! !
!FinderSearchBarMorph methodsFor: 'key stroke handling' stamp: 'HAW 6/30/2020 09:31:20'!
notifyQueryChanged
self stopStepping.
^ changeHandler value: self query! !
!FinderSearchBarMorph methodsFor: 'key stroke handling' stamp: 'NPM 5/9/2020 13:23:26'!
processKeyStroke
dateAndTimeOfLastKeyStroke := DateAndTime now.
self startStepping! !
!FinderSearchBarMorph methodsFor: 'key stroke handling' stamp: 'MM 11/9/2021 14:27:13'!
registerKeyStrokeHandler
^ searchBox innerTextMorph
setProperty: #'keyStroke:'
toValue: [ :event | self processKeyStroke ]! !
!FinderSearchBarMorph methodsFor: 'key stroke handling' stamp: 'NPM 5/9/2020 13:04:54'!
unregisterKeyStrokeHandler
searchBox textMorph
removeProperty: #'keyStroke:'! !
!FinderSearchBarMorph methodsFor: 'initialization' stamp: 'NPM 5/9/2020 13:16:37'!
initializeHandlingChangesWith: aChangeHandler handlingKeysPressedWith: aKeyPressedHandler notifyingChangesAfter: anAmountOfTime
changeHandler := aChangeHandler.
keyPressedHandler := aKeyPressedHandler.
timeToWaitBeforeNotifyingChanges := anAmountOfTime.
self initializeLayout.
self initializeSearchBox.
self initializeSearchBoxEditor.
self registerKeyStrokeHandler.! !
!FinderSearchBarMorph methodsFor: 'initialization' stamp: 'NPM 5/3/2020 20:24:51'!
initializeLayout
layoutMorph := LayoutMorph newColumn.
self addMorph: layoutMorph.! !
!FinderSearchBarMorph methodsFor: 'initialization' stamp: 'MM 9/25/2020 14:44:13'!
initializeSearchBox
searchBox := (FinderSearchTextModelMorph withText: '').
searchBox askBeforeDiscardingEdits: false.
layoutMorph addMorphUseAll: searchBox.! !
!FinderSearchBarMorph methodsFor: 'initialization' stamp: 'NPM 5/3/2020 21:02:26'!
initializeSearchBoxEditor
^ SearchBoxEditor
installOn: searchBox
handlingKeyStrokesWith: keyPressedHandler
! !
!FinderSearchBarMorph methodsFor: 'accessing' stamp: 'NPM 5/3/2020 20:22:39'!
query
^ searchBox text asString! !
!FinderSearchBarMorph methodsFor: 'accessing' stamp: 'MM 11/9/2021 14:28:41'!
searchField
^ searchBox innerTextMorph! !
!FinderSearchBarMorph methodsFor: 'accessing' stamp: 'NPM 5/9/2020 13:11:44'!
timeSinceLastKeyStroke
^ DateAndTime now - dateAndTimeOfLastKeyStroke! !
!FinderSearchBarMorph methodsFor: 'submorphs-add/remove' stamp: 'NPM 5/9/2020 13:04:54'!
delete
self unregisterKeyStrokeHandler.
^ super delete.! !
!FinderSearchBarMorph methodsFor: 'layout' stamp: 'MM 9/25/2020 14:41:12'!
layoutSubmorphs
layoutMorph
morphPosition: 0@0
extent: self morphExtent.! !
!FinderSearchBarMorph methodsFor: 'stepping' stamp: 'HAW 6/30/2020 09:31:12'!
stepAt: millisecondSinceLast
self shouldNotifyQueryChanged
ifTrue: [ self notifyQueryChanged ]
! !
!FinderSearchBarMorph methodsFor: 'testing' stamp: 'NPM 5/9/2020 13:17:30'!
shouldNotifyQueryChanged
^ self timeSinceLastKeyStroke >= timeToWaitBeforeNotifyingChanges! !
!FinderSearchBarMorph methodsFor: 'testing' stamp: 'NPM 5/9/2020 13:21:53'!
stepTime
^ timeToWaitBeforeNotifyingChanges totalMilliseconds! !
!FinderSearchBarMorph class methodsFor: 'instance creation' stamp: 'NPM 5/9/2020 13:31:18'!
onChanged: aChangeHandler onKeyPressed: aKeyPressedHandler notifyingChangesAfter: anAmountOfTime
^ self
new
initializeHandlingChangesWith: aChangeHandler
handlingKeysPressedWith: aKeyPressedHandler
notifyingChangesAfter: anAmountOfTime! !
!Catalog methodsFor: 'accessing' stamp: 'NPM 3/28/2020 02:38:49'!
name
self subclassResponsibility! !
!Catalog methodsFor: 'searching' stamp: 'NPM 4/2/2020 02:29:31'!
processEmptySearchQuery
^ OrderedCollection new! !
!Catalog methodsFor: 'searching' stamp: 'NPM 4/2/2020 02:30:48'!
processNonEmptySearchQuery: aQuery
self subclassResponsibility! !
!Catalog methodsFor: 'searching' stamp: 'NPM 4/2/2020 02:30:48'!
search: aQuery
^ aQuery
ifEmpty: [ self processEmptySearchQuery ]
ifNotEmpty: [ self processNonEmptySearchQuery: aQuery ]! !
!Catalog methodsFor: 'testing' stamp: 'NPM 3/29/2020 01:40:37'!
isNamed: aName
^ self name = aName! !
!Catalog methodsFor: 'browsing' stamp: 'NPM 4/2/2020 02:25:34'!
browse: aResult
self subclassResponsibility! !
!Catalog methodsFor: 'as yet unclassified' stamp: 'MM 2/6/2021 15:10:54'!
keyStrokeCharacter
"Keystroke to use in finder to switch to this catalog. If nil, no keystroke is used. Override in subclasses."
^ nil! !
!Catalog class methodsFor: 'known instances' stamp: 'NPM 4/22/2020 19:31:34'!
classNames
^ ClassNamesCatalog create! !
!Catalog class methodsFor: 'known instances' stamp: 'NPM 4/4/2020 02:01:12'!
composite: children
^ CompositeCatalog withAll: children ! !
!Catalog class methodsFor: 'known instances' stamp: 'NPM 4/22/2020 19:31:37'!
implementedSelectors
^ ImplementedSelectorsCatalog create! !
!Catalog class methodsFor: 'known instances' stamp: 'NPM 4/22/2020 19:31:40'!
implementors
^ ImplementorsCatalog create! !
!Catalog class methodsFor: 'known instances' stamp: 'NPM 4/22/2020 19:31:45'!
senders
^ SendersCatalog create! !
!Catalog class methodsFor: 'known instances' stamp: 'NPM 4/22/2020 19:31:51'!
systemCategories
^ PackagesCatalog create! !
!Catalog class methodsFor: 'known instances' stamp: 'NPM 4/22/2020 19:31:53'!
tools
^ ToolsCatalog create! !
!Catalog class methodsFor: 'instance creation' stamp: 'NPM 4/4/2020 02:01:53'!
create
^ self new! !
!ClassNamesCatalog methodsFor: 'accessing' stamp: 'NPM 3/28/2020 02:39:01'!
name
^ 'Classes'! !
!ClassNamesCatalog methodsFor: 'searching' stamp: 'NPM 4/2/2020 02:30:48'!
processNonEmptySearchQuery: aQuery
^ SubstringMatcher
valueFiltering: Smalltalk classNames
with: aQuery! !
!ClassNamesCatalog methodsFor: 'browsing' stamp: 'NPM 4/2/2020 02:25:34'!
browse: aClassName
| class |
class := (Smalltalk classNamed: aClassName).
BrowserWindow
fullOnClass: class! !
!ClassNamesCatalog methodsFor: 'as yet unclassified' stamp: 'MM 2/6/2021 15:11:15'!
keyStrokeCharacter
^ $c! !
!CompositeCatalog methodsFor: 'accessing' stamp: 'NPM 4/1/2020 00:31:00'!
name
^ 'All'! !
!CompositeCatalog methodsFor: 'initialization' stamp: 'NPM 4/1/2020 00:30:46'!
initializeWithAll: children
catalogs := children! !
!CompositeCatalog methodsFor: 'browsing' stamp: 'NPM 4/20/2020 16:31:26'!
browse: aResult
aResult browse
! !
!CompositeCatalog methodsFor: 'searching' stamp: 'NPM 4/20/2020 16:47:20'!
processNonEmptySearchQuery: aQuery
^ catalogs
inject: OrderedCollection new
into: [ :results :catalog |
results
addAll: (self search: aQuery using: catalog);
yourself ]! !
!CompositeCatalog methodsFor: 'searching' stamp: 'NPM 4/20/2020 16:53:30'!
search: aQuery using: aCatalog
^ (aCatalog search: aQuery)
collect: [ :result | CompositeCatalogResult with: aCatalog from: result ]! !
!CompositeCatalog class methodsFor: 'instance creation' stamp: 'NPM 4/1/2020 00:30:33'!
withAll: children
^ self
new
initializeWithAll: children! !
!ImplementedSelectorsCatalog methodsFor: 'accessing' stamp: 'NPM 3/28/2020 02:39:13'!
name
^ 'Selectors'! !
!ImplementedSelectorsCatalog methodsFor: 'searching' stamp: 'NPM 4/2/2020 02:30:48'!
processNonEmptySearchQuery: aQuery
^ SubstringMatcher
valueFiltering: Smalltalk allImplementedMessages
with: aQuery! !
!ImplementedSelectorsCatalog methodsFor: 'browsing' stamp: 'NPM 4/2/2020 02:25:34'!
browse: aSelector
Smalltalk browseAllImplementorsOf: aSelector! !
!ImplementedSelectorsCatalog methodsFor: 'as yet unclassified' stamp: 'MM 2/6/2021 15:24:02'!
keyStrokeCharacter
^ $s! !
!ImplementorsCatalog methodsFor: 'accessing' stamp: 'NPM 3/28/2020 02:47:38'!
name
^ 'Implementors'! !
!ImplementorsCatalog methodsFor: 'searching' stamp: 'NPM 5/24/2020 13:40:14'!
processNonEmptySearchQuery: aQuery
| implementors |
implementors _ OrderedCollection new.
Smalltalk allBehaviorsDo: [ :class |
class selectors
select: [ :selector | selector includesSubstring: aQuery caseSensitive: false ]
thenDo: [ :selector | implementors add: (MethodReference class: class selector: selector) ] ].
^ resultsSorter value: implementors! !
!ImplementorsCatalog methodsFor: 'browsing' stamp: 'NPM 4/2/2020 02:25:34'!
browse: aMethodReference
HierarchyBrowserWindow
onClass: aMethodReference methodClass
selector: aMethodReference selector! !
!ImplementorsCatalog methodsFor: 'as yet unclassified' stamp: 'NPM 5/24/2020 13:49:04'!
initialize
super initialize.
resultsSorter := ResultsSorter alphabetically, ResultsSorter bySelectorSize ! !
!ImplementorsCatalog methodsFor: 'as yet unclassified' stamp: 'MM 2/6/2021 15:11:37'!
keyStrokeCharacter
^ $m! !
!PackagesCatalog methodsFor: 'accessing' stamp: 'NPM 3/28/2020 03:12:11'!
name
^ 'System categories'! !
!PackagesCatalog methodsFor: 'searching' stamp: 'NPM 4/2/2020 02:30:48'!
processNonEmptySearchQuery: aQuery
^ SubstringMatcher
valueFiltering: SystemOrganization categories
with: aQuery! !