*** empty log message *** expecco_1_7_2rc1
authorClaus Gittinger <cg@exept.de>
Sat, 07 Nov 2009 21:13:04 +0100
changeset 3853 72343b2ef436
parent 3852 53a677825c05
child 3854 d7904ce12bb6
*** empty log message ***
DoWhatIMeanSupport.st
--- 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 $'
 ! !