--- a/MethodFinderWindow.st Fri Apr 13 17:49:58 2012 +0200
+++ b/MethodFinderWindow.st Fri Apr 27 15:07:27 2012 +0200
@@ -48,180 +48,172 @@
<resource: #canvas>
^
- #(#FullSpec
- #name: #windowSpec
- #window:
- #(#WindowSpec
- #label: 'MethodFinder'
- #name: 'MethodFinder'
- #bounds: #(#Rectangle 13 23 563 423)
- #menu: #menu
- #forceRecursiveBackground: false
+ #(FullSpec
+ name: windowSpec
+ window:
+ (WindowSpec
+ label: 'MethodFinder'
+ name: 'MethodFinder'
+ bounds: (Rectangle 0 0 550 400)
+ menu: menu
)
- #component:
- #(#SpecCollection
- #collection: #(
- #(#VariableHorizontalPanelSpec
- #name: 'VariableHorizontalPanel1'
- #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
- #snapMode: #both
- #component:
- #(#SpecCollection
- #collection: #(
- #(#ViewSpec
- #name: 'Box6'
- #level: 1
- #component:
- #(#SpecCollection
- #collection: #(
- #(#SequenceViewSpec
- #name: 'List1'
- #layout: #(#LayoutFrame 0 0 0 0.5 0 1 0 1)
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #autoHideScrollBars: true
- #valueChangeSelector: #updateImplementorsOf:
- #useIndex: true
- #sequenceList: #resultHolder
- )
- #(#ViewSpec
- #name: 'Box4'
- #layout: #(#LayoutFrame 0 0 0 0 0 1 -25 0.5)
- #component:
- #(#SpecCollection
- #collection: #(
- #(#LabelSpec
- #label: 'Receiver'
- #name: 'ReceiverLabel'
- #layout: #(#LayoutFrame -4 0.0162791 0 0 -4 0.293023 24 0)
- #translateLabel: true
- #adjust: #center
+ component:
+ (SpecCollection
+ collection: (
+ (VariableHorizontalPanelSpec
+ name: 'VariableHorizontalPanel1'
+ layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+ snapMode: both
+ component:
+ (SpecCollection
+ collection: (
+ (ViewSpec
+ name: 'LeftBox'
+ level: 1
+ component:
+ (SpecCollection
+ collection: (
+ (ViewSpec
+ name: 'ReceiverArgBox'
+ layout: (LayoutFrame 0 0 0 0 0 1 -75 0.5)
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'Receiver'
+ name: 'ReceiverLabel'
+ layout: (LayoutFrame 0 0 0 0 0 0.34 24 0)
+ translateLabel: true
+ )
+ (ComboListSpec
+ name: 'allowedArgments'
+ layout: (LayoutFrame 0 0.34 1 0 0 0.64 23 0)
+ model: argCountHolder
+ comboList: argCountList
+ useIndex: true
)
- #(#ComboListSpec
- #name: 'allowedArgments'
- #layout: #(#LayoutFrame 0 0.339535 1 0 0 0.653488 23 0)
- #model: #argCountHolder
- #comboList: #argCountList
- #useIndex: true
- )
- #(#LabelSpec
- #label: 'Answer'
- #name: 'MessageAnswerLabel'
- #layout: #(#LayoutFrame 0 0.6693 0 0 0 0.99023 24 0)
- #translateLabel: true
- #adjust: #center
+ (LabelSpec
+ label: 'Answer'
+ name: 'MessageAnswerLabel'
+ layout: (LayoutFrame 0 0.64 0 0 0 1 24 0)
+ translateLabel: true
)
- #(#HorizontalPanelViewSpec
- #name: 'HorizontalPanel1'
- #layout: #(#LayoutFrame 0 0 25 0 0 1 0 1)
- #horizontalLayout: #fit
- #verticalLayout: #fit
- #horizontalSpace: 3
- #verticalSpace: 3
- #component:
- #(#SpecCollection
- #collection: #(
- #(#WorkspaceSpec
- #name: 'ReceiverEditor'
- #tabable: true
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #miniScrollerHorizontal: true
- #miniScrollerVertical: true
- #autoHideScrollBars: true
- #extent: #(#Point 87 149)
- #postBuildCallback: #receiverWidgetCreated:
+ (HorizontalPanelViewSpec
+ name: 'HorizontalPanel1'
+ layout: (LayoutFrame 0 0 25 0 0 1 0 1)
+ horizontalLayout: fit
+ verticalLayout: fit
+ horizontalSpace: 3
+ verticalSpace: 3
+ component:
+ (SpecCollection
+ collection: (
+ (WorkspaceSpec
+ name: 'ReceiverEditor'
+ tabable: true
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ miniScrollerHorizontal: true
+ miniScrollerVertical: true
+ autoHideScrollBars: true
+ hasKeyboardFocusInitially: false
+ extent: (Point 87 99)
+ postBuildCallback: receiverWidgetCreated:
)
- #(#VerticalPanelViewSpec
- #name: 'VerticalPanel1'
- #horizontalLayout: #fit
- #verticalLayout: #fit
- #horizontalSpace: 3
- #verticalSpace: 3
- #component:
- #(#SpecCollection
- #collection: #(
- #(#ViewSpec
- #name: 'Box1'
- #visibilityChannel: #arg1BoxVisible
- #component:
- #(#SpecCollection
- #collection: #(
- #(#WorkspaceSpec
- #name: 'Arg1Editor'
- #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
- #tabable: true
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #miniScrollerHorizontal: true
- #miniScrollerVertical: true
- #autoHideScrollBars: true
- #postBuildCallback: #argument1WidgetCreated:
+ (VerticalPanelViewSpec
+ name: 'VerticalPanel1'
+ horizontalLayout: fit
+ verticalLayout: fit
+ horizontalSpace: 3
+ verticalSpace: 3
+ component:
+ (SpecCollection
+ collection: (
+ (ViewSpec
+ name: 'Box1'
+ visibilityChannel: arg1BoxVisible
+ component:
+ (SpecCollection
+ collection: (
+ (WorkspaceSpec
+ name: 'Arg1Editor'
+ layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+ tabable: true
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ miniScrollerHorizontal: true
+ miniScrollerVertical: true
+ autoHideScrollBars: true
+ hasKeyboardFocusInitially: false
+ postBuildCallback: argument1WidgetCreated:
)
)
)
- #extent: #(#Point 87 48)
+ extent: (Point 87 31)
)
- #(#ViewSpec
- #name: 'Box2'
- #visibilityChannel: #arg2BoxVisible
- #component:
- #(#SpecCollection
- #collection: #(
- #(#WorkspaceSpec
- #name: 'TextEditor5'
- #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
- #tabable: true
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #miniScrollerHorizontal: true
- #miniScrollerVertical: true
- #autoHideScrollBars: true
- #postBuildCallback: #argument2WidgetCreated:
+ (ViewSpec
+ name: 'Box2'
+ visibilityChannel: arg2BoxVisible
+ component:
+ (SpecCollection
+ collection: (
+ (WorkspaceSpec
+ name: 'TextEditor5'
+ layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+ tabable: true
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ miniScrollerHorizontal: true
+ miniScrollerVertical: true
+ autoHideScrollBars: true
+ hasKeyboardFocusInitially: false
+ postBuildCallback: argument2WidgetCreated:
)
)
)
- #extent: #(#Point 87 47)
+ extent: (Point 87 31)
)
- #(#ViewSpec
- #name: 'Box3'
- #visibilityChannel: #arg3BoxVisible
- #component:
- #(#SpecCollection
- #collection: #(
- #(#WorkspaceSpec
- #name: 'TextEditor6'
- #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
- #tabable: true
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #miniScrollerHorizontal: true
- #miniScrollerVertical: true
- #autoHideScrollBars: true
- #postBuildCallback: #argument3WidgetCreated:
+ (ViewSpec
+ name: 'Box3'
+ visibilityChannel: arg3BoxVisible
+ component:
+ (SpecCollection
+ collection: (
+ (WorkspaceSpec
+ name: 'TextEditor6'
+ layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+ tabable: true
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ miniScrollerHorizontal: true
+ miniScrollerVertical: true
+ autoHideScrollBars: true
+ hasKeyboardFocusInitially: false
+ postBuildCallback: argument3WidgetCreated:
)
)
)
- #extent: #(#Point 87 48)
+ extent: (Point 87 31)
)
)
)
- #extent: #(#Point 87 149)
+ extent: (Point 87 99)
)
- #(#WorkspaceSpec
- #name: 'AnswerEditor'
- #tabable: true
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #miniScrollerHorizontal: true
- #miniScrollerVertical: true
- #autoHideScrollBars: true
- #extent: #(#Point 88 149)
- #postBuildCallback: #messageAnswerWidgetCreated:
+ (WorkspaceSpec
+ name: 'AnswerEditor'
+ tabable: true
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ miniScrollerHorizontal: true
+ miniScrollerVertical: true
+ autoHideScrollBars: true
+ hasKeyboardFocusInitially: false
+ extent: (Point 88 99)
+ postBuildCallback: messageAnswerWidgetCreated:
)
)
@@ -231,76 +223,119 @@
)
)
- #(#ViewSpec
- #name: 'Box5'
- #layout: #(#LayoutFrame 53 0.224737 -23 0.5 0 1 0 0.5)
- #component:
- #(#SpecCollection
- #collection: #(
- #(#ActionButtonSpec
- #label: 'Clear'
- #name: 'Button2'
- #layout: #(#LayoutFrame 0 0 0 0 -5 0.5 0 1)
- #translateLabel: true
- #model: #clear
+ (ViewSpec
+ name: 'ReceiverArgBoxActionBox'
+ layout: (LayoutFrame 0 0 -73 0.5 0 1 -50 0.5)
+ component:
+ (SpecCollection
+ collection: (
+ (ActionButtonSpec
+ label: 'Clear'
+ name: 'Button2'
+ layout: (LayoutFrame 5 0 0 0 -5 0.5 0 1)
+ translateLabel: true
+ model: clear
)
- #(#ActionButtonSpec
- #label: 'Search'
- #name: 'Button1'
- #layout: #(#LayoutFrame 5 0.5 0 0 0 1 0 1)
- #translateLabel: true
- #tabable: true
- #model: #search
+ (ActionButtonSpec
+ label: 'Search'
+ name: 'Button1'
+ layout: (LayoutFrame 5 0.5 0 0 -5 1 0 1)
+ translateLabel: true
+ tabable: true
+ model: search
)
)
)
)
+ (ViewSpec
+ name: 'MatchActionBox'
+ layout: (LayoutFrame 0 0 -50 0.5 0 1 0 0.5)
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'Selector Pattern:'
+ name: 'Label1'
+ layout: (LayoutFrame 0 0 -25 0.5 0 0.5 0 0.5)
+ translateLabel: true
+ adjust: left
+ )
+ (InputFieldSpec
+ name: 'EntryField1'
+ layout: (LayoutFrame 0 0 -25 1 0 0.5 0 1)
+ model: selectorPattern
+ immediateAccept: true
+ acceptOnReturn: true
+ acceptOnTab: true
+ acceptOnPointerLeave: true
+ )
+ (ActionButtonSpec
+ label: 'Search'
+ name: 'Button4'
+ layout: (LayoutFrame 5 0.5 -25 1 -5 1 0 1)
+ translateLabel: true
+ tabable: true
+ model: searchPatternMatches
+ )
+ )
+
+ )
+ )
+ (SequenceViewSpec
+ name: 'ResultList'
+ layout: (LayoutFrame 0 0 0 0.5 0 1 0 1)
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ autoHideScrollBars: true
+ valueChangeSelector: updateImplementorsOf:
+ useIndex: true
+ sequenceList: resultHolder
+ )
)
)
)
- #(#VariableVerticalPanelSpec
- #name: 'VariableVerticalPanel1'
- #component:
- #(#SpecCollection
- #collection: #(
- #(#SequenceViewSpec
- #name: 'List2'
- #model: #selectedClassOfResultHolder
- #menu: #implementorListMenu
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #autoHideScrollBars: true
- #doubleClickSelector: #openBrowserOn:
- #valueChangeSelector: #selectedClassOfResultHolderChanged
- #useIndex: false
- #sequenceList: #classOfResultHolder
+ (VariableVerticalPanelSpec
+ name: 'VariableVerticalPanel1'
+ component:
+ (SpecCollection
+ collection: (
+ (SequenceViewSpec
+ name: 'List2'
+ model: selectedClassOfResultHolder
+ menu: implementorListMenu
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ autoHideScrollBars: true
+ doubleClickSelector: openBrowserOn:
+ valueChangeSelector: selectedClassOfResultHolderChanged
+ useIndex: false
+ sequenceList: classOfResultHolder
)
- #(#CodeViewSpec
- #name: 'CodeView'
- #model: #codeHolder
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #autoHideScrollBars: true
- #postBuildCallback: #sourceCodeWidgetCreated:
+ (CodeViewSpec
+ name: 'CodeView'
+ model: codeHolder
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ autoHideScrollBars: true
+ hasKeyboardFocusInitially: false
+ postBuildCallback: sourceCodeWidgetCreated:
)
)
)
- #handles: #(#Any 0.5 1.0)
+ handles: (Any 0.5 1.0)
)
)
)
- #handles: #(#Any 0.5 1.0)
+ handles: (Any 0.5 1.0)
)
)
)
)
-
- "Modified: / 13.11.2001 / 12:53:50 / cg"
! !
!MethodFinderWindow class methodsFor:'menu specs'!
@@ -496,6 +531,10 @@
x := aClass size + 2.
aSelector := theArgument copyFrom:x.
aClass := Smalltalk classNamed:aClass.
+ (aSelector startsWith:'class ') ifTrue:[
+ aSelector := aSelector copyFrom:'class 'size+1.
+ aClass := aClass class.
+ ].
^ aClass -> aSelector asSymbol
"
@@ -506,7 +545,7 @@
"
- "Modified: / 13.11.2001 / 12:45:43 / cg"
+ "Modified: / 27-04-2012 / 15:05:53 / cg"
!
isExpression: aString
@@ -656,6 +695,36 @@
"Modified: / 26-09-2011 / 12:42:28 / cg"
!
+searchPatternMatches
+ "Do a search based on the pattern match"
+
+ | pattern list selectors counts|
+
+ pattern := self selectorPattern value.
+
+ self resultHolder value: nil. "reset the result list"
+ self classOfResultHolder value: nil. "reset the implementorOf list"
+ self codeHolder value: nil. "reset the source"
+
+ self withCursor:Cursor execute do:[
+ list := SystemBrowser findImplementorsMatching:pattern in:Smalltalk allClasses ignoreCase:true.
+ ].
+
+ counts := IdentityDictionary new.
+ selectors := IdentitySet new.
+
+ list do:[:eachMethod |
+ selectors add: eachMethod selector.
+ (counts at:(eachMethod selector) ifAbsentPut:[0 asValue]) increment
+ ].
+
+ resultSelectors := selectors asOrderedCollection sort.
+
+ self resultHolder value: (resultSelectors collect:[:sel | sel,' --> ',(counts at:sel) value printString,' implementor(s)']).
+
+ "Created: / 27-04-2012 / 14:46:35 / cg"
+!
+
selectedClassOfResultHolderChanged
|sel classAndSelector mthd|
@@ -784,8 +853,13 @@
(holder := builder bindingAt:#resultHolder) isNil ifTrue:[
holder := ValueHolder new.
builder aspectAt:#resultHolder put:holder.
+ holder value:#('Please enter combination of'
+ ' receiver, arg and result'
+ ' into the above fields, then click on "search".').
].
^ holder.
+
+ "Modified: / 27-04-2012 / 14:25:33 / cg"
!
selectedClassOfResultHolder
@@ -798,6 +872,18 @@
builder aspectAt:#selectedClassOfResultHolder put:holder
].
^ holder
+!
+
+selectorPattern
+ |holder|
+ (holder := builder bindingAt:#selectorPattern) isNil ifTrue:[
+ holder := ValueHolder new.
+ builder aspectAt:#selectorPattern put:holder.
+ holder onChangeSend:#searchPatternMatches to:self.
+ ].
+ ^ holder
+
+ "Created: / 27-04-2012 / 14:44:01 / cg"
! !
!MethodFinderWindow methodsFor:'callBacks'!