--- a/DoWhatIMeanSupport.st Sat Nov 07 04:45:07 2009 +0100
+++ b/DoWhatIMeanSupport.st Sat Nov 07 21:13:04 2009 +0100
@@ -13,7 +13,7 @@
Object subclass:#DoWhatIMeanSupport
instanceVariableNames:''
- classVariableNames:'LastSource LastParseTree'
+ classVariableNames:'LastSource LastParseTree LastChoices'
poolDictionaries:''
category:'System-Support'
!
@@ -148,15 +148,23 @@
!DoWhatIMeanSupport class methodsFor:'code completion-helpers'!
askUserForCompletion:what for:codeView from:allTheBest
- |resources|
+ |list resources choice lastChoice|
allTheBest isEmpty ifTrue:[ ^ nil ].
allTheBest size == 1 ifTrue:[ ^ allTheBest first ].
- allTheBest size < 20 ifTrue:[
+ list := allTheBest.
+ LastChoices notNil ifTrue:[
+ lastChoice := LastChoices at:what ifAbsent:nil.
+ lastChoice notNil ifTrue:[
+ list := {lastChoice. nil. } , (list copyWithout:lastChoice).
+ ].
+ ].
+
+ list size < 30 ifTrue:[
|menu idx exitKey|
- menu := PopUpMenu labels:allTheBest.
+ menu := PopUpMenu labels:list.
menu hideOnKeyFilter:[:key | |hide|
hide := ( #( CursorDown CursorUp Escape Return ) includes: key) not.
hide ifTrue:[
@@ -171,17 +179,25 @@
].
^ nil
].
- ^ allTheBest at:idx.
- ].
- resources := codeView application isNil
- ifTrue:[ codeView resources]
- ifFalse:[ codeView application resources ].
+ choice := list at:idx.
+ ] ifFalse:[
+ resources := codeView application isNil
+ ifTrue:[ codeView resources]
+ ifFalse:[ codeView application resources ].
- ^ Dialog
- choose:(resources string:'Choose ',what)
- fromList:allTheBest
- lines:10
- title:(resources string:'Code completion').
+ choice := Dialog
+ choose:(resources string:'Choose ',what)
+ fromList:list
+ lines:20
+ title:(resources string:'Code completion').
+ choice isNil ifTrue:[^ nil].
+ ].
+
+ LastChoices isNil ifTrue:[
+ LastChoices := Dictionary new.
+ ].
+ LastChoices at:what put:choice.
+ ^ choice
"Created: / 10-11-2006 / 14:00:53 / cg"
!
@@ -1830,9 +1846,9 @@
!DoWhatIMeanSupport class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.62 2009-11-07 03:45:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.63 2009-11-07 20:13:04 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.62 2009-11-07 03:45:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.63 2009-11-07 20:13:04 cg Exp $'
! !