SmallSenseSmalltalkEditSupport.st
changeset 52 3ca8f7181ed5
parent 50 8655feecd4db
child 61 14e6a63a43a5
--- a/SmallSenseSmalltalkEditSupport.st	Sun Aug 04 02:29:30 2013 +0100
+++ b/SmallSenseSmalltalkEditSupport.st	Mon Aug 05 10:27:05 2013 +0100
@@ -35,6 +35,77 @@
 
 !SmallSenseSmalltalkEditSupport methodsFor:'event handling'!
 
+doKeyPressKeyComplete
+    |cls 
+"/     crsrPos interval node checkedNode
+"/     char start stop selectorSoFar matchingSelectors
+    codeView |
+
+    codeView := service codeView.
+
+    cls := codeView classHolder value.
+    cls isNil ifTrue:[
+        codeView showInfo:'No class'.
+        ^ true.
+    ].
+    UserInformation handle:[:ex |
+        codeView showInfo:(ex messageText).
+        ex proceed.
+    ] do:[
+        codeView withWaitCursorDo:[
+            codeView textView keyRelease: #Control_L x:0 y:0.
+            SmallSenseCompletionWindow openForView: codeView class: cls.
+        ]
+    ].
+    ^ true.
+
+"/
+"/    interval := self selectedInterval.
+"/    interval isEmpty ifTrue:[
+"/        crsrPos := codeView characterPositionOfCursor - 1.
+"/        char := codeView characterUnderCursor.
+"/        [crsrPos > 1 and:[char isSeparator or:['.' includes:char]]] whileTrue:[
+"/            crsrPos := crsrPos - 1.
+"/            char := codeView characterAtCharacterPosition:crsrPos.
+"/        ].
+"/        interval := crsrPos to:crsrPos.
+"/    ].
+"/
+"/    node := self findNodeForInterval:interval allowErrors:true.
+"/    [node isNil] whileTrue:[
+"/        "/ expand to the left ...
+"/        interval start > 1 ifFalse:[
+"/            self showInfo:'No parseNode found'.
+"/            ^ self.
+"/        ].
+"/        interval start:(interval start - 1).
+"/        node := self findNodeForInterval:interval allowErrors:true.
+"/    ].
+"/
+"/    node isVariable ifTrue:[
+"/        self codeCompletionForVariable:node inClass:cls.
+"/        ^ self.
+"/    ].
+"/
+"/    checkedNode := node.
+"/    [checkedNode notNil] whileTrue:[
+"/        checkedNode isMessage ifTrue:[
+"/            self codeCompletionForMessage:checkedNode inClass:cls.
+"/            ^ self
+"/        ].
+"/        checkedNode isMethod ifTrue:[
+"/            self codeCompletionForMethod:checkedNode inClass:cls.
+"/            ^ self.
+"/        ].
+"/        checkedNode := checkedNode parent.
+"/    ].
+"/
+"/    self showInfo:'Node is neither variable nor message.'.
+
+    "Created: / 04-08-2013 / 02:33:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-08-2013 / 11:38:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 keyPress: key x:x y:y in: view
 
     "Handles an event in given view (a subview of codeView).
@@ -48,10 +119,6 @@
     lastTypedKey1 := lastTypedKey0.
     lastTypedKey0 := key.
 
-    key == #'CodeCompletion'  ifTrue: [
-        self complete. 
-        ^ true
-    ].
     key == $^ ifTrue:[
         ^ self keyPressReturnToken
     ].
@@ -59,10 +126,10 @@
         ^ self keyPressReturn
     ]. 
 
-    ^ false.
+    ^ super keyPress: key x:x y:y in: view
 
     "Created: / 07-03-2010 / 09:36:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 26-07-2013 / 12:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-08-2013 / 02:31:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 keyPressReturn
@@ -127,79 +194,6 @@
 
 !SmallSenseSmalltalkEditSupport methodsFor:'private'!
 
-complete
-    |cls 
-"/     crsrPos interval node checkedNode
-"/     char start stop selectorSoFar matchingSelectors
-    codeView |
-
-    codeView := service codeView.
-
-    cls := codeView classHolder value.
-    cls isNil ifTrue:[
-        codeView showInfo:'No class'.
-        ^ self.
-    ].
-    UserInformation handle:[:ex |
-        codeView showInfo:(ex messageText).
-        ex proceed.
-    ] do:[
-        codeView withWaitCursorDo:[
-            codeView textView keyRelease: #Control_L x:0 y:0.
-            SmallSenseCompletionWindow openForView: codeView class: cls.
-        ]
-    ].
-    ^ self.
-
-"/
-"/    interval := self selectedInterval.
-"/    interval isEmpty ifTrue:[
-"/        crsrPos := codeView characterPositionOfCursor - 1.
-"/        char := codeView characterUnderCursor.
-"/        [crsrPos > 1 and:[char isSeparator or:['.' includes:char]]] whileTrue:[
-"/            crsrPos := crsrPos - 1.
-"/            char := codeView characterAtCharacterPosition:crsrPos.
-"/        ].
-"/        interval := crsrPos to:crsrPos.
-"/    ].
-"/
-"/    node := self findNodeForInterval:interval allowErrors:true.
-"/    [node isNil] whileTrue:[
-"/        "/ expand to the left ...
-"/        interval start > 1 ifFalse:[
-"/            self showInfo:'No parseNode found'.
-"/            ^ self.
-"/        ].
-"/        interval start:(interval start - 1).
-"/        node := self findNodeForInterval:interval allowErrors:true.
-"/    ].
-"/
-"/    node isVariable ifTrue:[
-"/        self codeCompletionForVariable:node inClass:cls.
-"/        ^ self.
-"/    ].
-"/
-"/    checkedNode := node.
-"/    [checkedNode notNil] whileTrue:[
-"/        checkedNode isMessage ifTrue:[
-"/            self codeCompletionForMessage:checkedNode inClass:cls.
-"/            ^ self
-"/        ].
-"/        checkedNode isMethod ifTrue:[
-"/            self codeCompletionForMethod:checkedNode inClass:cls.
-"/            ^ self.
-"/        ].
-"/        checkedNode := checkedNode parent.
-"/    ].
-"/
-"/    self showInfo:'Node is neither variable nor message.'.
-
-    "Modified: / 04-07-2006 / 18:48:26 / fm"
-    "Modified: / 20-11-2006 / 12:30:59 / cg"
-    "Created: / 07-03-2010 / 09:37:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 24-07-2013 / 23:29:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 tokensAtCursorLine
     | scanner token |